quickstart.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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
  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_SECRET_KEY="changeme with a random, secret string of any length"
  57. Let's include logging configuration, editing ``/etc/larigira/logging.ini``::
  58. [loggers]
  59. keys=root
  60. [formatters]
  61. keys=brief,ext,debug
  62. [handlers]
  63. keys=syslog,own,owndebug,ownerr
  64. [logger_root]
  65. handlers=syslog,own,owndebug,ownerr
  66. level=DEBUG
  67. [handler_syslog]
  68. class=handlers.SysLogHandler
  69. level=INFO
  70. args=('/dev/log', handlers.SysLogHandler.LOG_USER)
  71. formatter=brief
  72. [handler_own]
  73. class=handlers.WatchedFileHandler
  74. level=INFO
  75. args=('/var/log/larigira/larigira.log',)
  76. formatter=ext
  77. [handler_owndebug]
  78. class=handlers.WatchedFileHandler
  79. level=DEBUG
  80. args=('/var/log/larigira/larigira.debug',)
  81. formatter=debug
  82. [handler_ownerr]
  83. class=handlers.WatchedFileHandler
  84. level=ERROR
  85. args=('/var/log/larigira/larigira.err',)
  86. formatter=ext
  87. [formatter_ext]
  88. format=%(asctime)s|%(levelname)s[%(name)s] %(message)s
  89. [formatter_debug]
  90. format=%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s
  91. [formatter_brief]
  92. format=%(levelname)s:%(message)s
  93. For hygiene's sake, let's configure rotation for this log, editing ``/etc/logrotate.d/larigira``::
  94. /var/log/larigira/*.err
  95. /var/log/larigira/*.log {
  96. daily
  97. missingok
  98. rotate 14
  99. compress
  100. notifempty
  101. copytruncate
  102. create 600
  103. }
  104. /var/log/larigira/*.debug {
  105. daily
  106. rotate 2
  107. missingok
  108. compress
  109. notifempty
  110. copytruncate
  111. create 600
  112. }
  113. Restart everything::
  114. systemctl daemon-reload
  115. systemctl restart mpd
  116. systemctl restart larigira
  117. systemctl enable larigira
  118. systemctl enable mpd
  119. Everything should work now!