version: "3"
services:

  outline:
    image: outlinewiki/outline
    env_file: ./docker.env
    depends_on:
      - postgres
      - redis
      - storage
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.outline-secure.entrypoints=https"
      - "traefik.http.routers.outline-secure.rule=Host(`outline.mrdev023.fr`)"
      - "traefik.http.routers.outline-secure.tls=true"
      - "traefik.http.routers.outline-secure.tls.certresolver=sslResolver"
      - "traefik.http.services.whoami.loadbalancer.server.port=3000"
      - "traefik.docker.network=proxy"

  redis:
    image: redis
    env_file: ./docker.env
    volumes:
      - ./redis.conf:/redis.conf
    command: ["redis-server", "/redis.conf"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 30s
      retries: 3

  postgres:
    image: postgres
    env_file: ./docker.env
    volumes:
      - database-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready"]
      interval: 30s
      timeout: 20s
      retries: 3
    environment:
      POSTGRES_USER: 'user'
      POSTGRES_PASSWORD: 'pass'
      POSTGRES_DB: 'outline'

  storage:
    image: minio/minio
    env_file: ./docker.env
    entrypoint: sh
    command: -c 'minio server'
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - storage-data:/data
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3

volumes:
  https-portal-data:
  storage-data:
  database-data:
networks:
  proxy:
    external: true

