mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
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.
This commit is contained in:
parent
90fed8160f
commit
ce066052d9
1 changed files with 4 additions and 2 deletions
|
|
@ -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" &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue