added systemd-service and updated readme

This commit is contained in:
Daniel Sommer 2022-02-21 12:04:37 +01:00
parent e332dcda9c
commit 8a97448f7f
2 changed files with 31 additions and 4 deletions

View file

@ -12,11 +12,11 @@ control your blinkstick via http requests
## setup ## setup
- clone the project - clone the project (to '/opt/blinky')
`git clone https://git.velvettear.de/velvettear/blinky.git` `git clone https://git.velvettear.de/velvettear/blinky.git /opt/blinky`
- enter the cloned directory - enter the cloned directory
`cd blinky` `cd /opt/blinky`
- install and switch to a supported node.js version (automatically done via .nvmrc file) - install and switch to a supported node.js version (automatically done via .nvmrc file)
`nvm install` `nvm install`
@ -27,9 +27,25 @@ control your blinkstick via http requests
- switch back to your system's default node.js version - switch back to your system's default node.js version
`nvm deactivate` `nvm deactivate`
- run it - execute blinky
`nvm run 15 blinky.js` `nvm run 15 blinky.js`
## systemd
**for security reasons it is highly recommended to not run blinky with root permissions!**
- create a new system user
`useradd -r -s /usr/bin/nologin blinky`
- symlink the provided systemd-service file and modify it according to your needs
`ln -s /opt/blinky/blinky.service /etc/systemd/system/blinky.service`
- reload systemd-services
`systemctl daemon-reload`
- enable and start blinky as a systemd-service
`systemctl enable --now blinky`
### scripts ### scripts
- blinky-feed.sh - blinky-feed.sh

11
blinky.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=blinky (blinkstick controller)
[Service]
Type=simple
User=blinky
Group=blinky
ExecStart=nvm run 15 /opt/blinky/blinky.js
[Install]
WantedBy=multi-user.target