feat(contrib): improve system related contrib files

Make example configuration self documenting

Most services on *nix type systems have configuration files that are
self documenting. This usually entails:
- listing all configuration options with some sane default values
- commenting out options that do not need to be set or match the binary
  default value
- some explanatory comments where needed

This simplifies management of the service as configuration can be
understood and modified in place without having to open up the internet.

This diff also groups settings into logical blocks:
- basic server settings
- directory settings
- behavioural settings

Improve contrib system file behaviour

This diff improves gonic serive files in the following way:
- Define a sane default for gonig cache, which will map well to
  established cache paths on most Linux systems
- Update service file to use StateDirectory=, CacheDirectory= directives
  to create /var/lib/gonic and /var/cache/gonic directories respectively
- Add a tmpfilesd sample configuration that will automatically clean
  cache files if they are older than 7 days
- Add sysysers configuration file that can be used in sysusers.d to
  create relevant gonic user and group during installation.
This commit is contained in:
Zoltan Puskas
2023-02-12 17:22:50 -08:00
committed by sentriz
parent 5dcc8c18a1
commit ac74b35465
4 changed files with 57 additions and 8 deletions

View File

@@ -1,7 +1,52 @@
music-path <path to your music dir> # This is the gonic server system-wide configuration file. For other
podcast-path <path to your podcasts dir> # administrative and per user settings go th the web UI.
cache-path <path to cache dir> #
db-path /var/lib/gonic/gonic.db # The strategy used for options in the default config shipped with gonic is to
jukebox-enabled false # specify options with their default value where possible, and leave optional
listen-addr 127.0.0.1:4747 # ones commented. Uncommented options override the default value. Options that
scan-interval 0 # are mandatory and need setting before first run have a placeholder for their
# values in <angle brackets>.
# Interface and port to listen on. Defaults to 0.0.0.0:4747
listen-addr 127.0.0.1:4747
# HTTP(S) request logging
#http-log true
# URL path prefix to use if behind reverse proxy
#proxy-prefix <prefix>
# Secure connection settings. Recommended to set up unless gonic sits behing an
# SSL enabled reverse proxy server. Disabled by default.
#tls-cert <path to TLS certificatie>
#tls-key <path to TLS private key>
# gonic's internal state database location
db-path /var/lib/gonic/gonic.db
# Path to music files. Must be specified at least once, but can be specified
# multiple times if the collection is split into different
# directories. E.g.:
# music-path /srv/audio/music
music-path <path to your music dir>
# Path to downloaded podcast files. Must be specified. E.g.:
# podcast-path /var/cache/podcast
podcast-path <path to your podcasts dir>
# Age (in days) to purge podcast episodes if not accessed. Disabled by default.
#podcast-purge-age 0
# Directory where transcoded audio files and covers are stored. It's safe to
# delete contents periodically (see tmpfilesd configuration), as it will be
# regenerated.
cache-path /var/cache/gonic
# Interval (in minutes) to check for new music. Default: don't scan
#scan-interval 0
#scan-at-start-enabled false
#scan-watcher-enabled false
#jukebox-enabled false
#jukebox-mpv-extra-args <extra command line arguments to pass to the jukebox mpv daemon>
# A string or character to split genre tags on for multi-genre support (e.g. ;)
#genre-split ;

View File

@@ -1,6 +1,5 @@
[Unit] [Unit]
Description=gonic service Description=gonic service
ConditionPathExists=/var/lib/gonic/
After=network.target After=network.target
[Service] [Service]
@@ -8,6 +7,9 @@ Type=simple
User=gonic User=gonic
Group=gonic Group=gonic
StateDirectory=gonic
CacheDirectory=gonic
Restart=on-failure Restart=on-failure
RestartSec=10 RestartSec=10

1
contrib/gonic.sysusers Normal file
View File

@@ -0,0 +1 @@
u gonic - "user for gonic daemon"

1
contrib/gonic.tmpfiles Normal file
View File

@@ -0,0 +1 @@
d /var/cache/gonic 0775 gonic gonic 7d