From 4494dcafab60465056bd082cea8bd23a68867df8 Mon Sep 17 00:00:00 2001 From: Harshith Mullapudi Date: Wed, 6 Aug 2025 11:00:49 +0530 Subject: [PATCH] Fix: docker deployment --- hosting/docker/core/.env | 4 ++-- hosting/docker/core/docker-compose.yaml | 8 ++++---- hosting/docker/trigger/.env | 2 +- hosting/docker/trigger/docker-compose.yaml | 5 +++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hosting/docker/core/.env b/hosting/docker/core/.env index 54bf003..909eb6d 100644 --- a/hosting/docker/core/.env +++ b/hosting/docker/core/.env @@ -1,7 +1,7 @@ VERSION=0.1.14 # Nest run in docker, change host to database container name -DB_HOST=localhost +DB_HOST=postgres DB_PORT=5432 # POSTGRES @@ -10,7 +10,7 @@ POSTGRES_PASSWORD=docker POSTGRES_DB=core LOGIN_ORIGIN=http://localhost:3033 -DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=core +DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=core # This sets the URL used for direct connections to the database and should only be needed in limited circumstances # See: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#fields:~:text=the%20shadow%20database.-,directUrl,-No diff --git a/hosting/docker/core/docker-compose.yaml b/hosting/docker/core/docker-compose.yaml index f4db74d..f9ee4b1 100644 --- a/hosting/docker/core/docker-compose.yaml +++ b/hosting/docker/core/docker-compose.yaml @@ -29,11 +29,10 @@ services: - TRIGGER_PROJECT_ID=${TRIGGER_PROJECT_ID} - TRIGGER_SECRET_KEY=${TRIGGER_SECRET_KEY} - TRIGGER_API_URL=${TRIGGER_API_URL} + - POSTGRES_DB=${POSTGRES_DB} ports: - "3033:3000" depends_on: - init: - condition: service_started postgres: condition: service_healthy redis: @@ -45,7 +44,7 @@ services: postgres: container_name: core-postgres - image: redplanethq/postgres:0.1.0 + image: tegonhq/tegon-postgres:0.1.0-alpha environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} @@ -57,7 +56,7 @@ services: networks: - core healthcheck: - test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"] + test: ["CMD-SHELL", "pg_isready"] interval: 10s timeout: 5s retries: 5 @@ -99,6 +98,7 @@ services: networks: core: + name: core-network driver: bridge volumes: diff --git a/hosting/docker/trigger/.env b/hosting/docker/trigger/.env index 9829e15..ec3dcb2 100644 --- a/hosting/docker/trigger/.env +++ b/hosting/docker/trigger/.env @@ -32,7 +32,7 @@ POSTGRES_USER=docker POSTGRES_PASSWORD=docker TRIGGER_DB=trigger -DB_HOST=host.docker.internal +DB_HOST=postgres DB_PORT=5432 DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${TRIGGER_DB}?schema=public&sslmode=disable diff --git a/hosting/docker/trigger/docker-compose.yaml b/hosting/docker/trigger/docker-compose.yaml index af3bb58..ce6dfc9 100644 --- a/hosting/docker/trigger/docker-compose.yaml +++ b/hosting/docker/trigger/docker-compose.yaml @@ -21,6 +21,7 @@ services: - NODE_ENV=production networks: - webapp + - core-network webapp: container_name: trigger-webapp @@ -107,6 +108,7 @@ services: logging: *logging-config networks: - webapp + - core-network environment: DATABASE_URL: ${ELECTRIC_DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable} ELECTRIC_INSECURE: true @@ -167,6 +169,7 @@ services: - supervisor - docker-proxy - webapp + - core-network volumes: - shared:/home/node/shared # Only needed for bootstrap @@ -241,3 +244,5 @@ networks: name: supervisor webapp: name: webapp + core-network: + external: true