Skip to content

Commit

Permalink
build: use minio healthcheck via compose instead of wait-for-it
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Dec 6, 2024
1 parent 5452870 commit 7df0a58
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker-compose.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:
central-ui:
condition: service_completed_successfully
s3:
condition: service_started
condition: service_healthy
certbot:
condition: service_completed_successfully
ui:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
certbot:
condition: service_completed_successfully
s3:
condition: service_started
condition: service_healthy
ui:
condition: service_completed_successfully
electric:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
condition: service_completed_successfully
required: false
s3:
condition: service_started
condition: service_healthy
electric:
condition: service_started
volumes:
Expand Down
18 changes: 0 additions & 18 deletions src/backend/app-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,13 @@ wait_for_db() {
exit 1 # Exit with an error code
}

wait_for_s3() {
max_retries=30
retry_interval=5

for ((i = 0; i < max_retries; i++)); do
if curl --silent -I "${S3_ENDPOINT:-http://s3:9000}" >/dev/null; then
echo "S3 is available."
return 0 # S3 is available, exit successfully
fi
echo "S3 is not yet available. Retrying in ${retry_interval} seconds..."
sleep ${retry_interval}
done

echo "Timed out waiting for S3 to become available."
exit 1 # Exit with an error code
}

create_s3_buckets() {
echo "Running init_s3_buckets.py script main function"
python /opt/app/s3.py
}

# Start wait in background with tmp log files
wait_for_db &
wait_for_s3 &
# Wait until checks complete
wait

Expand Down

0 comments on commit 7df0a58

Please sign in to comment.