x-environment: &default-environment
  DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
  SECRET_KEY: ${SECRET_KEY}
  PORT: ${GLITCHTIP_PORT}
  EMAIL_URL: consolemail://
  GLITCHTIP_DOMAIN: http://${GLITCHTIP_HOST}
  DEFAULT_FROM_EMAIL: email@glitchtip.com
  CELERY_WORKER_AUTOSCALE: "1,3"
  CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000"

x-depends_on: &default-depends_on
  - postgres
  - redis

services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_HOST_AUTH_METHOD: "trust"
    restart: unless-stopped
    volumes:
      - pg-data:/var/lib/postgresql/data
    networks:
      - dokploy-network
  redis:
    image: redis
    restart: unless-stopped
    networks:
      - dokploy-network
  web:
    image: glitchtip/glitchtip:v4.0
    depends_on: *default-depends_on
    ports:
      - ${GLITCHTIP_PORT}
    environment: *default-environment
    restart: unless-stopped
    volumes:
      - uploads:/code/uploads
  worker:
    image: glitchtip/glitchtip:v4.0
    command: ./bin/run-celery-with-beat.sh
    depends_on: *default-depends_on
    environment: *default-environment
    restart: unless-stopped
    volumes:
      - uploads:/code/uploads
    networks:
      - dokploy-network
  migrate:
    image: glitchtip/glitchtip:v4.0
    depends_on: *default-depends_on
    command: "./manage.py migrate"
    environment: *default-environment
    networks:
      - dokploy-network

volumes:
  pg-data:
  uploads:
