From 1ae8393b11f03737430a844997c12f267ea21d4e Mon Sep 17 00:00:00 2001 From: Vasile Popescu Date: Mon, 2 Sep 2024 17:41:18 +0200 Subject: [PATCH 1/2] Remove the STATICFILES_DIRS from our settings We don't have any custom static assets that should be collected, so no need for this setting --- metaculus_web/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/metaculus_web/settings.py b/metaculus_web/settings.py index 6f22f065fe..d0fac67ff3 100644 --- a/metaculus_web/settings.py +++ b/metaculus_web/settings.py @@ -244,7 +244,6 @@ STATIC_URL = "static/" STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") -STATICFILES_DIRS = [BASE_DIR / "static"] # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field From 169c7f6b615536381392c7f3eaa5f5b99f1205e7 Mon Sep 17 00:00:00 2001 From: Vasile Popescu Date: Mon, 2 Sep 2024 18:59:28 +0200 Subject: [PATCH 2/2] Fix the deploy GH actions Periodically check for the release status and fail if that failed in the two GH actions. --- scripts/deploy_to_heroku.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/deploy_to_heroku.sh b/scripts/deploy_to_heroku.sh index e8bb1db9ef..38725a1b8c 100755 --- a/scripts/deploy_to_heroku.sh +++ b/scripts/deploy_to_heroku.sh @@ -9,6 +9,25 @@ for var in "${required_vars[@]}"; do fi done +wait_and_fail_if_release_failed() { + max_iters=10 + for ((i = 1; i <= max_iters; i++)); do + json=$(heroku releases --json) + # Extract the status and current fields from the first element of the array + status=$(echo "$json" | jq -r '.[0].status') + current=$(echo "$json" | jq -r '.[0].current') + + [ "$status" == "pending" ] && echo "Waiting for release to finish" && sleep 1 && continue + + [ "$status" == "succeeded" ] && [ "$current" == "true" ] && echo "Release succeeded " && exit 0 + + break + done + + echo "Release failed." + exit 1 +} + # These are needed for nextjs build phase, as it replaces the value of these environmental variables # at build time :/ FRONTEND_ENV_FILE=$(mktemp) @@ -30,3 +49,5 @@ done # Release them all heroku container:release release web dramatiq_worker django_cron -a $HEROKU_APP + +wait_and_fail_if_release_failed \ No newline at end of file