From 56865ec2f94e57279722f5d98e81faef90d2d301 Mon Sep 17 00:00:00 2001 From: Rajkumar Date: Sun, 13 Sep 2026 13:08:05 +0530 Subject: [PATCH] (fixed) host pg and redis setup done w/o docker --- .github/workflows/cd.yml | 2 +- docker-compose.prod.yml | 63 ++++++++-------------------------------- 2 files changed, 13 insertions(+), 52 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 386e413..8f55f51 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -129,7 +129,7 @@ jobs: docker compose -f docker-compose.prod.yml ps # Fail the deploy if any expected service is not running. - for svc in frontend backend ws-server genai db redis; do + for svc in frontend backend ws-server genai; do state=$(docker compose -f docker-compose.prod.yml ps \ --format '{{.State}}' "$svc" || true) echo " $svc: ${state:-missing}" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e1f80af..7654aa9 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -50,9 +50,11 @@ services: networks: - rexial-network - depends_on: - db: - condition: service_healthy + # PostgreSQL and Redis run on the host, not in Docker. This maps + # host.docker.internal to the docker bridge gateway so .env.prod can + # address them; there is no db service to depend_on. + extra_hosts: + - "host.docker.internal:host-gateway" # now run the migrations command: > @@ -73,9 +75,8 @@ services: - .env.prod networks: - rexial-network - depends_on: - db: - condition: service_healthy + extra_hosts: + - "host.docker.internal:host-gateway" command: > sh -c "pnpm --filter @repo/db run db:generate:prod && pnpm run start" @@ -95,6 +96,8 @@ services: - genai_uploads:/data/uploads networks: - rexial-network + extra_hosts: + - "host.docker.internal:host-gateway" healthcheck: test: [ "CMD", "curl", "-f", "http://localhost:8000/health" ] interval: 15s @@ -102,57 +105,15 @@ services: retries: 5 start_period: 60s - db: - image: postgres:15-alpine - container_name: rexial_db_prod - restart: always - env_file: - - .env.prod - volumes: - - Rexial_data:/var/lib/postgresql/data - networks: - - rexial-network - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres -d Rexial" ] - interval: 10s - timeout: 5s - retries: 10 - start_period: 30s - - redis: - image: redis:7-alpine - container_name: rexial_redis_prod - restart: always - env_file: - - .env.prod - command: - - redis-server - - --requirepass - - ${REDIS_PASSWORD} - - --maxmemory - - 256mb - - --maxmemory-policy - - allkeys-lru - - --appendonly - - yes - volumes: - - redis_data:/data - networks: - - rexial-network - healthcheck: - test: [ "CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping" ] - interval: 10s - timeout: 5s - retries: 5 - start_period: 10s + # No db or redis services: PostgreSQL and Redis are installed on the host + # via apt and reached through host.docker.internal. See VPS-DEPLOYMENT.md + # steps 3-5 for the host config (bind the docker bridge, firewall rules). networks: rexial-network: driver: bridge volumes: - Rexial_data: genai_uploads: nginx_data: letsencrypt: - redis_data: