sessions/compose.yaml
agent 0738171f1e Archive sessions, allow spaces in names, stop tripping the SSH rate limit
Connection refused: the dev box's UFW `limit` rule refuses the 6th new
SSH connection from one address within 30 s. Every page view made two
calls (list, repos) and every button one more, so stopping two sessions
and refreshing hit it (kernel log: "UFW LIMIT BLOCK" from prod's IP).
The web app now multiplexes all calls over one connection
(ControlMaster=auto, ControlPersist=120), with the socket in its private
temp dir. compose.yaml gets `init: true` so the backgrounded master is
reaped; the app warns if it runs as PID 1.

Spaces in names: `create` now takes a title (letters, digits, '-',
single spaces, <= 48 chars). The slug used for the directory, branch,
unit and tmux socket is derived from it; the title is shown on the page
and passed to claude as --name. A plain slug still maps to itself.

Archive: new remote verbs `archive` (stop + flag, keeps checkout and
conversation) and `unarchive` (back to the list, still stopped). An
archived session refuses `start`. The page lists archived sessions in a
collapsible section. `list` re-reads state under the lock before saving
a Remote Control URL so it can't undo a concurrent archive.

Also: name/branch validation used re.match with `$`, which accepts a
trailing newline; it now uses fullmatch.

Tested end to end with a throwaway 127.0.0.1 key and the real container:
24 remote calls went over 1 TCP connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rog8S9b5qKaw6nUicxXLkM
2026-10-06 09:42:40 +00:00

22 lines
800 B
YAML

# Deployed on prod by the panel (reudy-net/panel): it builds this, injects the
# app's environment variables, and publishes web:8470 on 127.0.0.1 for the
# route, which must have Authelia turned on. The variables come from running
# `sessions-ctl keygen` on the dev box — see README "Deploy on prod".
services:
web:
build: ./web
image: localhost/sessions-web:latest
restart: unless-stopped
# Reaps the SSH master connection app.py leaves running between calls.
init: true
read_only: true
tmpfs:
- /tmp
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8470/healthz', timeout=4)"]
interval: 60s
timeout: 5s