From 0b5ca0e32db54105726ab28f6f7d0e66d0b0b3e7 Mon Sep 17 00:00:00 2001 From: Enno Gelhaus Date: Wed, 3 Jun 2026 18:04:46 +0200 Subject: [PATCH] feat: update docker compose for prod --- .gitignore | 1 + docker-compose.yaml | 75 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 2e6e3c4..51fb8f6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -117,11 +117,19 @@ services: networks: - postiz-network - temporal-network + healthcheck: + test: ["CMD", "node", "-e", "const r=require('http').get('http://localhost:5000/',res=>process.exit(res.statusCode<500?0:1));r.on('error',()=>process.exit(1));r.setTimeout(4000,()=>{r.destroy();process.exit(1)})"] + interval: 30s + timeout: 10s + retries: 5 + start_period: 120s depends_on: postiz-postgres: condition: service_healthy postiz-redis: condition: service_healthy + temporal: + condition: service_healthy postiz-postgres: image: postgres:17-alpine @@ -136,19 +144,21 @@ services: networks: - postiz-network healthcheck: - test: pg_isready -U postiz-user -d postiz-db-local + test: ["CMD-SHELL", "pg_isready -U postiz-user -d postiz-db-local"] interval: 10s - timeout: 3s - retries: 3 + timeout: 5s + retries: 5 + start_period: 10s postiz-redis: image: redis:7.2 container_name: postiz-redis restart: always healthcheck: - test: redis-cli ping + test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"] interval: 10s - timeout: 3s - retries: 3 + timeout: 5s + retries: 5 + start_period: 5s volumes: - postiz-redis-data:/data networks: @@ -156,8 +166,10 @@ services: # For Application Monitoring / Debugging spotlight: + profiles: [debug] pull_policy: always container_name: spotlight + restart: unless-stopped ports: - 8969:8969/tcp image: ghcr.io/getsentry/spotlight:latest @@ -170,6 +182,7 @@ services: temporal-elasticsearch: container_name: temporal-elasticsearch image: elasticsearch:7.17.27 + restart: always environment: - cluster.routing.allocation.disk.threshold_enabled=true - cluster.routing.allocation.disk.watermark.low=512mb @@ -182,12 +195,19 @@ services: - temporal-network expose: - 9200 + healthcheck: + test: ["CMD-SHELL", "curl -fsS \"http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s\" || exit 1"] + interval: 10s + timeout: 10s + retries: 10 + start_period: 60s volumes: - - /var/lib/elasticsearch/data + - temporal-elasticsearch-data:/usr/share/elasticsearch/data temporal-postgresql: container_name: temporal-postgresql image: postgres:16 + restart: always environment: POSTGRES_PASSWORD: temporal POSTGRES_USER: temporal @@ -195,17 +215,26 @@ services: - temporal-network expose: - 5432 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U temporal"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s volumes: - - /var/lib/postgresql/data + - temporal-postgres-data:/var/lib/postgresql/data temporal: container_name: temporal + restart: always ports: - '7233:7233' image: temporalio/auto-setup:1.28.1 depends_on: - - temporal-postgresql - - temporal-elasticsearch + temporal-postgresql: + condition: service_healthy + temporal-elasticsearch: + condition: service_healthy environment: - DB=postgres12 - DB_PORT=5432 @@ -219,6 +248,12 @@ services: - TEMPORAL_NAMESPACE=default networks: - temporal-network + healthcheck: + test: ["CMD", "temporal", "operator", "cluster", "health", "--address", "temporal:7233"] + interval: 10s + timeout: 5s + retries: 10 + start_period: 30s volumes: - ./dynamicconfig:/etc/temporal/config/dynamicconfig labels: @@ -227,6 +262,7 @@ services: temporal-admin-tools: container_name: temporal-admin-tools image: temporalio/admin-tools:1.28.1-tctl-1.18.4-cli-1.4.1 + restart: on-failure environment: - TEMPORAL_ADDRESS=temporal:7233 - TEMPORAL_CLI_ADDRESS=temporal:7233 @@ -234,12 +270,14 @@ services: - temporal-network stdin_open: true depends_on: - - temporal + temporal: + condition: service_healthy tty: true temporal-ui: container_name: temporal-ui image: temporalio/ui:2.34.0 + restart: always environment: - TEMPORAL_ADDRESS=temporal:7233 - TEMPORAL_CORS_ORIGINS=http://127.0.0.1:3000 @@ -247,6 +285,15 @@ services: - temporal-network ports: - '8080:8080' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"] + interval: 30s + timeout: 5s + retries: 5 + start_period: 20s + depends_on: + temporal: + condition: service_healthy volumes: postgres-volume: @@ -261,6 +308,12 @@ volumes: postiz-uploads: external: false + temporal-postgres-data: + external: false + + temporal-elasticsearch-data: + external: false + networks: postiz-network: external: false