commit e9313101418d17095dc2a8fe1ff44be6601e7c14 Author: Paul Date: Thu Aug 13 04:47:48 2020 +0200 Port from monorepo diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..175e8be --- /dev/null +++ b/Dockerfile @@ -0,0 +1,67 @@ +FROM debian:buster +EXPOSE 6600 + +RUN \ + DEBIAN_FRONTEND=noninteractive \ + apt-get clean \ + && apt-get update \ + && apt-get install --no-install-recommends -qy \ + mpd mpc tmux bzip2 patch curl libyaml-dev git libopus-dev \ + build-essential zlib1g zlib1g-dev libssl-dev ruby \ + ruby-dev rubygems automake autoconf libtool psmisc \ + util-linux supervisor ca-certificates libogg-dev python-pip \ + ffmpeg cron \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /opt/musicbot/src + +RUN \ + git clone https://github.com/dafoxia/mumble-ruby.git \ + && git clone https://github.com/dafoxia/celt-ruby.git \ + && git clone https://github.com/dafoxia/opus-ruby.git \ + && git clone https://github.com/mumble-voip/celt-0.7.0.git celt \ + && git clone https://github.com/dafoxia/mumble-ruby-pluginbot.git \ + && (cd mumble-ruby-pluginbot && git checkout -b devel --track origin/devel) + +RUN rm /opt/musicbot/src/mumble-ruby-pluginbot/plugins/radiostream.rb + +WORKDIR /opt/musicbot/src/mumble-ruby + +RUN gem build mumble-ruby.gemspec +RUN gem install mumble-ruby-*.gem +RUN gem install ruby-mpd +RUN gem install crack + +WORKDIR /opt/musicbot/src/celt-ruby + +RUN gem build celt-ruby.gemspec +RUN gem install celt-ruby + +WORKDIR /opt/musicbot/src/celt + +RUN \ + ./autogen.sh &&\ + ./configure --prefix=/opt/musicbot/src/celt &&\ + make &&\ + make install + +WORKDIR /opt/musicbot/src/opus-ruby +RUN gem build opus-ruby.gemspec +RUN gem install opus-ruby +RUN pip install youtube-dl + +WORKDIR /opt/musicbot + +ADD conf/config.yml /opt/musicbot/src/mumble-ruby-pluginbot/config/config.yml +ADD conf/supervisord.conf /etc/supervisor/conf.d/ +ADD conf/mpd.conf /opt/musicbot/src/mumble-ruby-pluginbot/plugins/mpd.conf +ADD conf/crontab.txt /tmp/crontab.txt + +RUN chown -R daemon: /opt/musicbot +RUN chown daemon: /var/lib/mpd/music + +RUN crontab /tmp/crontab.txt + +ENTRYPOINT [ "supervisord" ] + diff --git a/conf/config.yml b/conf/config.yml new file mode 100644 index 0000000..5312783 --- /dev/null +++ b/conf/config.yml @@ -0,0 +1,60 @@ +--- +config: + version: 2.2 + +debug: false +language: en + +main: + remoteui: false + tempdir: "/opt/musicbot/temp/" + ducking: false + automute_if_alone: false + stop_on_unregistered: false + channel_notify: 0 + controllable: true + control: + string: "." + message: + private_only: false + registered_only: true + historysize: 20 + display: + comment: + set: true + user: + whitelisted: + superuser: + banned: + bound: + certfolder: "/opt/musicbot/certs/" + fifo: "/opt/musicbot/mpd.fifo" + logo: "../config/logo/logo.html" + timer: + ticks: 3600 + blacklisted_commands: "settings bind unbind reset restart blacklist ducking duckvol bitrate framesize debug gotobed wakeup follow unfollow stick unstick history automute file" + +mumble: + use_vbr: true + bitrate: 96000 + host: mumble.zom.bi + port: 64738 + name: musicbot + password: '' + channel: "Bots" + +plugin: + mpd: + volume: 40 + host: localhost + port: 6600 + musicfolder: "/var/lib/mpd/music/" + youtube: + youtube_dl: + path: "youtube-dl" + soundcloud: + youtube_dl: + path: "youtube-dl" + bandcamp: + youtube_dl: + path: "youtube-dl" diff --git a/conf/crontab.txt b/conf/crontab.txt new file mode 100644 index 0000000..ba65ffc --- /dev/null +++ b/conf/crontab.txt @@ -0,0 +1 @@ +0 9 * * * pip install -U youtube-dl >/dev/null 2>&1 diff --git a/conf/mpd.conf b/conf/mpd.conf new file mode 100644 index 0000000..245b279 --- /dev/null +++ b/conf/mpd.conf @@ -0,0 +1,27 @@ +music_directory "/var/lib/mpd/music" +playlist_directory "/var/lib/mpd/playlists" +db_file "/opt/musicbot/tag_cache" +log_file "/opt/musicbot/mpd.log" +pid_file "/opt/musicbot/pid" +state_file "/opt/musicbot/state" +sticker_file "/opt/musicbot/sticker.sql" +user "daemon" +bind_to_address "0.0.0.0" +port "6600" + +input { + plugin "curl" +} + +audio_output { + type "fifo" + name "FIFO-Bot1" + path "/opt/musicbot/mpd.fifo" + format "48000:16:2" + mixer_type "software" +} +filesystem_charset "UTF-8" +id3v1_encoding "UTF-8" +buffer_before_play "20%" +audio_buffer_size "20480" +max_output_buffer_size "32768" diff --git a/conf/supervisord.conf b/conf/supervisord.conf new file mode 100644 index 0000000..cbffd30 --- /dev/null +++ b/conf/supervisord.conf @@ -0,0 +1,17 @@ +[supervisord] +nodaemon=true + +[program:mpd] +user = daemon +command = mpd --no-daemon /opt/musicbot/mpd.conf + +[program:ruby] +user = daemon +command = ruby pluginbot.rb --config=/opt/musicbot/config.yml +environment = LD_LIBRARY_PATH=/opt/musicbot/src/celt/lib/ +directory = /opt/musicbot/src/mumble-ruby-pluginbot/core + +[program:cron] +command = cron -f -L 1 +autostart=true +autorestart=true \ No newline at end of file