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:
[
"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

View file

@ -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"