Skip to content

Commit

Permalink
API should wait until db is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
rien committed Apr 12, 2024
1 parent 07a8de7 commit 43cf6ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 11 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

name: dolos
version: "3.9"
services:
Expand All @@ -10,8 +11,8 @@ services:
networks:
- dolos
healthcheck:
start_period: 5s
interval: 10s
start_period: 2s
interval: 5s
test: healthcheck.sh --su-mysql --connect --innodb_initialized
web:
image: ghcr.io/dodona-edu/dolos-web
Expand All @@ -28,8 +29,8 @@ services:
networks:
- dolos
healthcheck:
start_period: 5s
interval: 10s
start_period: 2s
interval: 5s
test: curl --fail http://localhost:8080 || exit 1
api:
image: ghcr.io/dodona-edu/dolos-api
Expand All @@ -51,11 +52,12 @@ services:
RAILS_LOG_TO_STDOUT: true
SECRET_KEY_BASE_DUMMY: true
depends_on:
- worker
db:
condition: service_healthy
networks:
- dolos
healthcheck:
start_period: 5s
start_period: 2s
interval: 10s
test: curl --fail http://localhost:3000/up || exit 1
worker:
Expand All @@ -74,12 +76,12 @@ services:
SECRET_KEY_BASE_DUMMY: true
RAILS_LOG_TO_STDOUT: true
depends_on:
- db
- api
networks:
- dolos
healthcheck:
start_period: 5s
interval: 10s
start_period: 2s
interval: 5s
test: ruby -e true || exit 1
volumes:
dolos-db-data:
Expand Down
3 changes: 2 additions & 1 deletion test_compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
docker compose --progress quiet down
docker compose --progress quiet pull
docker pull ghcr.io/dodona-edu/dolos-cli:latest
docker compose up # --wait --detach
docker compose up --wait --detach

echo "Upload zipfile"

Expand All @@ -23,6 +23,7 @@ echo "Polling $report_url until finished or failed"

while sleep 1; do
report_json="$(curl -s --fail "$report_url")"
echo "$report_json"
report_status="$(echo "$report_json" | jq -r '.status')"
echo "Status is '$report_status'"
case "$report_status" in
Expand Down

0 comments on commit 43cf6ec

Please sign in to comment.