quickstart.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 virtualenv mpd
  13. virtualenv -p /usr/bin/python3 /opt/larigira/
  14. /opt/larigira/bin/pip3 install larigira
  15. touch /etc/default/larigira
  16. mkdir -p /home/radio/.mpd/ /etc/larigira/ /var/log/larigira/
  17. chown radio:adm /var/log/larigira/
  18. touch /etc/systemd/system/larigira.service
  19. Edit ``/etc/systemd/system/larigira.service`` and put this content::
  20. [Unit]
  21. Description=Radio Automation
  22. After=mpd.service
  23. [Service]
  24. EnvironmentFile=/etc/default/larigira
  25. User=radio
  26. ExecStart=/opt/larigira/bin/larigira
  27. [Install]
  28. WantedBy=multi-user.target
  29. Now let's edit ``/etc/mpd.conf``::
  30. music_directory "/home/radio/Music/"
  31. playlist_directory "/home/radio/.mpd/playlists"
  32. db_file "/home/radio/.mpd/tag_cache"
  33. log_file "syslog"
  34. pid_file "/home/radio/.mpd/pid"
  35. state_file "/home/radio/.mpd/state"
  36. sticker_file "/home/radio/.mpd/sticker.sql"
  37. user "radio"
  38. bind_to_address "/home/radio/.mpd/socket"
  39. bind_to_address "127.0.0.1"
  40. port "6600"
  41. log_level "default"
  42. replaygain "track"
  43. replaygain_limit "yes"
  44. volume_normalization "yes"
  45. max_connections "30"
  46. Now let's edit larigira settings, editing the file ``/etc/default/larigira``::
  47. MPD_HOST=/home/radio/.mpd/socket
  48. LARIGIRA_DEBUG=false
  49. LARIGIRA_LOG_CONFIG=/etc/larigira/logging.ini
  50. LARIGIRA_EVENT_FILTERS='["percentwait"]'
  51. LARIGIRA_EF_MAXWAIT_PERC=400
  52. LARIGIRA_SECRET_KEY="changeme"
  53. Let's include logging configuration, editing ``/etc/larigira/logging.ini``::
  54. [loggers]
  55. keys=root
  56. [formatters]
  57. keys=brief,ext,debug
  58. [handlers]
  59. keys=syslog,own,owndebug,ownerr
  60. [logger_root]
  61. handlers=syslog,own,owndebug,ownerr
  62. level=DEBUG
  63. [handler_syslog]
  64. class=handlers.SysLogHandler
  65. level=INFO
  66. args=('/dev/log', handlers.SysLogHandler.LOG_USER)
  67. formatter=brief
  68. [handler_own]
  69. class=handlers.WatchedFileHandler
  70. level=INFO
  71. args=('/var/log/larigira/larigira.log',)
  72. formatter=ext
  73. [handler_owndebug]
  74. class=handlers.WatchedFileHandler
  75. level=DEBUG
  76. args=('/var/log/larigira/larigira.debug',)
  77. formatter=debug
  78. [handler_ownerr]
  79. class=handlers.WatchedFileHandler
  80. level=ERROR
  81. args=('/var/log/larigira/larigira.err',)
  82. formatter=ext
  83. [formatter_ext]
  84. format=%(asctime)s|%(levelname)s[%(name)s] %(message)s
  85. [formatter_debug]
  86. format=%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s
  87. [formatter_brief]
  88. format=%(levelname)s:%(message)s
  89. For hygiene's sake, let's configure rotation for this log, editing ``/etc/logrotate.d/larigira``::
  90. /var/log/larigira/*.err
  91. /var/log/larigira/*.log {
  92. daily
  93. missingok
  94. rotate 14
  95. compress
  96. notifempty
  97. copytruncate
  98. create 600
  99. }
  100. /var/log/larigira/*.debug {
  101. daily
  102. rotate 2
  103. missingok
  104. compress
  105. notifempty
  106. copytruncate
  107. create 600
  108. }
  109. Restart everything::
  110. systemctl daemon-reload
  111. systemctl restart mpd
  112. systemctl restart larigira
  113. systemctl enable larigira
  114. systemctl enable mpd
  115. Everything should work now!