summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-06-08 18:36:07 +0000
committerKen D'Ambrosio <ken@jots.org>2026-06-08 18:36:07 +0000
commit625b3d5176f2c274e91fcf28bda8e45cc0477722 (patch)
tree6ca16ad6f4a830b65dcddbd78ad7e7a2f1655682 /config
parentecc872a1fd43c0863e3171a1faf533adc3e3a4c5 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'config')
-rw-r--r--config/face_daemon.service27
1 files changed, 27 insertions, 0 deletions
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