improve systemd unit file

This commit is contained in:
2025-03-23 14:58:35 +01:00
parent c0ac71ebba
commit 165c79e67b
2 changed files with 21 additions and 11 deletions

View File

@ -1,22 +1,29 @@
[Unit]
Description=LocationHub
Description=LocationHub Service
Documentation=https://git.mosad.xyz/localhorst/LocationHub
After=network.target systemd-networkd-wait-online.service mysqld.service
[Service]
Type=simple
User=locationhub
Group=locationhub
WorkingDirectory=/home/locationhub/git/LocationHub/server/
ExecStart=/usr/bin/npm run dev
# Combine commands for build and start
ExecStart=/bin/bash -c "/usr/bin/npm run build && /usr/bin/npm run start"
# Restart policies
Restart=on-failure
StandardOutput=append:/var/log/LocationHub.log
StandardError=append:/var/log/LocationHub.log
RestartSec=5s
# Logging configuration
StandardOutput=journal
StandardError=journal
SyslogIdentifier=locationhub
# Resource control (optional but helps stability)
MemoryLimit=512M
CPUQuota=50%
[Install]
WantedBy=multi-user.target
```
Activate Systemd Job
```
systemctl daemon-reload
systemctl enable locationhub.service
systemctl start locationhub.service
systemctl status locationhub.service