diff --git a/README.md b/README.md index bfb4f8a..e65bf07 100644 --- a/README.md +++ b/README.md @@ -75,11 +75,27 @@ POST /api/render-markdown body: { text, mode? } → { html } ## Running as a system service -`deployment/task-inventory.service` is a systemd unit file. To use it: +`deployment/task-inventory.service` targets `/srv/task-inventory` with a dedicated `task-inventory` user. -1. Fill in `WorkingDirectory` with the path to the deployed app -2. Create a dedicated user: `useradd -r task-inventory` -3. `sudo systemctl enable --now "$(realpath deployment/task-inventory.service)"` +```bash +# Create service user +sudo useradd -r task-inventory + +# Deploy files +sudo cp -r . /srv/task-inventory +sudo chown -R task-inventory:task-inventory /srv/task-inventory + +# Install dependencies as service user +sudo -u task-inventory npm ci --prefix /srv/task-inventory + +# Copy and configure config.yaml +sudo cp config.yaml.example /srv/task-inventory/config.yaml +sudo chown task-inventory:task-inventory /srv/task-inventory/config.yaml +# edit /srv/task-inventory/config.yaml + +# Enable and start +sudo systemctl enable --now "$(realpath deployment/task-inventory.service)" +``` Packaging (Arch, Debian, etc.) is not set up yet. diff --git a/deployment/task-inventory.service b/deployment/task-inventory.service index ff6eea3..9496e2d 100644 --- a/deployment/task-inventory.service +++ b/deployment/task-inventory.service @@ -8,7 +8,7 @@ User=task-inventory Group=task-inventory Type=simple ExecStart=node server.mjs -WorkingDirectory= MUST BE FILLED IN +WorkingDirectory=/srv/task-inventory Restart=on-failure [Install]