Skip to content

Commit

Permalink
Merge pull request #325 from DigitalSlideArchive/docker-healthcheck
Browse files Browse the repository at this point in the history
Add docker healthchecks
  • Loading branch information
manthey committed Mar 12, 2024
2 parents 77e9cfe + c813bea commit 1358717
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
29 changes: 29 additions & 0 deletions devops/dsa/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ services:
- memcached
- rabbitmq
command: /opt/digital_slide_archive/devops/dsa/start_girder.sh
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/system/version"]
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
mongodb:
image: "mongo:latest"
# Set DSA_USER to your user id (e.g., `DSA_USER=$(id -u):$(id -g)`)
Expand All @@ -112,6 +118,12 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
memcached:
image: memcached
command: -m 4096 --max-item-size 8M
Expand All @@ -123,6 +135,12 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: ["CMD", "bash", "-c", 'exec 3<>/dev/tcp/localhost/11211; printf "stats\nquit\n" >&3; cat <&3']
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
rabbitmq:
image: "rabbitmq:latest"
restart: unless-stopped
Expand All @@ -138,6 +156,11 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3
worker:
image: dsarchive/dsa_common
build: ../..
Expand Down Expand Up @@ -167,6 +190,12 @@ services:
depends_on:
- rabbitmq
command: /opt/digital_slide_archive/devops/dsa/start_worker.sh
healthcheck:
test: ["CMD", "celery", "-b", "amqp://rabbitmq:5672", "inspect", "ping"]
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
logging:
options:
max-size: "10M"
Expand Down
29 changes: 29 additions & 0 deletions devops/external-worker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ services:
- memcached
- rabbitmq
command: /opt/digital_slide_archive/devops/dsa/start_girder.sh
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/system/version"]
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
mongodb:
profiles:
- server
Expand All @@ -73,6 +79,12 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
memcached:
profiles:
- server
Expand All @@ -86,6 +98,12 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: ["CMD", "bash", "-c", 'exec 3<>/dev/tcp/localhost/11211; printf "stats\nquit\n" >&3; cat <&3']
interval: 5m
timeout: 10s
retries: 3
start_period: 30s
rabbitmq:
profiles:
- server
Expand All @@ -104,6 +122,11 @@ services:
max-size: "10M"
max-file: "5"
command: "bash -c '(until rabbitmqctl await_startup; do sleep 1; done; rabbitmqctl add_user \"${RABBITMQ_USER:-girder}\" \"${RABBITMQ_PASS:-girder1234}\" 2>/dev/null ; rabbitmqctl set_permissions -p / \"${RABBITMQ_USER:-girder}\" \".*\" \".*\" \".*\") & rabbitmq-server'"
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3

worker:
profiles:
Expand Down Expand Up @@ -142,3 +165,9 @@ services:
options:
max-size: "10M"
max-file: "5"
healthcheck:
test: ["CMD", "celery", "-b", "amqp://${DSA_RABBITMQ_HOST:-rabbitmq}:5672", "inspect", "ping"]
interval: 5m
timeout: 10s
retries: 3
start_period: 30s

0 comments on commit 1358717

Please sign in to comment.