name: {{project_name}} services: # postgres database database-init: image: postgres:17 # or postgis/postgis:17-3.5 container_name: {{project_slug}}_db-init volumes: &postgres-volumes - ./data/postgres:/var/lib/postgresql/data entrypoint: ["chown", "-R", "postgres:postgres", "/var/lib/postgresql/data"] database: container_name: {{project_slug}}_db image: postgres:17 # or postgis/postgis:17-3.5 restart: unless-stopped depends_on: database-init: condition: service_completed_successfully environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} POSTGRES_DB: ${POSTGRES_DB:-{{project_slug}}_db} # ports: # - 5432:5432 volumes: *postgres-volumes healthcheck: test: pg_isready -d postgres interval: 15s timeout: 5s retries: 3 start_period: 5s user: "postgres" logging: &json-logging driver: "json-file" options: max-size: "50m" max-file: "4" # api schema migrator running before the app launch migrator: container_name: {{project_name}}-migrator build: &api-build-section context: .. dockerfile: deploy/Dockerfile environment: &api-environment-section CONFIG_PATH: /app/config.yaml DB_PASSWORD: postgres volumes: &api-volumes-section - ./configs/api.yaml:/app/config.yaml depends_on: database: condition: service_healthy entrypoint: ["/bin/sh", "-c"] command: ["cd /app/{{project_slug}}/db && alembic upgrade head; if [ $? = 0 ]; then echo \"Database schema synchronized\"; else echo \"alembic upgrade has failed, database state is undetermined\"; exit 1; fi"] logging: *json-logging # API server api: container_name: {{project_name}} build: *api-build-section restart: unless-stopped ports: - ${EXPORT_API_PORT:-8080}:${PORT:-8080} environment: *api-environment-section volumes: *api-volumes-section depends_on: migrator: condition: service_completed_successfully prometheus: # optional condition: service_started otel: # optional condition: service_started healthcheck: test: ["CMD-SHELL", "curl -f http://localhost:${PORT:-8080}/health_check/ping"] interval: 10s timeout: 5s start_period: 5s logging: *json-logging # prometheus + grafana monitoring prometheus-init: image: alpine:3.23 container_name: prometheus-init volumes: &prometheus-volumes-section - ./configs/prometheus.yml:/etc/prometheus/prometheus.yml - ./data/prometheus:/prometheus entrypoint: ["chown", "65534:65534", "-R", "/prometheus"] user: "root" prometheus-pushgateway: image: prom/pushgateway:latest container_name: prometheus-pushgateway restart: unless-stopped # ports: # - 9091:9091 logging: *json-logging prometheus: image: prom/prometheus:latest container_name: prometheus restart: unless-stopped ports: - 9090:9090 depends_on: prometheus-init: condition: service_completed_successfully volumes: *prometheus-volumes-section logging: *json-logging grafana-init: image: alpine:3.23 container_name: grafana-init volumes: &grafana-volumes-section - ./data/grafana:/var/lib/grafana user: "root" entrypoint: ["chown", "472:0", "-R", "/var/lib/grafana"] grafana: image: grafana/grafana-enterprise:latest container_name: grafana restart: unless-stopped ports: - 3000:3000 volumes: *grafana-volumes-section depends_on: grafana-init: condition: service_completed_successfully logging: *json-logging # jaeger tracing opensearch-init: image: alpine:3.23 volumes: &opensearch-volumes-section - ./data/opensearch:/usr/share/opensearch/data entrypoint: ["chown", "1000:1000", "-R", "/usr/share/opensearch/data"] user: "root" opensearch: image: opensearchproject/opensearch:3.3.0@sha256:d96afaf6cbd2a6a3695aeb2f1d48c9a16ad5c8918eb849e5cbf43475f0f8e146 container_name: opensearch environment: - discovery.type=single-node - plugins.security.disabled=true - http.host=0.0.0.0 - transport.host=127.0.0.1 - OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin-Password-1@-goes-here # ports: # - 9200:9200 # REST API # - 9600:9600 # Performance Analyzer volumes: *opensearch-volumes-section healthcheck: test: [ "CMD-SHELL", "curl -f http://localhost:9200 || exit 1" ] interval: 10s timeout: 10s retries: 30 logging: *json-logging # # Visualizer for opensearch data # opensearch-dashboards: # image: opensearchproject/opensearch-dashboards:latest # container_name: marketplace_os_dashboards # ports: # - 5601:5601 # # expose: # # - "5601" # environment: # OPENSEARCH_HOSTS: '["http://opensearch:9200"]' # DISABLE_SECURITY_DASHBOARDS_PLUGIN: "true" # depends_on: # opensearch: # condition: service_healthy jaeger: container_name: jaeger image: cr.jaegertracing.io/jaegertracing/jaeger:2.12.0 ports: - 16686:16686 # - 5778:5778 # - 9411:9411 volumes: - ./configs/jaeger-ui.json:/etc/jaeger/jaeger-ui.json - ./configs/jaeger-opensearch.yaml:/etc/jaeger/config.yml command: ["--config", "/etc/jaeger/config.yml"] depends_on: opensearch: condition: service_healthy restart: unless-stopped logging: *json-logging otel: container_name: otel image: otel/opentelemetry-collector-contrib # ports: # - 4317:4317 # - 4318:4318 restart: unless-stopped volumes: - ./configs/otel.yaml:/etc/otelcol-contrib/config.yaml depends_on: - jaeger logging: *json-logging