Add healthchecks for Gramps celery and valkey services

This commit is contained in:
beatz174-bit
2026-04-14 14:34:31 +10:00
parent 624d7be17c
commit d69c74e537
5 changed files with 106 additions and 61 deletions
+92 -45
View File
@@ -1,58 +1,47 @@
services:
gramps-db:
profiles: ["apps","all","gramps"]
image: postgres:13
container_name: gramps-db
restart: always
env_file:
- ${SECRETS_ENV_FILE}
environment:
POSTGRES_USER: ${GRAMPS_DB_USER}
POSTGRES_PASSWORD_FILE: /run/secrets/gramps_db_password
POSTGRES_DB: ${GRAMPS_DB_NAME}
secrets:
- gramps_db_password
volumes:
- ${PROJECT_ROOT}/apps/gramps/db:/var/lib/postgresql
networks:
- gramps
healthcheck:
test: ["CMD-SHELL", "pg_isready -h gramps-db -p 5432 -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
grampsweb:
profiles: ["apps","all","gramps"]
image: ghcr.io/gramps-project/grampsweb:latest
container_name: gramps-web
depends_on:
- gramps-db
- gramps-redis
- grampsweb_celery
restart: always
env_file:
- ${SECRETS_ENV_FILE}
environment:
DB_URI: ${GRAMPS_DB_URI}
GRAMPSWEB_LOGLEVEL: ${GRAMPSWEB_LOGLEVEL}
# default admin user created on first run:
INITIAL_ADMIN: ${GRAMPS_INITIAL_ADMIN}
INITIAL_ADMIN_PASSWORD: ${GRAMPS_INITIAL_ADMIN_PASSWORD}
# optional: storage paths inside container
GRAMPSWEB_MEDIAPATH: ${GRAMPSWEB_MEDIAPATH}
GRAMPSWEB_TREE: "${GRAMPSWEB_TREE}"
TZ: ${TZ}
GRAMPSWEB_TREE: ${GRAMPSWEB_TREE}
GRAMPSWEB_BASE_URL: ${GRAMPSWEB_BASE_URL}
GRAMPSWEB_SECRET_KEY: ${GRAMPSWEB_SECRET_KEY}
GRAMPSWEB_REGISTRATION_DISABLED: ${GRAMPSWEB_REGISTRATION_DISABLED}
GRAMPSWEB_EMAIL_HOST: ${GRAMPSWEB_EMAIL_HOST}
GRAMPSWEB_EMAIL_PORT: ${GRAMPSWEB_EMAIL_PORT}
GRAMPSWEB_EMAIL_HOST_USER: ${GRAMPSWEB_EMAIL_HOST_USER}
GRAMPSWEB_EMAIL_HOST_PASSWORD: ${GRAMPSWEB_EMAIL_HOST_PASSWORD}
GRAMPSWEB_EMAIL_USE_SSL: ${GRAMPSWEB_EMAIL_USE_SSL}
GRAMPSWEB_EMAIL_USE_STARTTLS: ${GRAMPSWEB_EMAIL_USE_STARTTLS}
GRAMPSWEB_DEFAULT_FROM_EMAIL: ${GRAMPSWEB_DEFAULT_FROM_EMAIL}
GRAMPSWEB_CELERY_CONFIG__broker_url: redis://gramps-redis:6379/0
GRAMPSWEB_CELERY_CONFIG__result_backend: redis://gramps-redis:6379/0
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://gramps-redis:6379/1
volumes:
- ${PROJECT_ROOT}/apps/gramps/data/users:/app/users
- ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
- ${PROJECT_ROOT}/apps/gramps/data/index:/app/indexdir
- ${PROJECT_ROOT}/apps/gramps/data/thumbnail_cache:/app/thumbnail_cache
- ${PROJECT_ROOT}/apps/gramps/data/cache:/app/cache
- ${PROJECT_ROOT}/apps/gramps/data/secret:/app/secret
- ${PROJECT_ROOT}/apps/gramps/data/db:/root/.gramps/grampsdb
- ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
- ${PROJECT_ROOT}/apps/gramps/data/tmp:/tmp
labels:
- "traefik.http.routers.gramps.rule=Host(`familytree.lan.ddnsgeek.com`)"
- "traefik.enable=true"
- "traefik.http.routers.gramps.entrypoints=websecure"
- "traefik.http.routers.gramps.tls.certresolver=myresolver"
- "io.portainer.accesscontrol.public"
- "traefik.http.services.gramps.loadbalancer.server.port=5000"
- "traefik.docker.network=core_traefik"
- "traefik.http.routers.gramps.rule=Host(`familytree.lan.ddnsgeek.com`)"
- "traefik.enable=true"
- "traefik.http.routers.gramps.entrypoints=websecure"
- "traefik.http.routers.gramps.tls.certresolver=myresolver"
- "io.portainer.accesscontrol.public"
- "traefik.http.services.gramps.loadbalancer.server.port=5000"
- "traefik.docker.network=core_traefik"
networks:
- traefik
- gramps
@@ -65,9 +54,67 @@ services:
retries: 6
start_period: 60s
grampsweb_celery:
profiles: ["apps","all","gramps"]
image: ghcr.io/gramps-project/grampsweb:latest
container_name: gramps-web-celery
command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2
depends_on:
- gramps-redis
restart: always
env_file:
- ${SECRETS_ENV_FILE}
environment:
TZ: ${TZ}
GRAMPSWEB_TREE: ${GRAMPSWEB_TREE}
GRAMPSWEB_BASE_URL: ${GRAMPSWEB_BASE_URL}
GRAMPSWEB_SECRET_KEY: ${GRAMPSWEB_SECRET_KEY}
GRAMPSWEB_REGISTRATION_DISABLED: ${GRAMPSWEB_REGISTRATION_DISABLED}
GRAMPSWEB_EMAIL_HOST: ${GRAMPSWEB_EMAIL_HOST}
GRAMPSWEB_EMAIL_PORT: ${GRAMPSWEB_EMAIL_PORT}
GRAMPSWEB_EMAIL_HOST_USER: ${GRAMPSWEB_EMAIL_HOST_USER}
GRAMPSWEB_EMAIL_HOST_PASSWORD: ${GRAMPSWEB_EMAIL_HOST_PASSWORD}
GRAMPSWEB_EMAIL_USE_SSL: ${GRAMPSWEB_EMAIL_USE_SSL}
GRAMPSWEB_EMAIL_USE_STARTTLS: ${GRAMPSWEB_EMAIL_USE_STARTTLS}
GRAMPSWEB_DEFAULT_FROM_EMAIL: ${GRAMPSWEB_DEFAULT_FROM_EMAIL}
GRAMPSWEB_CELERY_CONFIG__broker_url: redis://gramps-redis:6379/0
GRAMPSWEB_CELERY_CONFIG__result_backend: redis://gramps-redis:6379/0
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://gramps-redis:6379/1
volumes:
- ${PROJECT_ROOT}/apps/gramps/data/users:/app/users
- ${PROJECT_ROOT}/apps/gramps/data/index:/app/indexdir
- ${PROJECT_ROOT}/apps/gramps/data/thumbnail_cache:/app/thumbnail_cache
- ${PROJECT_ROOT}/apps/gramps/data/cache:/app/cache
- ${PROJECT_ROOT}/apps/gramps/data/secret:/app/secret
- ${PROJECT_ROOT}/apps/gramps/data/db:/root/.gramps/grampsdb
- ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
- ${PROJECT_ROOT}/apps/gramps/data/tmp:/tmp
networks:
- gramps
healthcheck:
test:
- CMD-SHELL
- pgrep -f "celery.*gramps_webapi.celery.*worker" >/dev/null
interval: 30s
timeout: 5s
retries: 6
start_period: 60s
gramps-redis:
profiles: ["apps","all","gramps"]
image: valkey/valkey:8-alpine
container_name: gramps-redis
restart: always
networks:
- gramps
healthcheck:
test:
- CMD-SHELL
- valkey-cli -h 127.0.0.1 -p 6379 ping | grep -q PONG
interval: 10s
timeout: 5s
retries: 6
start_period: 10s
networks:
gramps:
secrets:
gramps_db_password:
file: ${PROJECT_ROOT}/secrets/gramps_db_password.txt