# Outline Wiki Knowledge Base

> Modern team wiki and knowledge base with real-time collaboration.

- Category: Productivity & Collaboration
- Difficulty: intermediate
- Components: outline, postgresql, redis, minio, nginx
- Tags: outline, wiki, knowledge-base, collaboration, documentation
- Source: https://docker.recipes/productivity/outline-wiki-stack

## Overview

Outline is a modern, open-source wiki and knowledge base platform designed for teams that need real-time collaborative documentation. Built with a focus on beautiful UI and excellent writing experience, Outline supports structured documents with rich formatting, linking between pages, and powerful search capabilities. Unlike traditional wikis, Outline emphasizes a more document-centric approach similar to Notion or Confluence but with better performance and team collaboration features. This production stack combines Outline with PostgreSQL for robust document storage and full-text search, Redis for session management and real-time collaboration features, MinIO for file uploads and media storage, and NGINX for high-performance reverse proxying. The architecture provides enterprise-grade reliability while maintaining the flexibility of self-hosted deployment. This configuration is ideal for organizations wanting complete control over their knowledge base without vendor lock-in, development teams needing technical documentation with code syntax highlighting, and companies requiring compliance with data sovereignty requirements where cloud-hosted solutions aren't suitable.

## Features

- Real-time collaborative editing with conflict resolution powered by Redis pub/sub messaging
- Full-text search across all documents using PostgreSQL's advanced search capabilities with ranking
- S3-compatible file storage through MinIO for document attachments, images, and media assets
- Structured document organization with collections, nested pages, and automatic table of contents
- OAuth integration support for Slack, Google Workspace, and custom OIDC providers
- Document versioning and revision history stored in PostgreSQL with efficient diff tracking
- Public document sharing with customizable permissions and link-based access controls
- High-performance static asset delivery through NGINX with caching and compression

## Use cases

- Engineering teams building technical documentation with code examples and API references
- Startups creating company handbooks, processes, and knowledge repositories
- Educational institutions managing course materials and collaborative research documentation
- Healthcare organizations maintaining compliant documentation with audit trails
- Remote teams centralizing meeting notes, project documentation, and decision records
- Software companies creating user-facing documentation and help centers
- Consulting firms organizing client deliverables and internal methodology guides

## Prerequisites

- Minimum 4GB RAM (2GB for Outline + PostgreSQL, 512MB for Redis, 512MB for MinIO, 256MB for NGINX)
- Docker Engine 20.10+ and Docker Compose v2 for health check and depends_on support
- OAuth provider configured (Slack, Google, or OIDC) as Outline requires external authentication
- Domain name and SSL certificates if deploying for production team access
- Basic understanding of PostgreSQL administration for backup and maintenance procedures
- Ports 80, 443, 3000, 9000, and 9001 available for web access and MinIO console

## docker-compose.yml

```yaml
services:
  outline:
    image: outlinewiki/outline:latest
    ports:
      - "3000:3000"
    environment:
      SECRET_KEY: ${SECRET_KEY}
      UTILS_SECRET: ${UTILS_SECRET}
      DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
      REDIS_URL: redis://redis:6379
      URL: http://localhost:3000
      PORT: 3000
      AWS_ACCESS_KEY_ID: ${MINIO_ACCESS_KEY}
      AWS_SECRET_ACCESS_KEY: ${MINIO_SECRET_KEY}
      AWS_S3_UPLOAD_BUCKET_URL: http://minio:9000
      AWS_S3_UPLOAD_BUCKET_NAME: outline
      AWS_S3_FORCE_PATH_STYLE: "true"
      AWS_S3_ACL: private
      SLACK_CLIENT_ID: ${SLACK_CLIENT_ID}
      SLACK_CLIENT_SECRET: ${SLACK_CLIENT_SECRET}
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
      minio:
        condition: service_started
    networks:
      - outline-net
    restart: unless-stopped

  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - outline-net
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data
    networks:
      - outline-net
    restart: unless-stopped

  minio:
    image: minio/minio:latest
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
      MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
    volumes:
      - minio_data:/data
    command: server /data --console-address ":9001"
    networks:
      - outline-net
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - outline
    networks:
      - outline-net
    restart: unless-stopped

volumes:
  postgres_data:
  redis_data:
  minio_data:

networks:
  outline-net:
    driver: bridge
```

## .env

```bash
# Outline Secrets
SECRET_KEY=$(openssl rand -hex 32)
UTILS_SECRET=$(openssl rand -hex 32)

# PostgreSQL
POSTGRES_USER=outline
POSTGRES_PASSWORD=secure_postgres_password
POSTGRES_DB=outline

# MinIO
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=secure_minio_password

# Slack OAuth (required)
SLACK_CLIENT_ID=xxx
SLACK_CLIENT_SECRET=xxx
```

## Usage notes

- Outline at http://localhost:3000
- Requires Slack, Google, or OIDC for authentication
- MinIO Console at http://localhost:9001
- Create MinIO bucket 'outline' before starting

## Troubleshooting

- Outline fails to start with database connection errors: Ensure PostgreSQL health check passes and DATABASE_URL environment variable matches POSTGRES_* credentials exactly
- File uploads fail with S3 errors: Create the 'outline' bucket in MinIO console at localhost:9001 and verify MINIO_ACCESS_KEY matches AWS_ACCESS_KEY_ID
- Authentication redirect loops: Check that URL environment variable matches your actual domain and OAuth provider redirect URLs are configured correctly
- Search functionality not working: PostgreSQL full-text search requires proper locale settings - ensure POSTGRES_INITDB_ARGS includes correct locale if using non-English content
- Redis connection timeouts during collaboration: Increase Redis memory limits and check for memory pressure, as Outline uses Redis heavily for real-time features
- NGINX 502 Bad Gateway errors: Verify Outline container is healthy and running on port 3000, check docker network connectivity between nginx and outline services

