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:
WolfandClaude Fable 5.1 committed 2026-10-27 11:11:19 +01:00
1 parent 83e965dfeb
commit a1f281a23a
40 files changed
+2226 -1287

No files matched your search

+17 -9
View File
@@ -1,11 +1,13 @@
"""Offline database replacement, run as the compose service's uid.
The app container must be stopped. Only stdlib is used so this can be sent
over stdin to either the old or the new image during a deployment.
The app container must be stopped. Sent over stdin to the image on the
server, whose working directory is the app's: the database is the one the
app's config names (`from app.config` follows the package when it is renamed),
and the rest is stdlib, so the old image and the new one both run it.
Two things to edit for your service: `DATABASE` and `REQUIRED_TABLES`. The
table check is what stops a right-shaped-but-wrong database — last project's,
or a half-downloaded one — from landing on top of a good one.
`REQUIRED_TABLES` is the table check, which stops a right-shaped-but-wrong
database (last project's, or a half-downloaded one) from landing on top of a
good one. `tests/test_deploy.py` fails when the app stops creating one of them.
"""
from __future__ import annotations
@@ -19,13 +21,14 @@ from contextlib import closing
from datetime import UTC, datetime
from pathlib import Path
DATABASE = Path("/data/app.db")
INCOMING = Path("/data/incoming.db.gz")
BACKUPS = Path("/data/backups")
#: Any one of these missing means this is not our database. Name tables that
#: have existed since the first schema, not ones a recent migration added.
REQUIRED_TABLES = {"items"}
#: have existed since the first schema, not ones a recent migration added:
#: `jobs` is the queue's and `roles` is `app/storage/schema.py`'s first table
#: (the boilerplate has `ticks`). backup.sh's TABLES is the same set.
REQUIRED_TABLES = {"jobs", "roles"}
def replace_database(database: Path, archive: Path, backups: Path) -> Path | None:
@@ -73,5 +76,10 @@ def replace_database(database: Path, archive: Path, backups: Path) -> Path | Non
if __name__ == "__main__":
saved = replace_database(DATABASE, INCOMING, BACKUPS)
from app.config import load
# The snapshot is the whole database, so it is owner only whatever the
# container's umask is; the gzip of it is made under the same mask.
os.umask(0o077)
saved = replace_database(load().database.absolute(), INCOMING, BACKUPS)
print(f"Database replaced; previous snapshot: {saved or 'none (first import)'}")