miles преди 2 години
родител
ревизия
cb0e4d4187
променени са 11 файла, в които са добавени 556 реда и са изтрити 1 реда
  1. 5 0
      .env
  2. 5 0
      .gitignore
  3. 55 0
      Dockerfile
  4. 32 1
      README.md
  5. 275 0
      config/mopidy/mopidy.conf
  6. 0 0
      config/mopidy/podcast/.gitkeep
  7. 0 0
      config/snapserver/.gitkeep
  8. 1 0
      config/snapserver/server.json
  9. 143 0
      db_config/custom.cnf
  10. 40 0
      docker-compose.yaml
  11. 0 0
      music/.gitkeep

+ 5 - 0
.env

@@ -0,0 +1,5 @@
+MYSQL_ROOT_PASSWORD=b4FUk4mF>3As3bB
+MYSQL_DATABASE=romprdb
+MYSQL_USER=rompr
+MYSQL_PASSWORD=romprdbpass
+

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+/config/mopidy/podcast/*
+/config/mopidy/snapserver/*
+!/db_config/custom.cnf
+/music/*
+!.gitkeep

+ 55 - 0
Dockerfile

@@ -0,0 +1,55 @@
+FROM debian:10
+RUN export DEBIAN_FRONTEND=noninteractive && \
+    apt-get update && \
+    apt-get upgrade -y && \
+    apt-get install -y apt-utils && \
+    apt-get install -y \
+       build-essential \
+       gettext \
+       openssl \
+       software-properties-common \
+       apt-transport-https \
+       wget \
+       curl \
+       cron \
+       gnupg2 \
+       python3 \
+       python3-pip
+#RUN curl -k "https://apt.mopidy.com/mopidy.gpg" | apt-key add -
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78FD980E271D2943
+#RUN curl -k "https://apt.mopidy.com/buster.list" > /etc/apt/sources.list.d/mopidy.list
+RUN echo "deb https://apt.mopidy.com/ buster main contrib non-free\ndeb-src https://apt.mopidy.com/ buster main contrib non-free" > /etc/apt/sources.list.d/mopidy.list
+RUN apt-get update && \
+    apt-get install -y \
+       mopidy \
+       mopidy-local \
+       mopidy-local-sqlite \
+       mopidy-mpd \
+       mopidy-podcast \
+       mopidy-podcast-itunes \
+       mopidy-scrobbler \
+       mopidy-somafm \
+       mopidy-soundcloud \
+       mopidy-spotify \
+       mopidy-tunein
+RUN python3 -m pip install Mopidy-Iris
+RUN python3 -m pip install Mopidy-Bandcamp
+RUN mkdir -p /data/music
+RUN apt-get -y -f install \
+      libavahi-client3 \
+      libavahi-common3 \
+      libsoxr0 
+
+RUN wget -O /tmp/snapserver_amd64.deb "https://github.com/badaix/snapcast/releases/download/v0.26.0/snapserver_0.26.0-1_amd64.deb"
+RUN cd /tmp && dpkg -i snapserver_amd64.deb
+RUN apt-get -y -f install
+
+RUN echo "*/30 * * * * mopidy /bin/bash mopidy local scan" > /etc/cron.d/mopidy-scan
+RUN chmod 0644 /etc/cron.d/mopidy-scan
+
+EXPOSE 6680 6600 1704 1705 1780
+
+RUN echo "/bin/bash\nset -m\nsnapserver &\n/usr/bin/mopidy\nfg %1" > ./start.sh
+RUN chmod +x ./start.sh
+CMD ./start.sh
+

+ 32 - 1
README.md

@@ -1,3 +1,34 @@
 # docker-mopidy
 
-Mopidy (server and clients: Iris, Rompr + MariaDB) + Snapserver on docker-compose
+Mopidy (server and clients: Iris, Rompr + MariaDB) + Snapserver on docker-compose
+
+## Configure
+
+- Change .env file
+
+- Change ./config/mopidy/mopidy.conf (optional)
+
+- Put music into ./music/ directory
+
+## Run
+
+- Run with `docker-compose up`
+
+- Open localhost:80 for Rompr client and connect to Mopidy (Mopidy hostname = `mopidy`; MySQL hostname = 'mysql') or open `localhost:6680/iris/` for Iris client
+
+## Troubleshouting
+
+- If Rompr does not start because MySQL error double check if exists inside ./db_config/mysql.cnf file:
+
+```
+[mysqld]
+#mmi
+log_bin_trust_function_creators = true
+```
+
+- If Mopidy does not work with Snapserver double check if exists indise ./config/mopidy/mopidy.conf:
+
+```
+[audio]
+output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo
+```

+ 275 - 0
config/mopidy/mopidy.conf

@@ -0,0 +1,275 @@
+# For further information about options in this file see:
+#   https://docs.mopidy.com/
+#
+# The initial commented out values reflect the defaults as of:
+#   Mopidy 3.3.0
+#   Mopidy-Bandcamp 1.1.5
+#   Mopidy-File 3.3.0
+#   Mopidy-HTTP 3.3.0
+#   Mopidy-Iris 3.64.0
+#   Mopidy-Local 3.2.1
+#   Mopidy-M3U 3.3.0
+#   Mopidy-MPD 3.3.0
+#   Mopidy-Podcast 3.0.1
+#   Mopidy-Podcast-iTunes 3.0.1
+#   Mopidy-Scrobbler 2.0.1
+#   Mopidy-SoftwareMixer 3.3.0
+#   Mopidy-SomaFM 2.0.2
+#   Mopidy-SoundCloud 3.0.1
+#   Mopidy-Spotify 4.1.1
+#   Mopidy-Stream 3.3.0
+#   Mopidy-TuneIn 1.1.0
+#
+# Available options and defaults might have changed since then,
+# run `mopidy config` to see the current effective config and
+# `mopidy --version` to check the current version.
+
+[core]
+#cache_dir = $XDG_CACHE_DIR/mopidy
+#config_dir = $XDG_CONFIG_DIR/mopidy
+#data_dir = $XDG_DATA_DIR/mopidy
+#max_tracklist_length = 10000
+#restore_state = false
+
+[logging]
+#verbosity = 0
+#format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
+#color = true
+#config_file = 
+
+#mmi 20220712
+[audio]
+output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo
+
+
+#[audio]
+#mixer = software
+#mixer_volume = 
+#output = autoaudiosink
+#buffer_time = 
+
+[proxy]
+#scheme = 
+#hostname = 
+#port = 
+#username = 
+#password = 
+
+[iris]
+#enabled = true
+#country = NZ
+#locale = en_NZ
+#verify_certificates = true
+#snapcast_enabled = true
+#snapcast_host = localhost
+#snapcast_port = 1780
+#snapcast_ssl = false
+#snapcast_stream = Default
+#spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
+#lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
+#genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
+#data_dir = $XDG_DATA_DIR/iris
+
+[bandcamp]
+#enabled = true
+#discover_pages = 1
+#collection_items = 50
+#discover_genres = 
+#  All
+#  Electronic
+#  Rock
+#  Metal
+#  Alternative
+#  Hip-Hop/Rap
+#  Experimental
+#  Punk
+#  Folk
+#  Pop
+#  Ambient
+#  Soundtrack
+#  World
+#  Jazz
+#  Acoustic
+#  Funk
+#  R&B/Soul
+#  Devotional
+#  Classical
+#  Reggae
+#  Podcasts
+#  Country
+#  Spoken Word
+#  Comedy
+#  Blues
+#  Kids
+#  Audiobooks
+#  Latin
+#discover_tags = 
+#  Outrun
+#  Future Funk
+#  Alternative Hip-Hop
+#  Tokyo, Japan
+#image_sizes = 
+#  10
+#  5
+#  2
+#identity = 
+
+[file]
+enabled = true
+media_dirs = /data/music/
+#  $XDG_MUSIC_DIR|Music
+#  ~/|Home
+#excluded_file_extensions = 
+#  .directory
+#  .html
+#  .jpeg
+#  .jpg
+#  .log
+#  .nfo
+#  .pdf
+#  .png
+#  .txt
+#  .zip
+#show_dotfiles = false
+#follow_symlinks = false
+#metadata_timeout = 1000
+
+[http]
+enabled = true
+hostname = 0.0.0.0
+#port = 6680
+#zeroconf = Mopidy HTTP server on $hostname
+#allowed_origins = 
+#csrf_protection = true
+#default_app = mopidy
+
+[m3u]
+#enabled = true
+#base_dir = 
+#default_encoding = latin-1
+#default_extension = .m3u8
+#playlists_dir = 
+
+[softwaremixer]
+#enabled = true
+
+[stream]
+enabled = true
+protocols = 
+  http
+  https
+  mms
+  rtmp
+  rtmps
+  rtsp
+#metadata_blacklist = 
+timeout = 5000
+
+[tunein]
+enabled = true
+timeout = 5000
+#filter = 
+
+[spotify]
+enabled = false
+#username = 
+#password = 
+#client_id = 
+#client_secret = 
+#bitrate = 160
+#volume_normalization = true
+#private_session = false
+#timeout = 10
+#allow_cache = true
+#allow_network = true
+#allow_playlists = true
+#search_album_count = 20
+#search_artist_count = 10
+#search_track_count = 50
+#toplist_countries = 
+
+[soundcloud]
+enabled = false
+#explore_songs = 25
+#auth_token = 
+
+[somafm]
+enabled = true
+encoding = mp3
+#quality = fast
+#dj_as_artist = true
+
+[scrobbler]
+enabled = false
+#username = 
+#password = 
+
+[podcast]
+enabled = true
+#browse_root = Podcasts.opml
+#browse_order = desc
+#lookup_order = asc
+#cache_size = 64
+#cache_ttl = 86400
+#timeout = 10
+
+[podcast-itunes]
+enabled = true
+#base_url = http://itunes.apple.com/
+#country = US
+#explicit = 
+#charts = audioPodcasts
+#charts_limit = 20
+#search_limit = 20
+#timeout = 10
+#retries = 3
+
+[mpd]
+enabled = true
+hostname = 0.0.0.0
+port = 6600
+#password = 
+#max_connections = 20
+connection_timeout = 120
+#zeroconf = Mopidy MPD server on $hostname
+#command_blacklist = 
+#  listall
+#  listallinfo
+#default_playlist_scheme = m3u
+
+[local]
+enabled = true
+#max_search_results = 100
+media_dir = /data/music/
+#scan_timeout = 1000
+#scan_flush_threshold = 100
+#scan_follow_symlinks = false
+#included_file_extensions = 
+#excluded_file_extensions = 
+#  .cue
+#  .directory
+#  .html
+#  .jpeg
+#  .jpg
+#  .log
+#  .nfo
+#  .pdf
+#  .png
+#  .txt
+#  .zip
+#directories = 
+#  Albums                  local:directory?type=album
+#  Artists                 local:directory?type=artist
+#  Composers               local:directory?type=artist&role=composer
+#  Genres                  local:directory?type=genre
+#  Performers              local:directory?type=artist&role=performer
+#  Release Years           local:directory?type=date&format=%25Y
+#  Tracks                  local:directory?type=track
+#  Last Week's Updates     local:directory?max-age=604800
+#  Last Month's Updates    local:directory?max-age=2592000
+#timeout = 10
+#use_artist_sortname = false
+#album_art_files = 
+#  *.jpg
+#  *.jpeg
+#  *.png

+ 0 - 0
config/mopidy/podcast/.gitkeep


+ 0 - 0
config/snapserver/.gitkeep


+ 1 - 0
config/snapserver/server.json

@@ -0,0 +1 @@
+{"ConfigVersion":2,"Groups":[{"clients":[{"config":{"instance":1,"latency":0,"name":"","volume":{"muted":false,"percent":100}},"connected":true,"host":{"arch":"web","ip":"172.18.0.1","mac":"00:00:00:00:00:00","name":"Snapweb client","os":"Linux x86_64"},"id":"46c21a87-dd1b-4760-8767-c7e8bf6d56e8","lastSeen":{"sec":1657805614,"usec":181323},"snapclient":{"name":"Snapweb","protocolVersion":2,"version":"0.1.0"}}],"id":"d9696830-54f1-e2b3-891a-38e7860be4d2","muted":false,"name":"","stream_id":"default"}]}

+ 143 - 0
db_config/custom.cnf

@@ -0,0 +1,143 @@
+## custom configuration file, please be aware that changing options here may break things
+
+[mysqld_safe]
+nice		= 0
+
+[mysqld]
+#mmi
+log_bin_trust_function_creators = true
+character-set-server	= utf8
+max_connections		= 100
+connect_timeout		= 5
+wait_timeout		= 600
+max_allowed_packet	= 16M
+thread_cache_size       = 128
+sort_buffer_size	= 4M
+bulk_insert_buffer_size	= 16M
+tmp_table_size		= 32M
+max_heap_table_size	= 32M
+binlog_format=mixed
+#
+# * MyISAM
+#
+# This replaces the startup script and checks MyISAM tables if needed
+# the first time they are touched. On error, make copy and try a repair.
+myisam_recover_options = BACKUP
+key_buffer_size		= 128M
+#open-files-limit	= 2000
+table_open_cache	= 400
+myisam_sort_buffer_size	= 512M
+concurrent_insert	= 2
+read_buffer_size	= 2M
+read_rnd_buffer_size	= 1M
+#
+# * Query Cache Configuration
+#
+# Cache only tiny result sets, so we can fit more in the query cache.
+query_cache_limit		= 128K
+query_cache_size		= 64M
+# for more write intensive setups, set to DEMAND or OFF
+#query_cache_type		= DEMAND
+#
+# * Logging and Replication
+#
+# Both location gets rotated by the cronjob.
+# Be aware that this log type is a performance killer.
+# As of 5.1 you can enable the log at runtime!
+#general_log_file        = /config/log/mysql/mysql.log
+#general_log             = 1
+#
+# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
+#
+# we do want to know about network errors and such
+log_warnings		= 2
+#
+# Enable the slow query log to see queries with especially long duration
+#slow_query_log[={0|1}]
+slow_query_log_file	= /config/log/mysql/mariadb-slow.log
+long_query_time = 10
+#log_slow_rate_limit	= 1000
+log_slow_verbosity	= query_plan
+
+#log-queries-not-using-indexes
+#log_slow_admin_statements
+#
+# The following can be used as easy to replay backup logs or for replication.
+# note: if you are setting up a replication slave, see README.Debian about
+#       other settings you may need to change.
+#server-id		= 1
+#report_host		= master1
+#auto_increment_increment = 2
+#auto_increment_offset	= 1
+log_bin			= /config/log/mysql/mariadb-bin
+log_bin_index		= /config/log/mysql/mariadb-bin.index
+# not fab for performance, but safer
+#sync_binlog		= 1
+expire_logs_days	= 10
+max_binlog_size         = 100M
+# slaves
+#relay_log		= /config/log/mysql/relay-bin
+#relay_log_index	= /config/log/mysql/relay-bin.index
+#relay_log_info_file	= /config/log/mysql/relay-bin.info
+#log_slave_updates
+#read_only
+#
+# If applications support it, this stricter sql_mode prevents some
+# mistakes like inserting invalid dates etc.
+#sql_mode		= NO_ENGINE_SUBSTITUTION,TRADITIONAL
+#
+# * InnoDB
+#
+# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
+# Read the manual for more InnoDB related options. There are many!
+default_storage_engine	= InnoDB
+# you can't just change log file size, requires special procedure
+#innodb_log_file_size	= 50M
+innodb_buffer_pool_size	= 256M
+innodb_log_buffer_size	= 8M
+innodb_file_per_table	= 1
+innodb_open_files	= 400
+innodb_io_capacity	= 400
+innodb_flush_method	= O_DIRECT
+#
+# * Security Features
+#
+# Read the manual, too, if you want chroot!
+# chroot = /var/lib/mysql/
+#
+# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
+#
+# ssl-ca=/etc/mysql/cacert.pem
+# ssl-cert=/etc/mysql/server-cert.pem
+# ssl-key=/etc/mysql/server-key.pem
+
+#
+# * Galera-related settings
+#
+[galera]
+# Mandatory settings
+#wsrep_on=ON
+#wsrep_provider=
+#wsrep_cluster_address=
+#binlog_format=row
+#default_storage_engine=InnoDB
+#innodb_autoinc_lock_mode=2
+#
+# Allow server to accept connections on all interfaces.
+#
+#bind-address=0.0.0.0
+#
+# Optional setting
+#wsrep_slave_threads=1
+#innodb_flush_log_at_trx_commit=0
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet	= 16M
+
+[mysql]
+#no-auto-rehash	# faster start of mysql but no tab completion
+
+[isamchk]
+key_buffer_size		= 16M

+ 40 - 0
docker-compose.yaml

@@ -0,0 +1,40 @@
+    version: "3"
+    services:
+      mopidy:
+#        image: rawdlite/mopidy
+        build: .
+        container_name: mopidy
+        devices:
+          - "/dev/snd"
+        ports:
+          - "6600:6600"
+          - "6680:6680"
+          - "1704:1704"
+          - "1705:1705"
+          - "1780:1780"
+        restart: always
+        volumes:
+          - ./config/:/root/.config/
+          - ./music/:/data/music/
+      mysql:
+        image: linuxserver/mariadb
+        restart: unless-stopped
+        container_name: mysql
+        environment:
+          - PUID=1000
+          - PGID=1000
+          - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
+          - TZ=Europe/Warsaw
+          - MYSQL_DATABASE=${MYSQL_DATABASE}
+          - MYSQL_USER=${MYSQL_USER}
+          - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+        volumes:
+          - ./db_config:/config
+        ports:
+          - "3306:3306"
+      rompr:
+        image: rawdlite/rompr
+        container_name: rompr
+        restart: always
+        ports:
+          - "80:80"

+ 0 - 0
music/.gitkeep