# https://chibisafe.app/docs/intro
#
# Default Credentials
#   USERNAME: admin
#   PASSWORD: admin
services:
  chibisafe:
    image: chibisafe/chibisafe:latest
    networks:
      - chibinet
    environment:
      - BASE_API_URL=http://chibisafe_server:8000
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--spider", "--quiet", "http://127.0.0.1:8001"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

  chibisafe_server:
    image: chibisafe/chibisafe-server:latest
    networks:
      - chibinet
    volumes:
      - database:/app/database:rw
      - uploads:/app/uploads:rw
      - logs:/app/logs:rw
    restart: unless-stopped
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "--spider",
          "--quiet",
          "http://127.0.0.1:8000/api/health",
        ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

  caddy:
    image: caddy:2-alpine
    networks:
      - chibinet
    volumes:
      - ../files/Caddyfile:/etc/caddy/Caddyfile:ro
      - uploads:/app/uploads:ro
    environment:
      - BASE_URL=":80"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--spider", "--quiet", "http://127.0.0.1:80"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

volumes:
  database:
  uploads:
  logs:

networks:
  chibinet:
    driver: bridge
    internal: true
