From 3bf44638e119d94a04c1812dfe84428fa0cec190 Mon Sep 17 00:00:00 2001 From: progprnv <145828371+progprnv@users.noreply.github.com> Date: Wed, 14 May 2025 17:15:41 +0530 Subject: [PATCH] chore: improve healthcheck configuration for AIO container (#4595) Co-authored-by: mirarifhasan --- docker-compose.deploy.yml | 27 +++++++++++++++++++-------- docker-compose.yml | 11 ++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml index ccf9f93e..91ae6bef 100644 --- a/docker-compose.deploy.yml +++ b/docker-compose.deploy.yml @@ -13,7 +13,7 @@ services: test: [ "CMD-SHELL", - "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'" + "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'", ] interval: 5s timeout: 5s @@ -28,21 +28,32 @@ services: environment: # DATABASE_URL is read from the .env file to allow the backend to connect with an external database. # This allows the backend to retain existing data and prevents database resets during deployments. - # DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch + - DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch - ENABLE_SUBPATH_BASED_ACCESS=true env_file: - ./.env depends_on: hoppscotch-db: condition: service_healthy - command: ["sh", "-c", "pnpm exec prisma migrate deploy && node /usr/src/app/aio_run.mjs"] + command: + [ + "sh", + "-c", + "pnpm exec prisma migrate deploy && node /usr/src/app/aio_run.mjs", + ] healthcheck: test: - - CMD - - curl - - '-f' - - 'http://localhost:80' + [ + "CMD", + "curl", + "-f", + "-s", + "-o", + "/dev/null", + "-w", + "%{http_code}", + "http://localhost:80", + ] interval: 2s timeout: 10s retries: 30 - diff --git a/docker-compose.yml b/docker-compose.yml index 2d708eb7..3d58f7c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -135,7 +135,16 @@ services: # you are using an external postgres instance # This will be exposed at port 5432 hoppscotch-db: - profiles: ["default", "database", "just-backend", "backend", "app", "admin", "deprecated"] + profiles: + [ + "default", + "database", + "just-backend", + "backend", + "app", + "admin", + "deprecated", + ] image: postgres:15 ports: - "5432:5432"