Outline Wiki Installation with Docker

Outline is a modern, open-source wiki and knowledge base platform with a beautiful user interface and powerful search capabilities. Built with React and Node.js, Outline provides real-time collaboration features, document versioning, and integrations with OAuth identity providers. This guide covers Docker Compose deployment, PostgreSQL setup, Redis configuration, S3 storage integration, and OIDC authentication.

Table of Contents

Prerequisites

Ensure you have:

  • Ubuntu 20.04 LTS or later
  • Root or sudo access
  • A registered domain name
  • Minimum 4GB RAM (8GB+ recommended)
  • 30GB available disk space
  • Basic Linux administration knowledge

Update system:

sudo apt update && sudo apt upgrade -y

System Requirements

Verify system specifications:

Check OS version:

cat /etc/os-release
uname -m

Check available resources:

free -h
df -h

Docker Installation

Install Docker and Docker Compose:

sudo apt install -y docker.io docker-compose

Add user to docker group:

sudo usermod -aG docker $USER
newgrp docker

Verify Docker installation:

docker --version
docker-compose --version

Start Docker:

sudo systemctl start docker
sudo systemctl enable docker

PostgreSQL Setup

Create PostgreSQL data directory:

sudo mkdir -p /var/lib/postgresql
sudo chown -R $USER:$USER /var/lib/postgresql

Create PostgreSQL container:

docker run -d \
  --name postgres \
  -e POSTGRES_DB=outline \
  -e POSTGRES_USER=outline \
  -e POSTGRES_PASSWORD=SecurePassword123! \
  -v /var/lib/postgresql:/var/lib/postgresql/data \
  -p 5432:5432 \
  postgres:13-alpine

Verify PostgreSQL is running:

docker ps | grep postgres

Redis Installation

Create Redis container:

docker run -d \
  --name redis \
  -p 6379:6379 \
  redis:7-alpine

Verify Redis is running:

docker ps | grep redis

Outline Docker Deployment

Create Outline directory:

mkdir -p /opt/outline
cd /opt/outline

Generate secret keys:

openssl rand -hex 32 > SECRET_KEY
openssl rand -hex 32 > UTILS_SECRET

Create docker-compose.yml:

nano docker-compose.yml

Add configuration:

version: '3'
services:
  outline:
    image: outlinewiki/outline:latest
    environment:
      - DATABASE_URL=postgres://outline:SecurePassword123!@postgres:5432/outline
      - REDIS_URL=redis://redis:6379
      - SECRET_KEY=$(cat SECRET_KEY)
      - UTILS_SECRET=$(cat UTILS_SECRET)
      - NODE_ENV=production
      - PORT=3000
      - URL=https://wiki.example.com
      - FORCE_HTTPS=true
      - WEB_CONCURRENCY=4
      - OIDC_CLIENT_ID=your-client-id
      - OIDC_CLIENT_SECRET=your-client-secret
      - OIDC_AUTH_URI=https://auth.example.com/oauth/authorize
      - OIDC_TOKEN_URI=https://auth.example.com/oauth/token
      - OIDC_USERINFO_URI=https://auth.example.com/oauth/userinfo
      - OIDC_USERNAME_CLAIM=preferred_username
      - OIDC_DISPLAY_NAME=Single Sign On
      - AWS_S3_UPLOAD_BUCKET_URL=https://s3.example.com/outline
      - AWS_S3_UPLOAD_BUCKET_NAME=outline
      - AWS_S3_UPLOAD_KEY_ID=your-access-key
      - AWS_S3_UPLOAD_SECRET_KEY=your-secret-key
      - AWS_S3_UPLOAD_REGION=us-east-1
    ports:
      - "3000:3000"
    depends_on:
      - postgres
      - redis
    restart: always
    networks:
      - outline

  postgres:
    image: postgres:13-alpine
    environment:
      - POSTGRES_DB=outline
      - POSTGRES_USER=outline
      - POSTGRES_PASSWORD=SecurePassword123!
    volumes:
      - /var/lib/postgresql:/var/lib/postgresql/data
    restart: always
    networks:
      - outline

  redis:
    image: redis:7-alpine
    restart: always
    networks:
      - outline

networks:
  outline:
    driver: bridge

Create .env file:

nano .env

Add environment variables:

DATABASE_URL=postgres://outline:SecurePassword123!@postgres:5432/outline
REDIS_URL=redis://redis:6379
SECRET_KEY=$(cat SECRET_KEY)
UTILS_SECRET=$(cat UTILS_SECRET)
NODE_ENV=production
PORT=3000
URL=https://wiki.example.com
FORCE_HTTPS=true

Start Outline containers:

docker-compose up -d

Verify containers are running:

docker-compose ps
docker-compose logs -f outline

Wait for initialization to complete (may take 1-2 minutes).

Nginx Configuration

Install Nginx:

sudo apt install -y nginx

Create Nginx configuration:

sudo nano /etc/nginx/sites-available/outline

Add configuration:

upstream outline {
    server localhost:3000;
}

server {
    listen 80;
    listen [::]:80;
    server_name wiki.example.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name wiki.example.com;

    ssl_certificate /etc/letsencrypt/live/wiki.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/wiki.example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    client_max_body_size 100M;

    location / {
        proxy_pass http://outline;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

Enable site:

sudo ln -s /etc/nginx/sites-available/outline /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl start nginx
sudo systemctl enable nginx

SSL Configuration

Install Certbot:

sudo apt install -y certbot python3-certbot-nginx

Obtain SSL certificate:

sudo certbot certonly --standalone -d wiki.example.com

Verify certificate:

sudo openssl x509 -in /etc/letsencrypt/live/wiki.example.com/fullchain.pem -noout -dates

Set up auto-renewal:

sudo systemctl enable certbot.timer
sudo systemctl start certbot.timer

S3 Storage Setup

Configure AWS S3 for file storage. Create S3 bucket:

aws s3api create-bucket \
  --bucket outline \
  --region us-east-1

Create IAM user:

aws iam create-user --user-name outline

Create access keys:

aws iam create-access-key --user-name outline

Save access key and secret key. Attach S3 policy:

aws iam attach-user-policy \
  --user-name outline \
  --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess

Update Outline environment variables:

cd /opt/outline
nano .env

Add S3 configuration:

AWS_S3_UPLOAD_BUCKET_NAME=outline
AWS_S3_UPLOAD_KEY_ID=your-access-key
AWS_S3_UPLOAD_SECRET_KEY=your-secret-key
AWS_S3_UPLOAD_REGION=us-east-1

Restart containers:

docker-compose down
docker-compose up -d

OIDC Authentication

Configure OIDC provider authentication. Register Outline as OAuth client with your provider.

Update Outline configuration with OIDC details:

cd /opt/outline
nano docker-compose.yml

Update OIDC environment variables:

OIDC_CLIENT_ID=your-client-id
OIDC_CLIENT_SECRET=your-client-secret
OIDC_AUTH_URI=https://auth.example.com/oauth/authorize
OIDC_TOKEN_URI=https://auth.example.com/oauth/token
OIDC_USERINFO_URI=https://auth.example.com/oauth/userinfo
OIDC_USERNAME_CLAIM=preferred_username
OIDC_DISPLAY_NAME=Single Sign On
OIDC_SCOPES=openid profile email

Restart containers:

docker-compose restart outline

Backup and Maintenance

Create backup script:

sudo nano /usr/local/bin/outline-backup.sh

Add:

#!/bin/bash

BACKUP_DIR="/backups/outline"
DATE=$(date +%Y%m%d_%H%M%S)

mkdir -p $BACKUP_DIR

# Database backup
docker exec postgres pg_dump -U outline outline | gzip > "$BACKUP_DIR/outline-db-$DATE.sql.gz"

# Keep only 30 days
find $BACKUP_DIR -type f -mtime +30 -delete

echo "Backup completed: $DATE"

Make executable:

sudo chmod +x /usr/local/bin/outline-backup.sh

Schedule daily backups:

sudo crontab -e

Add:

0 2 * * * /usr/local/bin/outline-backup.sh >> /var/log/outline-backup.log 2>&1

Update Outline:

cd /opt/outline
docker-compose pull
docker-compose up -d

Monitor containers:

docker-compose logs -f outline

Restart containers if needed:

docker-compose restart

Conclusion

Outline wiki is now fully deployed with Docker, providing a modern knowledge base platform. With PostgreSQL database, Redis caching, S3 file storage, and OIDC authentication, you have a complete, scalable documentation solution. Configure document sharing, team collaboration, and search indexing to create an effective team wiki. Regular backups and updates maintain platform reliability and document preservation.