Skip to content

Commit

Permalink
Implement docker-compose.yml health checks
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremiah Boby <[email protected]>
  • Loading branch information
jchristgit and Jeremiah Boby committed Aug 1, 2024
1 parent a434606 commit 524c326
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.8"

x-gunicorn-master: &x-gunicorn-master
build: .
Expand All @@ -21,6 +21,11 @@ x-gunicorn-master: &x-gunicorn-master
- SQL_USER=postgres
- SQL_DATABASE=postgres
- EMAIL_PROVIDER=CONSOLE
depends_on:
database:
condition: service_healthy
redis:
condition: service_started

services:
redis:
Expand All @@ -33,6 +38,11 @@ services:
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- 'postgres:/var/lib/postgresql/data/'
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 1s
timeout: 30s
retries: 30

shell:
image: ghcr.io/ractf/shell:latest
Expand All @@ -56,13 +66,19 @@ services:
command: gunicorn backend.wsgi:application -b 0.0.0.0:8000
depends_on:
- database
healthcheck:
test: ["CMD", "curl", "--silent", "http://localhost:8000/admin/"]
interval: 10s
timeout: 50s
retries: 5

sockets:
<<: *x-gunicorn-master
entrypoint: /app/entrypoints/sockets.sh
command: gunicorn backend.asgi:application -b 0.0.0.0:8000
depends_on:
- backend
backend:
condition: service_healthy

volumes:
postgres: null

0 comments on commit 524c326

Please sign in to comment.