From 4fa768cc2916a2cc34f7b373824c466ed021dced Mon Sep 17 00:00:00 2001 From: github-ops Date: Tue, 16 Jun 2026 22:32:40 +0000 Subject: [PATCH] deploy: use external postgres --- .gitea/workflows/deploy.yml | 6 +++++- deploy/community/.env.example | 2 +- deploy/community/docker-compose.yml | 28 ++-------------------------- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4633db2..814f16b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -103,7 +103,11 @@ jobs: append_if_set POSTGRES_USER "$POSTGRES_USER" append_if_set POSTGRES_PASSWORD "$POSTGRES_PASSWORD" append_if_set POSTGRES_HOST "$POSTGRES_HOST" - append_if_set POSTGRES_PORT "$POSTGRES_PORT" + if [ -n "${POSTGRES_PORT:-}" ]; then + append_if_set POSTGRES_PORT "$POSTGRES_PORT" + elif [ -n "${PGBOUNCER_PORT:-}" ]; then + append_if_set POSTGRES_PORT "$PGBOUNCER_PORT" + fi append_if_set CRANK_STORAGE_ROOT "$CRANK_STORAGE_ROOT" append_if_set CRANK_PUBLISH_BIND "$CRANK_PUBLISH_BIND" append_if_set CRANK_ADMIN_BIND "$CRANK_ADMIN_BIND" diff --git a/deploy/community/.env.example b/deploy/community/.env.example index bbb7d95..351b034 100644 --- a/deploy/community/.env.example +++ b/deploy/community/.env.example @@ -1,7 +1,7 @@ POSTGRES_DB=crank POSTGRES_USER=crank POSTGRES_PASSWORD=change-me -POSTGRES_HOST=postgres +POSTGRES_HOST=postgres.example.internal POSTGRES_PORT=5432 POSTGRES_MAX_CONNECTIONS=20 POSTGRES_MIN_CONNECTIONS=2 diff --git a/deploy/community/docker-compose.yml b/deploy/community/docker-compose.yml index 7ace112..4bff0a6 100644 --- a/deploy/community/docker-compose.yml +++ b/deploy/community/docker-compose.yml @@ -1,21 +1,4 @@ services: - postgres: - image: postgres:16-alpine - restart: unless-stopped - environment: - POSTGRES_DB: ${POSTGRES_DB:-crank} - POSTGRES_USER: ${POSTGRES_USER:-crank} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-crank} - volumes: - - postgres_data:/var/lib/postgresql/data - ports: - - "127.0.0.1:5432:5432" - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-crank} -d ${POSTGRES_DB:-crank}"] - interval: 10s - timeout: 5s - retries: 5 - valkey: image: valkey/valkey:8-alpine restart: unless-stopped @@ -39,7 +22,7 @@ services: dockerfile: apps/admin-api/Dockerfile restart: unless-stopped environment: - POSTGRES_HOST: ${POSTGRES_HOST:-postgres} + POSTGRES_HOST: ${POSTGRES_HOST} POSTGRES_PORT: ${POSTGRES_PORT:-5432} POSTGRES_DB: ${POSTGRES_DB:-crank} POSTGRES_USER: ${POSTGRES_USER:-crank} @@ -59,9 +42,6 @@ services: CRANK_BOOTSTRAP_ADMIN_PASSWORD: ${CRANK_BOOTSTRAP_ADMIN_PASSWORD} CRANK_BOOTSTRAP_ADMIN_DISPLAY_NAME: ${CRANK_BOOTSTRAP_ADMIN_DISPLAY_NAME:-Crank Owner} CRANK_DEMO_SEED: ${CRANK_DEMO_SEED:-false} - depends_on: - postgres: - condition: service_healthy volumes: - artifact_storage:${CRANK_STORAGE_ROOT:-/var/lib/crank/storage} ports: @@ -79,7 +59,7 @@ services: dockerfile: apps/mcp-server/Dockerfile restart: unless-stopped environment: - POSTGRES_HOST: ${POSTGRES_HOST:-postgres} + POSTGRES_HOST: ${POSTGRES_HOST} POSTGRES_PORT: ${POSTGRES_PORT:-5432} POSTGRES_DB: ${POSTGRES_DB:-crank} POSTGRES_USER: ${POSTGRES_USER:-crank} @@ -93,9 +73,6 @@ services: CRANK_LOG_LEVEL: ${CRANK_LOG_LEVEL:-info} CRANK_MASTER_KEY: ${CRANK_MASTER_KEY} CRANK_BASE_URL: ${CRANK_BASE_URL:-http://localhost:3000} - depends_on: - postgres: - condition: service_healthy volumes: - artifact_storage:${CRANK_STORAGE_ROOT:-/var/lib/crank/storage} ports: @@ -121,6 +98,5 @@ services: retries: 5 volumes: - postgres_data: artifact_storage: valkey_data: