Add registration toggle and password change; genericise deploy
Two things the running instance needed. **Registration toggle.** Admin -> General, backed by a new settings table group rather than the environment. LEMBAS_ALLOW_SIGNUP now seeds only the initial value: once an administrator saves the setting, the stored value wins. The alternative -- environment always winning -- means a toggle in the UI silently reverts on the next restart, which is worse than not offering one. Closing registration also removes the "Create one" link from the sign-in page, so the link never leads somewhere that refuses. **Password change**, on the user settings page. Changing a password revokes every other session and immediately re-issues a cookie for the current one: if the reason for the change is that somebody else knows the password, leaving their session alive defeats the point, but signing the user out of the tab they are standing in is merely rude. **deploy/ is now host-agnostic.** This repository is public, so the unit and vhost became templates with __PREFIX__ / __SITE_HOST__ / __APP_PORT__ substituted at install time, and every path, hostname and port moved to environment variables. REPO_URL defaults to the checkout's own origin so a fork deploys itself. Machine-specific values belong in private notes, not here -- CLAUDE.md now says so. 83 tests, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+18
-23
@@ -1,48 +1,43 @@
|
||||
# LLeMbas system service.
|
||||
# LLeMbas system service template.
|
||||
#
|
||||
# Deployed to /etc/systemd/system/lembas.service by deploy/install.sh.
|
||||
# install.sh substitutes __PREFIX__ and __SERVICE_USER__ and writes the result
|
||||
# to /etc/systemd/system/lembas.service. Edit this file, not the installed copy.
|
||||
#
|
||||
# A system unit, not a user unit, so it survives logout and comes up at boot
|
||||
# without anyone signing in -- matching llama-swap and comfyui on this box.
|
||||
#
|
||||
# /srv/lembas is a bind mount of /home/lembas: the root LV is only 50 GB and
|
||||
# the venv plus SQLite database belong on /home, same trick as /srv/llama.
|
||||
# without anyone signing in.
|
||||
|
||||
[Unit]
|
||||
Description=LLeMbas - web UI for language models
|
||||
Documentation=https://git.houmeres.sk/Houmeres/LLeMbas
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
# The unit is useless without the bind mount: the venv and database live there.
|
||||
RequiresMountsFor=/srv/lembas
|
||||
# Not a hard dependency. LLeMbas starts fine with the endpoint down and shows a
|
||||
# readable error in the admin UI, which is better than refusing to boot.
|
||||
After=llama-swap.service
|
||||
# The prefix is usually a bind mount; the venv and database live there, so
|
||||
# starting before it is mounted would create an empty database in its place.
|
||||
RequiresMountsFor=__PREFIX__
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=lembas
|
||||
Group=lembas
|
||||
WorkingDirectory=/srv/lembas/app
|
||||
EnvironmentFile=/srv/lembas/lembas.env
|
||||
ExecStart=/srv/lembas/venv/bin/lembas serve
|
||||
User=__SERVICE_USER__
|
||||
Group=__SERVICE_USER__
|
||||
WorkingDirectory=__PREFIX__/app
|
||||
EnvironmentFile=__PREFIX__/lembas.env
|
||||
ExecStart=__PREFIX__/venv/bin/lembas serve
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
# Reachable only through the nginx chat.lan vhost, never directly on the LAN.
|
||||
# The bind address is set by LEMBAS_HOST in the environment file.
|
||||
# The bind address comes from LEMBAS_HOST in the environment file, which the
|
||||
# installer sets to 127.0.0.1: reachable through nginx, never directly.
|
||||
|
||||
# --- Hardening -------------------------------------------------------------
|
||||
# Modest rather than maximal: the agentic features planned for later will need
|
||||
# to run commands, so ProtectSystem=strict would only be torn out again.
|
||||
# Moderate rather than maximal. The agentic features planned for later need to
|
||||
# run commands, and a lockdown that has to be torn out again is worse than one
|
||||
# that was never applied.
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
ProtectSystem=full
|
||||
ProtectKernelTunables=yes
|
||||
ProtectControlGroups=yes
|
||||
RestrictSUIDSGID=yes
|
||||
# Only /srv/lembas needs to be writable; /home/lembas is the same inode.
|
||||
ReadWritePaths=/srv/lembas
|
||||
ReadWritePaths=__PREFIX__
|
||||
LimitNOFILE=65535
|
||||
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user