From 625b3d5176f2c274e91fcf28bda8e45cc0477722 Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Mon, 8 Jun 2026 18:36:07 +0000 Subject: Separate face detection into standalone daemon - Strip all face code from update.rb; add shared log helper writing to /opt/albumen/log/albumen.log with [update] prefix. update.rb now owns only album.json; face_daemon.rb owns faces.json. - New scripts/face_daemon.rb: polls MEDIA_ROOT for unprocessed images, calls faces.py in batches, writes per-directory faces.json sidecars atomically. Graceful SIGTERM/SIGINT shutdown between directories. - New config/face_daemon.service: systemd unit running as albumen user, Restart=on-failure, logs via SyslogIdentifier=albumen-faces. - app.rb: add FACES_ENABLED constant; load_faces() helper reads faces.json; album_files() merges face data into each entry as :faces field. - Update README.md and DESIGN.md to document the new daemon architecture, faces.json schema, and service management commands. Co-Authored-By: Claude Sonnet 4.6 --- config/face_daemon.service | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 config/face_daemon.service (limited to 'config') diff --git a/config/face_daemon.service b/config/face_daemon.service new file mode 100644 index 0000000..4babccc --- /dev/null +++ b/config/face_daemon.service @@ -0,0 +1,27 @@ +[Unit] +Description=Albumen face detection daemon +After=network.target albumen.service +Wants=albumen.service + +[Service] +Type=simple +User=albumen +Group=albumen +WorkingDirectory=/opt/albumen + +Environment=MEDIA_ROOT=/var/albumen +Environment=CONFIG_PATH=/opt/albumen/config.yml +Environment=LOG_PATH=/opt/albumen/log/albumen.log +Environment=VENV_PYTHON=/opt/albumen/venv/bin/python3 +Environment=FACES_SCRIPT=/opt/albumen/scripts/faces.py + +ExecStart=/usr/bin/ruby /opt/albumen/scripts/face_daemon.rb +Restart=on-failure +RestartSec=30 + +StandardOutput=journal +StandardError=journal +SyslogIdentifier=albumen-faces + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3