123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- 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 build-essential virtualenv mpd mpc libxml2-dev libxslt1-dev zlib1g-dev
- virtualenv -p /usr/bin/python3 /opt/larigira/
- /opt/larigira/bin/pip3 install --no-binary :all: larigira
- touch /etc/default/larigira
- mkdir -p /home/radio/.mpd/ /etc/larigira/ /var/log/larigira/
- chown radio. /home/radio/.mpd/
- 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]
- Type=notify
- NotifyAccess=all
- EnvironmentFile=/etc/default/larigira
- User=radio
- ExecStart=/opt/larigira/bin/larigira
- Restart=always
- [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_MPD_ENFORCE_ALWAYS_PLAYING=1
- LARIGIRA_SECRET_KEY="changeme with a random, secret string of any length"
- 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!
|