Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Don't start the server if errors occur

Roland Geiderd2fced3f77fb
diff --git a/extras/docker/production/entrypoint.sh b/extras/docker/production/entrypoint.sh
index e1c33314a..764d90245 100644
--- a/extras/docker/production/entrypoint.sh
+++ b/extras/docker/production/entrypoint.sh
@@ -15,7 +15,12 @@ then
exit 1
fi
-wger bootstrap --no-process-static
+# Don't start the server if the bootstrap failed, e.g. because the database is
+# not reachable yet. The restart policy will try again.
+if ! wger bootstrap --no-process-static; then
+ echo "Bootstrapping the application failed, not starting the server"
+ exit 1
+fi
# Collect static files
if [ "$DJANGO_CLEAR_STATIC_FIRST" == "False" ]; then
@@ -34,7 +39,10 @@ fi
if [[ "$DJANGO_PERFORM_MIGRATIONS" == "True" ]];
then
echo "Performing database migrations"
- python3 manage.py migrate
+ if ! python3 manage.py migrate; then
+ echo "Database migrations failed, not starting the server"
+ exit 1
+ fi
fi
# Sync exercises