From c6cbdb0825c746a593bf6996ca1dec146d5083ed Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Sat, 16 May 2026 02:38:21 +0000 Subject: [PATCH] docs: add systemd unit files with EnvironmentFile directive Unit files load env vars from /etc/central/central.env using EnvironmentFile directive. Includes README with installation and configuration instructions. Co-Authored-By: Claude Opus 4.5 --- systemd/README.md | 41 ++++++++++++++++++++++++++++++ systemd/central-archive.service | 1 + systemd/central-supervisor.service | 1 + 3 files changed, 43 insertions(+) create mode 100644 systemd/README.md diff --git a/systemd/README.md b/systemd/README.md new file mode 100644 index 0000000..f1d65a7 --- /dev/null +++ b/systemd/README.md @@ -0,0 +1,41 @@ +# Systemd Unit Files + +These unit files configure Central services for systemd. + +## Installation + +```bash +# Copy unit files +sudo cp central-supervisor.service /etc/systemd/system/ +sudo cp central-archive.service /etc/systemd/system/ + +# Reload systemd +sudo systemctl daemon-reload + +# Enable and start services +sudo systemctl enable --now central-supervisor +sudo systemctl enable --now central-archive +``` + +## Configuration + +Both services load environment variables from `/etc/central/central.env`: + +```bash +CENTRAL_DB_DSN=postgresql://central:password@localhost/central +CENTRAL_NATS_URL=nats://localhost:4222 +CENTRAL_CONFIG_SOURCE=db +CENTRAL_MASTER_KEY_PATH=/etc/central/master.key +``` + +## Service Dependencies + +- **central-supervisor**: Requires NATS server +- **central-archive**: Requires NATS server and PostgreSQL + +## Logs + +```bash +journalctl -u central-supervisor -f +journalctl -u central-archive -f +``` diff --git a/systemd/central-archive.service b/systemd/central-archive.service index 79e76bb..78ec5d9 100644 --- a/systemd/central-archive.service +++ b/systemd/central-archive.service @@ -10,6 +10,7 @@ User=central Group=central WorkingDirectory=/opt/central Environment=HOME=/opt/central +EnvironmentFile=/etc/central/central.env ExecStart=/opt/central/.venv/bin/central-archive Restart=on-failure RestartSec=5 diff --git a/systemd/central-supervisor.service b/systemd/central-supervisor.service index 61ef0cc..3f30923 100644 --- a/systemd/central-supervisor.service +++ b/systemd/central-supervisor.service @@ -10,6 +10,7 @@ User=central Group=central WorkingDirectory=/opt/central Environment=HOME=/opt/central +EnvironmentFile=/etc/central/central.env ExecStart=/opt/central/.venv/bin/central-supervisor Restart=on-failure RestartSec=5