version: "3.8"

services:
  redis:
    image: redis:7
    container_name: outline_redis
    volumes:
      - outline_redis_data:/data
    user: "redis:redis"
    deploy:
      resources:
        limits:
          memory: 200M
          cpus: '0.5'

  postgres:
    image: postgres:15
    container_name: outline_postgres
    ports:
      - "127.0.0.1:55432:5432"
    volumes:
      - outline_postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: gs_rkhvk_outline
      POSTGRES_PASSWORD: gs_rkhvk
      POSTGRES_DB: gs_rkhvk_outline
    user: "postgres:postgres"
    deploy:
      resources:
        limits:
          memory: 200M
          cpus: '0.5'

  outline:
    image: outlinewiki/outline
    container_name: outline
    ports:
      - "3011:3000"  # Expose Outline on host:3011
    env_file: .env
    volumes:
      - outline_storage_data:/var/lib/outline/storage
    depends_on:
      - postgres
      - redis
    deploy:
      resources:
        limits:
          memory: 800M
          cpus: '1.5'
    restart: unless-stopped

volumes:
  outline_postgres_data:
    driver: local
    driver_opts:
      type: none
      device: /opt/outline/data/postgres
      o: bind

  outline_redis_data:
    driver: local
    driver_opts:
      type: none
      device: /opt/outline/data/redis
      o: bind

  outline_storage_data:
    driver: local
    driver_opts:
      type: none
      device: /opt/outline/data/storage
      o: bind
