diff options
Diffstat (limited to 'packaging')
| -rwxr-xr-x | packaging/build/build-hub.sh | 14 | ||||
| -rw-r--r-- | packaging/deb/meshbay-hub/DEBIAN/control | 5 | ||||
| -rw-r--r-- | packaging/systemd/meshbay-hub.service | 9 |
3 files changed, 20 insertions, 8 deletions
diff --git a/packaging/build/build-hub.sh b/packaging/build/build-hub.sh index be2d363..e32ba55 100755 --- a/packaging/build/build-hub.sh +++ b/packaging/build/build-hub.sh @@ -47,11 +47,15 @@ ln -sf /opt/meshbay-common/venv/bin/meshbay-hub "$ROOT/usr/bin/meshbay-hub" # --- Hub-specific assets -------------------------------------------------- mkdir -p "$ROOT/opt/meshbay-hub" -# Alembic config (migrations are inside the installed package at meshbay_hub/db/migrations/) -if [ -f "$REPO/packages/meshbay-hub/alembic.ini" ]; then - mkdir -p "$ROOT/opt/meshbay-hub/migrations" - cp "$REPO/packages/meshbay-hub/alembic.ini" "$ROOT/opt/meshbay-hub/migrations/" -fi +# No alembic.ini is staged. It resolves `script_location` with `%(here)s`, so a +# copy of it is only correct where it was copied from: staged into +# /opt/meshbay-hub/migrations/ it pointed at +# /opt/meshbay-hub/migrations/src/meshbay_hub/db/migrations, which nothing +# installs — the migrations live inside the package, in the shared venv. The +# unit runs `meshbay-hub migrate` instead, which asks the package. +# +# The same `%(here)s` trap had already been found once on the server, where a +# stray alembic.ini resolved to a month-old snapshot of the tree. # Config example. # diff --git a/packaging/deb/meshbay-hub/DEBIAN/control b/packaging/deb/meshbay-hub/DEBIAN/control index 07799a1..c5f60fa 100644 --- a/packaging/deb/meshbay-hub/DEBIAN/control +++ b/packaging/deb/meshbay-hub/DEBIAN/control @@ -11,6 +11,7 @@ Description: MeshBay Hub — identity authority and group registry server MeshBay Hub provides user registration, JWT issuance, group management, WebRTC signaling, notifications, and moderation for MeshBay networks. . - Installs hub code into the shared venv at /opt/meshbay-common/venv/ and - Alembic migrations at /opt/meshbay-hub/migrations/. + Installs hub code into the shared venv at /opt/meshbay-common/venv/. The + database migrations travel inside the package; `meshbay-hub migrate` finds + them there, and the systemd unit runs it before the server starts. Runs as a systemd service behind Caddy for HTTPS. diff --git a/packaging/systemd/meshbay-hub.service b/packaging/systemd/meshbay-hub.service index 40cdb98..1a3ca44 100644 --- a/packaging/systemd/meshbay-hub.service +++ b/packaging/systemd/meshbay-hub.service @@ -16,7 +16,14 @@ EnvironmentFile=-/etc/meshbay/hub.env Environment=MESHBAY_DATABASE_URL=postgresql+asyncpg://meshbay:CHANGEME@localhost/meshbay_hub Environment=MESHBAY_HUB_KEY=/etc/meshbay/hub_private.pem -ExecStartPre=/opt/meshbay-common/venv/bin/alembic -c /opt/meshbay-hub/migrations/alembic.ini upgrade head +# The hub's own command, not `alembic -c <a path>`. That path was +# /opt/meshbay-hub/migrations/alembic.ini, where `%(here)s/src/meshbay_hub/db/…` +# resolves to a directory the package does not install — the migrations ship +# inside meshbay_hub itself, in the shared venv. So this line could never +# succeed, and a hub installed from the RPM or the DEB would not start at all. +# `migrate` asks the installed package where its own migrations are, which is +# correct for the package, a venv, and a checkout alike. +ExecStartPre=/opt/meshbay-common/venv/bin/meshbay-hub migrate --config /etc/meshbay/hub.toml ExecStart=/opt/meshbay-common/venv/bin/meshbay-hub --config /etc/meshbay/hub.toml Restart=always RestartSec=5 |