From c4e0df7eeb6c48a75f1596deb284a13f6384b937 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 1 Jul 2020 18:46:50 +0200 Subject: [PATCH] Wait for app to start at the end of the restore to avoid 502 error --- scripts/restore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/restore b/scripts/restore index a2870ac..0912f3f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -48,3 +48,11 @@ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql systemctl reload nginx systemctl restart supervisor supervisorctl restart budget + +# Wait that gunicorn is ready to consider the install finished, that is to +# avoid HTTP 502 right after installation +for i in `seq 1 120` +do + test -S /tmp/budget.gunicorn.sock && break + sleep 1 +done