Outline Wiki Instaleation 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.

Tabla de contenidos

Requisitos previos

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

Requisitos del sistema

Verifique las especificaciones del sistema:

Check OS version:

cat /etc/os-release
uname -m

Check available resources:

free -h
df -h

Docker Instaleation

Instale Docker and Docker Compose:

sudo apt install -y docker.io docker-compose

Add user to docker group:

sudo usermod -aG docker $USER
newgrp docker

Verifique Docker installation:

docker --version
docker-compose --version

Start Docker:

sudo systemctl start docker
sudo systemctl enable docker

PostgreSQL Setup

Cree PostgreSQL data directory:

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

Cree 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

Verifique PostgreSQL is running:

docker ps | grep postgres

Redis Instaleation

Cree Redis container:

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

Verifique Redis is running:

docker ps | grep redis

Outline Docker Implementement

Cree Outline directory:

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

Generate secret keys:

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

Cree 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

Cree .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

Verifique containers are running:

docker-compose ps
docker-compose logs -f outline

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

Configuración de Nginx

Instale Nginx:

sudo apt install -y nginx

Cree 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

Instale Certbot:

sudo apt install -y certbot python3-certbot-nginx

Obtain SSL certificate:

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

Verifique certificate:

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

Configure auto-renewal:

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

S3 Storage Setup

Configure AWS S3 for file storage. Cree S3 bucket:

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

Cree IAM user:

aws iam create-user --user-name outline

Cree 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

Reinicie 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

Reinicie containers:

docker-compose restart outline

Copia de seguridad y mantenimiento

Cree 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

Reinicie containers if needed:

docker-compose restart

Conclusión

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.