Reintroduce healthcheck for database
While the new image (ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0) includes a healthcheck now, it only considers POSTGRES_DB and POSTGRES_USER, not POSTGRES_DB_FILE and POSTGRES_USER_FILE used with docker secrets
This commit is contained in:
@ -62,6 +62,16 @@ services:
|
||||
image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
|
||||
container_name: immich_db_pg14
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ CMD-SHELL,
|
||||
"pg_isready -d `cat $$POSTGRES_DB_FILE` -U `cat $$POSTGRES_USER_FILE` || exit 1;",
|
||||
"Chksum=$$(psql -d `cat $$POSTGRES_DB_FILE` -U `cat $$POSTGRES_USER_FILE` --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database');",
|
||||
"echo 'checksum failure count is $$Chksum';",
|
||||
"[[ $$Chksum = '0' ]] || exit 1"
|
||||
]
|
||||
interval: 5m
|
||||
start_interval: 30s
|
||||
start_period: 5m
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
networks:
|
||||
|
Reference in New Issue
Block a user