already_configured flag for checking db init

This commit is contained in:
Thomas Nahuel Rusiecki 2025-02-18 21:24:04 -03:00
parent e1c26db29f
commit bb2972f672

View file

@ -28,14 +28,11 @@ END
} }
deployment_strategy() { deployment_strategy() {
# detect if existing deployment (TODO only works with sqlite)
if [ -f "${idhub_dir}/db.sqlite3" ]; then
echo "INFO: detected EXISTING deployment"
./manage.py migrate
# warn admin that it should re-enter password to keep the service working init_flagfile="${idhub_dir}/already_configured"
./manage.py send_mail_admins if [ ! -f "${init_flagfile}" ]; then
else
echo "INFO: detected NEW deployment"
# this file helps all docker containers to guess number of hosts involved # this file helps all docker containers to guess number of hosts involved
# right now is only needed by new deployment for oidc # right now is only needed by new deployment for oidc
if [ -d "/sharedsecret" ]; then if [ -d "/sharedsecret" ]; then
@ -58,6 +55,15 @@ deployment_strategy() {
else else
echo "Note: skipping oidc4vp config" echo "Note: skipping oidc4vp config"
fi fi
# remain next command as the last operation for this if conditional
touch "${init_flagfile}"
else
echo "INFO: detected PREVIOUS deployment"
./manage.py migrate
# warn admin that it should re-enter password to keep the service working
./manage.py send_mail_admins
fi fi
} }