1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 08:26:03 +00:00

fix(install): migrate runs with /etc/default/webvirtcloud loaded

The services read their environment from /etc/default/webvirtcloud, but
a re-run of the installer and the README's update and rollback steps ran
manage.py migrate without it: with WEBVIRTCLOUD_DB_HOST set there, the
migrations went to the fallback sqlite file and PostgreSQL kept the old
schema. All three now load the file first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 11:31:26 +03:00
parent 0c028ef107
commit bba4f7908e
2 changed files with 12 additions and 1 deletions

View file

@ -306,6 +306,15 @@ install_webvirtcloud () {
chown -R "$nginx_group":"$nginx_group" "$APP_PATH"
# the services' environment (PostgreSQL, SECRET_KEY): migrate must reach their database
if [ -f /etc/default/webvirtcloud ]; then
# -v traces every command: the file's passwords stay out of that trace
case $- in *x*) trace=true; set +x ;; *) trace=false ;; esac
# shellcheck source=/dev/null
set -a; . /etc/default/webvirtcloud; set +a
if $trace; then set -x; fi
fi
echo "* Django Migrate."
log "$PYTHON $APP_PATH/manage.py migrate" || { echo "manage.py migrate failed: see /var/log/webvirtcloud-install.log." >&2; exit 1; }