commit 5bbd026fc3d28d5a8695dcd977d951d9e5e7fdaf
parent b9f3adf91d2531fd689e980f777e0f3135378b0a
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 20 Jul 2024 13:45:25 +0200
fix: ktistec must not be running during backup
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -65,14 +65,18 @@ Database backups should be done either by file-copying **when the database is
not in use**, i.e. as long as ktistec is not running, or better yet with the
[`.backup`](https://sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_)
command, which handles file-locking and changes to the database during the
-backup procedure. This enables you to make backups while ktistec is running.
+backup procedure. However, either way, because `.backup` also honours file
+locking by the ktistec process itself, ktistec must not be running during backup
+process.
**Manual installation:**
```bash
KTISTEC_PATH="/var/www/ktistec"
+kill server && \
sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
- ".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""
+ ".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""; \
+${KTISTEC_PATH}/server &
```
**Docker (via [this repo's docker-compose](#docker) file):**
@@ -80,6 +84,7 @@ sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
```bash
# the ktistec-container does not contain a sqlite CLI client,
# so we use a new temporary alpine container instead
+docker stop ktistec && \
docker run -ti --rm \
-v /var/www/ktistec/db:/db \
-v /var/www/ktistec/backups:/backups \
@@ -89,7 +94,8 @@ apk update && \
apk add sqlite && \
sqlite3 /db/ktistec.db \
".backup \"/backups/ktistec_backup_$(date +%Y-%m-%d).sq3\""
-'
+'; \
+docker restart ktistec
```
### Uploads