quickstart.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. Quick start: install larigira on Debian buster
  2. ==============================================
  3. This guides have this assumptions or conventions:
  4. * you have a Debian buster installation
  5. - actually 99% of this should work in any distro with recent-enough python3 and systemd
  6. - 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.
  7. * you have a non-root main user, which we'll call ``radio``
  8. * all commands are meant to be run as root. Use ``sudo -i`` if you don't have root password
  9. Install
  10. -----------
  11. Let's start!::
  12. apt-get install python3 python3-dev build-essential virtualenv mpd mpc libxml2-dev libxslt1-dev zlib1g-dev
  13. virtualenv -p /usr/bin/python3 /opt/larigira/
  14. /opt/larigira/bin/pip3 install --no-binary :all: larigira
  15. touch /etc/default/larigira
  16. mkdir -p /home/radio/.mpd/ /etc/larigira/ /var/log/larigira/
  17. chown radio. /home/radio/.mpd/
  18. chown radio:adm /var/log/larigira/
  19. touch /etc/systemd/system/larigira.service
  20. Edit ``/etc/systemd/system/larigira.service`` and put this content::
  21. [Unit]
  22. Description=Radio Automation
  23. After=mpd.service
  24. [Service]
  25. Type=notify
  26. NotifyAccess=all
  27. EnvironmentFile=/etc/default/larigira
  28. User=radio
  29. ExecStart=/opt/larigira/bin/larigira
  30. Restart=always
  31. [Install]
  32. WantedBy=multi-user.target
  33. Now let's edit ``/etc/mpd.conf``::
  34. music_directory "/home/radio/Music/"
  35. playlist_directory "/home/radio/.mpd/playlists"
  36. db_file "/home/radio/.mpd/tag_cache"
  37. log_file "syslog"
  38. pid_file "/home/radio/.mpd/pid"
  39. state_file "/home/radio/.mpd/state"
  40. sticker_file "/home/radio/.mpd/sticker.sql"
  41. user "radio"
  42. bind_to_address "/home/radio/.mpd/socket"
  43. bind_to_address "127.0.0.1"
  44. port "6600"
  45. log_level "default"
  46. replaygain "track"
  47. replaygain_limit "yes"
  48. volume_normalization "yes"
  49. max_connections "30"
  50. Now let's edit larigira settings, editing the file ``/etc/default/larigira``::
  51. MPD_HOST=/home/radio/.mpd/socket
  52. LARIGIRA_DEBUG=false
  53. LARIGIRA_LOG_CONFIG=/etc/larigira/logging.ini
  54. LARIGIRA_EVENT_FILTERS='["percentwait"]'
  55. LARIGIRA_EF_MAXWAIT_PERC=400
  56. LARIGIRA_MPD_ENFORCE_ALWAYS_PLAYING=1
  57. LARIGIRA_SECRET_KEY="changeme with a random, secret string of any length"
  58. Let's include logging configuration, editing ``/etc/larigira/logging.ini``::
  59. [loggers]
  60. keys=root
  61. [formatters]
  62. keys=brief,ext,debug
  63. [handlers]
  64. keys=syslog,own,owndebug,ownerr
  65. [logger_root]
  66. handlers=syslog,own,owndebug,ownerr
  67. level=DEBUG
  68. [handler_syslog]
  69. class=handlers.SysLogHandler
  70. level=INFO
  71. args=('/dev/log', handlers.SysLogHandler.LOG_USER)
  72. formatter=brief
  73. [handler_own]
  74. class=handlers.WatchedFileHandler
  75. level=INFO
  76. args=('/var/log/larigira/larigira.log',)
  77. formatter=ext
  78. [handler_owndebug]
  79. class=handlers.WatchedFileHandler
  80. level=DEBUG
  81. args=('/var/log/larigira/larigira.debug',)
  82. formatter=debug
  83. [handler_ownerr]
  84. class=handlers.WatchedFileHandler
  85. level=ERROR
  86. args=('/var/log/larigira/larigira.err',)
  87. formatter=ext
  88. [formatter_ext]
  89. format=%(asctime)s|%(levelname)s[%(name)s] %(message)s
  90. [formatter_debug]
  91. format=%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s
  92. [formatter_brief]
  93. format=%(levelname)s:%(message)s
  94. For hygiene's sake, let's configure rotation for this log, editing ``/etc/logrotate.d/larigira``::
  95. /var/log/larigira/*.err
  96. /var/log/larigira/*.log {
  97. daily
  98. missingok
  99. rotate 14
  100. compress
  101. notifempty
  102. copytruncate
  103. create 600
  104. }
  105. /var/log/larigira/*.debug {
  106. daily
  107. rotate 2
  108. missingok
  109. compress
  110. notifempty
  111. copytruncate
  112. create 600
  113. }
  114. Restart everything::
  115. systemctl daemon-reload
  116. systemctl restart mpd
  117. systemctl restart larigira
  118. systemctl enable larigira
  119. systemctl enable mpd
  120. Everything should work now!