chore: speeds up startup healthchecks

This commit is contained in:
2025-05-23 15:40:56 -05:00
parent 81eb2d1f62
commit 168bf04550
4 changed files with 4 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ USER nobody
COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/ COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf
HEALTHCHECK --interval=5s --timeout=5s --retries=5 CMD [ "php", "/var/www/bin/console", "startup:status" ] HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/var/www/bin/console", "startup:status" ]
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]

View File

@@ -1,9 +1,8 @@
#!/bin/sh #!/bin/sh
# Sleep for a second to ensure DB is awake and ready # Sleep for a second to ensure DB is awake and ready
SLEEP_TIME=$(shuf -i 2-5 -n 1) SLEEP_TIME=$(shuf -i 2-4 -n 1)
echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database" echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database"
echo "> If there are errors after the migration runs, it's possible another container (scheduler, worker, etc.) already ran the migrations"
sleep $SLEEP_TIME sleep $SLEEP_TIME
# Provision database # Provision database

View File

@@ -89,7 +89,8 @@ services:
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
healthcheck: healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 10s interval: 5s
timeout: 5s
retries: 10 retries: 10
adminer: adminer:

View File

@@ -1,3 +0,0 @@
FROM nginx:1.28-alpine
COPY bash/nginx.conf /etc/nginx/conf.d/default.conf