fix(docs): update ubuntu / systemd service instructions

fixes #126
This commit is contained in:
sentriz
2021-05-11 23:59:14 +01:00
parent 3cf3bdafd8
commit ef6dd6c82a
3 changed files with 43 additions and 41 deletions

View File

@@ -86,47 +86,61 @@ then start with `docker-compose up -d`
### ...with systemd ### ...with systemd
example by @IUCCA, tested on Ubuntu 18.04 tested on Ubuntu 21.04
1. add a repository with the latest Version of golang and install the prerequisites 1. install **go 1.16 or newer**, check version, and install dependencies
```bash ```shell
$ sudo add-apt-repository ppa:longsleep/golang-backports $ sudo apt update
$ sudo apt update && sudo apt upgrade $ sudo apt install golang
$ sudo apt install build-essential git sqlite libtag1-dev ffmpeg libasound-dev golang
$ go version
go version go1.16.2 linux/amd64
$ sudo apt install build-essential git sqlite libtag1-dev ffmpeg libasound-dev
``` ```
2. download and compile gonic in the home directory 2. install / compile gonic globally, and check version
```bash ```shell
$ go get go.senan.xyz/gonic/cmd/gonic $ sudo GOBIN=/usr/local/bin go install go.senan.xyz/gonic/cmd/gonic@latest
$ gonic -version
v0.14.0
``` ```
3. add a gonic user and create a directory for the server 3. add a gonic user, create a data directory, and install a config file
```bash ```shell
$ sudo mkdir -p /var/gonic/ $ sudo adduser --system --no-create-home --group gonic
$ sudo adduser --disabled-login --gecos "" gonic $ sudo mkdir -p /var/lib/gonic/ /etc/gonic/
$ sudo mv go/bin/gonic /var/gonic/ $ sudo chown -R gonic:gonic /var/lib/gonic/
$ sudo wget https://raw.githubusercontent.com/sentriz/gonic/master/contrib/config -O /var/gonic/config $ sudo wget https://raw.githubusercontent.com/sentriz/gonic/master/contrib/config -O /etc/gonic/config
$ sudo chmod -R 750 /var/gonic/
$ sudo chown -R gonic:gonic /var/gonic/
``` ```
4. add your `music-path` to the config file 4. update the config with your `music-path`, `podcast-path`, etc
```bash ```shell
$ sudo nano /var/gonic/config $ sudo nano /etc/gonic/config
music-path <path to your music dir>
podcast-path <path to your podcasts dir>
cache-path <path to cache dir>
``` ```
5. setup systemd service 5. install the systemd service, check status or logs
```bash ```shell
$ sudo wget https://raw.githubusercontent.com/sentriz/gonic/master/contrib/gonic.service -O /etc/systemd/system/gonic.service $ sudo wget https://raw.githubusercontent.com/sentriz/gonic/master/contrib/gonic.service -O /etc/systemd/system/gonic.service
$ sudo systemctl daemon-reload $ sudo systemctl daemon-reload
$ sudo systemctl enable --now gonic $ sudo systemctl enable --now gonic
$ systemctl status gonic # check status, should be active (running)
$ journalctl --follow --unit gonic # check logs
``` ```
should be installed and running on boot now 👍
view the admin UI at http://localhost:4747
### ...elsewhere ### ...elsewhere
[![](https://repology.org/badge/vertical-allrepos/gonic.svg)](https://repology.org/project/gonic/versions) [![](https://repology.org/badge/vertical-allrepos/gonic.svg)](https://repology.org/project/gonic/versions)

View File

@@ -1,8 +1,7 @@
music-path music-path <path to your music dir>
cache-path /tmp/gonic_cache podcast-path <path to your podcasts dir>
db-path /var/gonic/gonic.db cache-path <path to cache dir>
db-path /var/lib/gonic/gonic.db
jukebox-enabled false jukebox-enabled false
listen-addr 127.0.0.1:4747 listen-addr 127.0.0.1:4747
proxy-prefix /gonic
scan-interval 0 scan-interval 0
podcast-path

View File

@@ -1,28 +1,17 @@
[Unit] [Unit]
Description=Gonic service Description=gonic service
ConditionPathExists=/var/gonic/gonic ConditionPathExists=/var/lib/gonic/
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=gonic User=gonic
Group=gonic Group=gonic
LimitNOFILE=1024
Restart=on-failure Restart=on-failure
RestartSec=10 RestartSec=10
WorkingDirectory=/var/gonic/ ExecStart=/usr/local/bin/gonic -config-path /etc/gonic/config
ExecStart=/var/gonic/gonic -config-path /var/gonic/config
# make sure log directory exists and owned by syslog
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/log/gonic
ExecStartPre=/bin/chown syslog:adm /var/log/gonic
ExecStartPre=/bin/chmod 755 /var/log/gonic
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sleepservice
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target