x-default: &default restart: unless-stopped networks: - overlay x-healthcheck-interval: &hc-interval interval: 30s timeout: 60s retries: 5 start_period: 10s x-db-environment: &x-db-environment POSTGRES_SSL_MODE: "disable" POSTGRES_HOST: ${POSTGRES_HOST} POSTGRES_PORT: ${POSTGRES_PORT} POSTGRES_DB: test POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_USER: ${POSTGRES_USER} x-api-environment: &x-api-environment SQLALCHEMY_DEBUG: ${SQLALCHEMY_DEBUG} UVICORN_HOST: ${UVICORN_HOST} UVICORN_PORT: ${UVICORN_PORT} APP_NAME: ${APP_NAME} GRPC_ENDPOINT: ${GRPC_ENDPOINT} services: nginx: <<: *default profiles: ["api", "grafana"] container_name: cats.nginx hostname: cats.nginx image: nginx:stable-alpine volumes: - ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf - ./deploy/nginx/templates:/etc/nginx/templates ports: - 80:80 depends_on: api: condition: service_healthy grafana: condition: service_healthy db: <<: *default profiles: ["api"] container_name: cats.db hostname: cats.db image: postgres:alpine environment: <<: *x-db-environment volumes: - cats.postgres.data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"] <<: *hc-interval api: <<: *default profiles: ["api"] container_name: cats.api hostname: cats.api build: context: . dockerfile: ./deploy/cats/Dockerfile environment: <<: [*x-db-environment, *x-api-environment] POSTGRES_HOST: db command: just serve depends_on: db: condition: service_healthy healthcheck: test: [ "CMD-SHELL", "curl -fsSL http://localhost:${UVICORN_PORT}/v1/healthcheck/", ] <<: *hc-interval grafana: <<: *default profiles: ["grafana"] image: grafana/grafana:latest container_name: cats.grafana hostname: cats.grafana volumes: - cats.grafana.data:/var/lib/grafana:rw - ./deploy/grafana/provisioning:/etc/grafana/provisioning:rw - ./deploy/grafana/dashboards:/etc/grafana/dashboards environment: - GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin} - GF_USERS_ALLOW_SIGN_UP=false - GF_DATABASE_WAL=true - GF_SERVER_ROOT_URL=http://localhost/grafana/ - VIRTUAL_HOST=cats.grafana - NETWORK_ACCESS=internal - VIRTUAL_PORT=3000 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"] <<: *hc-interval loki: <<: *default profiles: ["grafana"] image: grafana/loki:3.5.3 container_name: cats.loki hostname: cats.loki expose: - 3100 volumes: - ./deploy/loki/config.yaml:/etc/loki/config.yaml:ro - cats.loki.data:/tmp/:rw command: -config.file=/etc/loki/config.yaml vector: <<: *default profiles: ["grafana"] image: timberio/vector:0.49.0-alpine container_name: cats.vector hostname: cats.vector expose: - 8383 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./deploy/vector/vector.toml:/etc/vector/vector.toml:ro logging: driver: "json-file" options: max-size: "10m" tempo: <<: *default profiles: ["grafana"] image: grafana/tempo:2.8.2 container_name: cats.tempo hostname: cats.tempo command: [ "--target=all", "--storage.trace.backend=local", "--storage.trace.local.path=/var/tempo", "--auth.enabled=false", ] expose: - 14250 depends_on: - loki prometheus: <<: *default profiles: ["grafana"] image: prom/prometheus:latest container_name: cats.prometheus hostname: cats.prometheus volumes: - ./deploy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro - cats.prometheus.data:/prometheus command: - --config.file=/etc/prometheus/prometheus.yml - --enable-feature=exemplar-storage expose: - 9090 volumes: cats.postgres.data: {} cats.grafana.data: {} cats.loki.data: {} cats.prometheus.data: {} networks: overlay: driver: bridge