Dirst attempt at the daemon

This commit is contained in:
Kuba Orlik 2022-05-28 12:54:53 +02:00
parent e38daf52de
commit 8fd169bc6c
3 changed files with 22 additions and 1 deletions

View File

@ -24,6 +24,12 @@ BASE_URL=http://localhost:3000 docker run -i -v $PWD/static:/opt/static headles
BASE_URL=http://localhost:3000 node .
```
To set up a systemd daemon that starts with the server, use:
```
npm run install-daemon
```
## Testing the API
with httpie:

View File

@ -4,7 +4,7 @@
"description": "## Dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"install-daemon": "cp screenshot-service.service /etc/systemd/system/ && systemctl start screenshot-service && systemctl enable screenshot-service"
},
"repository": {
"type": "git",

View File

@ -0,0 +1,15 @@
[Unit]
Description=Service that takes screenshots for users of the Rentgen addon
After=network.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root/ss
ExecStart=node /root/ss
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=multi-user.target