From ce066052d9fd051d1e7db8b6e2a08077afbb42fc Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 6 Nov 2026 09:12:20 +0300 Subject: [PATCH] docs(readme): an update's database copy is named db.sqlite3 only once it is complete The update steps wrote the copy straight to $b/db.sqlite3: the shell creates the file before the copy runs, so a copy that failed left an empty or partial db.sqlite3 next to the commit, which looks like a good backup. Restoring from it put an empty database in place, and the panel came back with no users, computes or VMs. The copy is now written to db.sqlite3.part and renamed when it succeeds, in the Docker and the installer steps. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 70479317..e9bfa054 100644 --- a/README.md +++ b/README.md @@ -580,7 +580,8 @@ git checkout master && git pull && docker compose build && docker compose stop -t 95 && docker compose run --rm --no-deps -T --entrypoint /srv/webvirtcloud/venv/bin/python3 webvirtcloud \ - -c "import sqlite3,sys,tempfile; t=tempfile.mktemp(); sqlite3.connect('data/db.sqlite3').backup(sqlite3.connect(t)); sys.stdout.buffer.write(open(t,'rb').read())" > "$b/db.sqlite3" && + -c "import sqlite3,sys,tempfile; t=tempfile.mktemp(); sqlite3.connect('data/db.sqlite3').backup(sqlite3.connect(t)); sys.stdout.buffer.write(open(t,'rb').read())" > "$b/db.sqlite3.part" && +mv "$b/db.sqlite3.part" "$b/db.sqlite3" && docker compose up -d ``` @@ -611,7 +612,8 @@ Move the `environment=` values of that config into `/etc/default/webvirtcloud` ( cd /srv/webvirtcloud && ! systemctl is-active --quiet webvirt-cloud webvirt-novncd webvirt-socketiod webvirt-worker && mkdir -m 700 "$b" && - venv/bin/python3 -c "import sqlite3,sys; sqlite3.connect('db.sqlite3').backup(sqlite3.connect(sys.argv[1]))" "$b/db.sqlite3" && + venv/bin/python3 -c "import sqlite3,sys; sqlite3.connect('db.sqlite3').backup(sqlite3.connect(sys.argv[1]))" "$b/db.sqlite3.part" && + mv "$b/db.sqlite3.part" "$b/db.sqlite3" && cp -p webvirtcloud/settings.py /etc/nginx/conf.d/webvirtcloud.conf "$b"/ && { [ ! -f /etc/default/webvirtcloud ] || cp -p /etc/default/webvirtcloud "$b"/; } && git rev-parse HEAD > "$b/commit" &&