service: Switch to systemd user service
Run as the current user instead of a dedicated system user, using systemd user service in ~/.config/systemd/user/. This avoids needing root for setup and keeps uv and the project in the user's home directory. Rename service file to matrix-paperless-ingest.service.
This commit is contained in:
parent
d5a3528cde
commit
b2646222f8
2 changed files with 15 additions and 19 deletions
25
README.md
25
README.md
|
|
@ -102,23 +102,20 @@ uv run --no-sync python ingest.py
|
|||
Watch the logs. It will process all historical messages, then listen for new ones.
|
||||
Press Ctrl-C to stop.
|
||||
|
||||
## Install as a systemd service
|
||||
## Install as a systemd user service
|
||||
|
||||
```bash
|
||||
# Create a dedicated user
|
||||
sudo useradd -r -s /bin/false matrix-paperless-ingest
|
||||
# Enable lingering so the service starts at boot without requiring login
|
||||
loginctl enable-linger
|
||||
|
||||
# Copy the project
|
||||
sudo cp -r . /opt/matrix-paperless-ingest
|
||||
sudo chown -R matrix-paperless-ingest:matrix-paperless-ingest /opt/matrix-paperless-ingest
|
||||
|
||||
# Install and start the service
|
||||
sudo cp paperless-ingest.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now paperless-ingest
|
||||
# Install the service
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp matrix-paperless-ingest.service ~/.config/systemd/user/
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now matrix-paperless-ingest
|
||||
|
||||
# Check logs
|
||||
sudo journalctl -u paperless-ingest -f
|
||||
journalctl --user -u matrix-paperless-ingest -f
|
||||
```
|
||||
|
||||
## Viewing retry queue
|
||||
|
|
@ -129,7 +126,7 @@ sqlite3 state.db "SELECT filename, status, retry_count, datetime(next_retry, 'un
|
|||
|
||||
## Moving to a new server
|
||||
|
||||
1. Copy the project directory (including `.env` and `state.db`)
|
||||
1. Copy the project directory to `~/matrix-paperless-ingest` (including `.env` and `state.db`)
|
||||
2. Install `uv`, `libolm3`, and `python3-olm` on the new server
|
||||
3. Run `uv venv --system-site-packages && uv sync --no-install-package python-olm`
|
||||
4. Install the systemd service as above
|
||||
4. Install the systemd user service as above
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue