larigira/doc/source/quickstart.rst
2021-03-03 01:15:37 +01:00

147 lines
3.8 KiB
ReStructuredText

Quick start: install larigira on Debian buster
==============================================
This guides have this assumptions or conventions:
* you have a Debian buster installation
- actually 99% of this should work in any distro with recent-enough python3 and systemd
- if you don't like systemd, you are free to use any other service manager; larigira integrates nicely with systemd, but has no requirement at all on it.
* you have a non-root main user, which we'll call ``radio``
* all commands are meant to be run as root. Use ``sudo -i`` if you don't have root password
Install
-----------
Let's start!::
apt-get install python3 python3-dev virtualenv mpd
virtualenv -p /usr/bin/python3 /opt/larigira/
/opt/larigira/bin/pip3 install larigira
touch /etc/default/larigira
mkdir -p /home/radio/.mpd/ /etc/larigira/ /var/log/larigira/
chown radio:adm /var/log/larigira/
touch /etc/systemd/system/larigira.service
Edit ``/etc/systemd/system/larigira.service`` and put this content::
[Unit]
Description=Radio Automation
After=mpd.service
[Service]
EnvironmentFile=/etc/default/larigira
User=radio
ExecStart=/opt/larigira/bin/larigira
[Install]
WantedBy=multi-user.target
Now let's edit ``/etc/mpd.conf``::
music_directory "/home/radio/Music/"
playlist_directory "/home/radio/.mpd/playlists"
db_file "/home/radio/.mpd/tag_cache"
log_file "syslog"
pid_file "/home/radio/.mpd/pid"
state_file "/home/radio/.mpd/state"
sticker_file "/home/radio/.mpd/sticker.sql"
user "radio"
bind_to_address "/home/radio/.mpd/socket"
bind_to_address "127.0.0.1"
port "6600"
log_level "default"
replaygain "track"
replaygain_limit "yes"
volume_normalization "yes"
max_connections "30"
Now let's edit larigira settings, editing the file ``/etc/default/larigira``::
MPD_HOST=/home/radio/.mpd/socket
LARIGIRA_DEBUG=false
LARIGIRA_LOG_CONFIG=/etc/larigira/logging.ini
LARIGIRA_EVENT_FILTERS='["percentwait"]'
LARIGIRA_EF_MAXWAIT_PERC=400
LARIGIRA_SECRET_KEY="changeme"
Let's include logging configuration, editing ``/etc/larigira/logging.ini``::
[loggers]
keys=root
[formatters]
keys=brief,ext,debug
[handlers]
keys=syslog,own,owndebug,ownerr
[logger_root]
handlers=syslog,own,owndebug,ownerr
level=DEBUG
[handler_syslog]
class=handlers.SysLogHandler
level=INFO
args=('/dev/log', handlers.SysLogHandler.LOG_USER)
formatter=brief
[handler_own]
class=handlers.WatchedFileHandler
level=INFO
args=('/var/log/larigira/larigira.log',)
formatter=ext
[handler_owndebug]
class=handlers.WatchedFileHandler
level=DEBUG
args=('/var/log/larigira/larigira.debug',)
formatter=debug
[handler_ownerr]
class=handlers.WatchedFileHandler
level=ERROR
args=('/var/log/larigira/larigira.err',)
formatter=ext
[formatter_ext]
format=%(asctime)s|%(levelname)s[%(name)s] %(message)s
[formatter_debug]
format=%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s
[formatter_brief]
format=%(levelname)s:%(message)s
For hygiene's sake, let's configure rotation for this log, editing ``/etc/logrotate.d/larigira``::
/var/log/larigira/*.err
/var/log/larigira/*.log {
daily
missingok
rotate 14
compress
notifempty
copytruncate
create 600
}
/var/log/larigira/*.debug {
daily
rotate 2
missingok
compress
notifempty
copytruncate
create 600
}
Restart everything::
systemctl daemon-reload
systemctl restart mpd
systemctl restart larigira
systemctl enable larigira
systemctl enable mpd
Everything should work now!