chore: improve healthcheck configuration for AIO container (#4595)

Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
This commit is contained in:
progprnv 2025-05-14 17:15:41 +05:30 committed by GitHub
parent 9b0e1af92d
commit 3bf44638e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 9 deletions

View file

@ -13,7 +13,7 @@ services:
test: test:
[ [
"CMD-SHELL", "CMD-SHELL",
"sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'" "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'",
] ]
interval: 5s interval: 5s
timeout: 5s timeout: 5s
@ -28,21 +28,32 @@ services:
environment: environment:
# DATABASE_URL is read from the .env file to allow the backend to connect with an external database. # 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. # 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 - ENABLE_SUBPATH_BASED_ACCESS=true
env_file: env_file:
- ./.env - ./.env
depends_on: depends_on:
hoppscotch-db: hoppscotch-db:
condition: service_healthy 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: healthcheck:
test: test:
- CMD [
- curl "CMD",
- '-f' "curl",
- 'http://localhost:80' "-f",
"-s",
"-o",
"/dev/null",
"-w",
"%{http_code}",
"http://localhost:80",
]
interval: 2s interval: 2s
timeout: 10s timeout: 10s
retries: 30 retries: 30

View file

@ -135,7 +135,16 @@ services:
# you are using an external postgres instance # you are using an external postgres instance
# This will be exposed at port 5432 # This will be exposed at port 5432
hoppscotch-db: hoppscotch-db:
profiles: ["default", "database", "just-backend", "backend", "app", "admin", "deprecated"] profiles:
[
"default",
"database",
"just-backend",
"backend",
"app",
"admin",
"deprecated",
]
image: postgres:15 image: postgres:15
ports: ports:
- "5432:5432" - "5432:5432"