docker non-root and healthcheck fix

This commit is contained in:
qananasikq
2026-04-10 15:14:04 +03:00
parent 3870cf4d94
commit 18dab6d48d
3 changed files with 41 additions and 8 deletions

View File

@@ -121,6 +121,7 @@ services:
<<: *worker-service
container_name: iaai-worker
restart: unless-stopped
init: true
depends_on:
migrate:
condition: service_completed_successfully
@@ -130,13 +131,14 @@ services:
command: >
celery -A iaai_scraper.worker.celery_app worker
--loglevel=info --concurrency=1 --pool=prefork
--pidfile=/tmp/celery-worker.pid
-Q scraping --max-tasks-per-child=20
healthcheck:
test: ["CMD", "celery", "-A", "iaai_scraper.worker.celery_app", "inspect", "ping", "-d", "celery@$$HOSTNAME"]
test: ["CMD-SHELL", "test -f /tmp/celery-worker.pid && kill -0 $(cat /tmp/celery-worker.pid)"]
interval: 60s
timeout: 20s
timeout: 10s
retries: 3
start_period: 40s
start_period: 90s
logging:
driver: json-file
options:
@@ -148,6 +150,7 @@ services:
<<: *worker-service
container_name: iaai-beat
restart: unless-stopped
init: true
depends_on:
migrate:
condition: service_completed_successfully
@@ -156,12 +159,14 @@ services:
command: >
celery -A iaai_scraper.worker.celery_app beat
--loglevel=info
--pidfile=/tmp/celery-beat.pid
--schedule=/tmp/celerybeat-schedule
healthcheck:
test: ["CMD", "python", "-c", "import pathlib,sys; p=pathlib.Path('/tmp/celerybeat-schedule'); sys.exit(0 if p.exists() else 1)"]
test: ["CMD-SHELL", "test -f /tmp/celery-beat.pid && kill -0 $(cat /tmp/celery-beat.pid)"]
interval: 60s
timeout: 20s
timeout: 10s
retries: 3
start_period: 60s
start_period: 90s
logging:
driver: json-file
options: