Refresh deploy/ and bin/ from the boilerplate at 09e144d (the release split between the distro and Windows, wsl-setup, the server config, USER 1000, python:3.15-slim) with roledesk's facts put back: no frontend stage, desk, plugins and seed copied, the extras passkeys, embeddings and llm, roles as the table the backup and the importer require, bin/pull.sh and bin/worker.sh with their profile commands, and Install Server.md and Install WSL.md as copies in place of the five old deployment docs
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
83e965dfeb
commit
a1f281a23a
40 files changed
+2226
-1287
No files matched your search
@@ -1,18 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Called on the server after uploading incoming.db.gz and import_database.py.
|
||||
# `db.ps1 push` does both and then runs this; by hand it is the same two files
|
||||
# `db.sh push` does both and then runs this; by hand it is the same two files
|
||||
# in the same two places.
|
||||
#
|
||||
# This replaces the database and does nothing else. It does not stop the app
|
||||
# and it does not start it: whoever is running a deployment knows what else is
|
||||
# moving and in what order, and a tool that helpfully restarts things underneath
|
||||
# that is a tool fighting its caller. By hand it is
|
||||
# `docker compose stop app` and `docker compose up -d --wait app` around this.
|
||||
# `docker compose stop app` and `docker compose up -d --wait app` around this,
|
||||
# with SERVICE (deploy.sh says why it is here) in place of app.
|
||||
#
|
||||
# What it will not do is import into a running app. The replacement is a file
|
||||
# swap under SQLite's feet, and the live database is checkpointed first, which
|
||||
# needs every writer gone — `import_database.py` refuses a busy database, and
|
||||
# this refuses an app that is up, because the clearer error is the earlier one.
|
||||
SERVICE=app
|
||||
|
||||
set -euo pipefail
|
||||
cd "${1:?server directory required}"
|
||||
|
||||
@@ -22,14 +25,14 @@ DATA=${DATA:-./data}
|
||||
|
||||
[[ -s "$DATA/incoming.db.gz" && -s import_database.py ]]
|
||||
|
||||
if [[ -n "$(docker compose ps -q --status running app 2>/dev/null)" ]]; then
|
||||
echo 'app is running. Stop it before importing:' >&2
|
||||
echo ' docker compose stop app' >&2
|
||||
if [[ -n "$(docker compose ps -q --status running "$SERVICE" 2>/dev/null)" ]]; then
|
||||
echo "$SERVICE is running. Stop it before importing:" >&2
|
||||
echo " docker compose stop $SERVICE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The one-off container uses compose's uid and its mounted /data. `--pull
|
||||
# never`: an import runs on the image already here, whatever the installed
|
||||
# compose file says about pulling. Getting a new image is deploy.sh's job.
|
||||
docker compose run --rm --no-deps --pull never -T --entrypoint python app - < import_database.py
|
||||
docker compose run --rm --no-deps --pull never -T --entrypoint python "$SERVICE" - < import_database.py
|
||||
rm -f "$DATA/incoming.db.gz"
|
||||
Reference in new issue
Block a user