quickstart.rst 3.8 KB

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