services:
  client:
    image: ghcr.io/bluewave-labs/checkmate:frontend-demo
    restart: always
    environment:
      UPTIME_APP_API_BASE_URL: "https://checkmate-demo.bluewavelabs.ca/api/v1"
      UPTIME_APP_CLIENT_HOST: "https://checkmate-demo.bluewavelabs.ca"
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - server
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d/:ro
      - ./certbot/www:/var/www/certbot/:ro
      - ./certbot/conf/:/etc/nginx/ssl/:ro

  certbot:
    image: certbot/certbot:latest
    restart: always
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;'"

  server:
    image: ghcr.io/bluewave-labs/checkmate:backend-demo
    restart: always
    ports:
      - "52345:52345"
    env_file:
      - server.env
    depends_on:
      - mongodb
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
  mongodb:
    image: ghcr.io/bluewave-labs/checkmate:mongo-demo
    restart: always
    command: ["mongod", "--quiet", "--bind_ip_all"]
    volumes:
      - ./mongo/data:/data/db
    env_file:
      - mongo.env
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
      interval: 5s
      timeout: 30s
      start_period: 0s
      start_interval: 1s
      retries: 30
  capture:
    image: ghcr.io/bluewave-labs/capture:latest
    container_name: capture
    restart: unless-stopped
    ports:
      - "59232:59232"
    environment:
      - API_SECRET=my_secret
      - GIN_MODE=release
    volumes:
      - /etc/os-release:/etc/os-release:ro
