diff --git a/docker/jukebox.Dockerfile b/docker/Dockerfile.jukebox similarity index 67% rename from docker/jukebox.Dockerfile rename to docker/Dockerfile.jukebox index 0936f5d46..3d63a4a02 100644 --- a/docker/jukebox.Dockerfile +++ b/docker/Dockerfile.jukebox @@ -1,3 +1,4 @@ +FROM libzmq:local as libzmq FROM debian:bullseye-slim # These are only dependencies that are required to get as close to the @@ -6,8 +7,7 @@ RUN apt-get update && apt-get install -y \ libasound2-dev \ pulseaudio \ pulseaudio-utils \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* + --no-install-recommends ARG UID ARG USER @@ -21,7 +21,7 @@ RUN usermod -aG pulse ${USER} # Install all Jukebox dependencies RUN apt-get update && apt-get install -qq -y \ --allow-downgrades --allow-remove-essential --allow-change-held-packages \ - g++ at wget \ + build-essential at wget \ espeak mpc mpg123 git ffmpeg spi-tools netcat \ python3 python3-venv python3-dev python3-mutagen @@ -37,21 +37,14 @@ ENV VIRTUAL_ENV=${INSTALLATION_PATH}/.venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" - +# Install all Python dependencies RUN pip install --no-cache-dir -r ${INSTALLATION_PATH}/requirements.txt -ENV ZMQ_TMP_DIR libzmq -ENV ZMQ_VERSION 4.3.5 -ENV ZMQ_PREFIX /usr/local - -RUN [ "$(uname -m)" = "aarch64" ] && ARCH="arm64" || ARCH="$(uname -m)"; \ - wget https://github.com/pabera/libzmq/releases/download/v${ZMQ_VERSION}/libzmq5-${ARCH}-${ZMQ_VERSION}.tar.gz -O libzmq.tar.gz; \ - tar -xzf libzmq.tar.gz -C ${ZMQ_PREFIX}; \ - rm -f libzmq.tar.gz; - -RUN export ZMQ_PREFIX=${PREFIX} && export ZMQ_DRAFT_API=1 -RUN pip install -v --no-binary pyzmq pyzmq +# Install pyzmq Python dependency separately +ENV ZMQ_PREFIX /opt/libzmq +ENV ZMQ_DRAFT_API 1 +COPY --from=libzmq ${ZMQ_PREFIX} ${ZMQ_PREFIX} +RUN pip install -v pyzmq --no-binary pyzmq EXPOSE 5555 5556 - WORKDIR ${INSTALLATION_PATH}/src/jukebox diff --git a/docker/Dockerfile.libzmq b/docker/Dockerfile.libzmq new file mode 100644 index 000000000..78cf52368 --- /dev/null +++ b/docker/Dockerfile.libzmq @@ -0,0 +1,25 @@ +FROM debian:bullseye-slim + +# Install necessary build dependencies +RUN apt-get update && apt-get install -y \ + build-essential wget tar + +# Define environment variables for libzmq +ENV ZMQ_VERSION 4.3.5 +ENV ZMQ_PREFIX /opt/libzmq + +# Download, compile, and install libzmq +RUN mkdir -p ${ZMQ_PREFIX}; \ + wget https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}/zeromq-${ZMQ_VERSION}.tar.gz -O libzmq.tar.gz; \ + tar -xzf libzmq.tar.gz; \ + cd zeromq-${ZMQ_VERSION}; \ + ./configure --prefix=${ZMQ_PREFIX} --enable-drafts; \ + make -j$(nproc) && make install + +# Cleanup unnecessary files +RUN rm -rf /zeromq-${ZMQ_VERSION} libzmq.tar.gz + +# Create final image with only the libzmq build fragments +FROM scratch +ENV ZMQ_PREFIX /opt/libzmq +COPY --from=0 ${ZMQ_PREFIX} ${ZMQ_PREFIX} diff --git a/docker/mpd.Dockerfile b/docker/Dockerfile.mpd similarity index 100% rename from docker/mpd.Dockerfile rename to docker/Dockerfile.mpd diff --git a/docker/webapp.Dockerfile b/docker/Dockerfile.webapp similarity index 100% rename from docker/webapp.Dockerfile rename to docker/Dockerfile.webapp diff --git a/docker/config/docker.mpd.conf b/docker/config/docker.mpd.conf index 4ec64890e..ad7713d0d 100644 --- a/docker/config/docker.mpd.conf +++ b/docker/config/docker.mpd.conf @@ -11,7 +11,7 @@ # be disabled and audio files will only be accepted over ipc socket (using # file:// protocol) or streaming files over an accepted protocol. # -music_directory "/home/pi/RPi-Jukebox-RFID/shared/audiofolders" +music_directory "~/RPi-Jukebox-RFID/shared/audiofolders" # # This setting sets the MPD internal playlist directory. The purpose of this # directory is storage for playlists created by MPD. The server will use @@ -67,7 +67,7 @@ sticker_file "~/.config/mpd/sticker.sql" # initialization. This setting is disabled by default and MPD is run as the # current user. # -user "root" +# user "root" # # This setting specifies the group that MPD will run as. If not specified # primary group of user specified with "user" setting will be used (if set). @@ -225,6 +225,10 @@ decoder { # gapless "no" } +decoder { + plugin "wildmidi" + enabled "no" +} # ############################################################################### @@ -239,12 +243,11 @@ decoder { # audio_output { type "alsa" - name "My ALSA Device" -# device "pulse" # optional - mixer_type "software" # optional -# mixer_device "default" # optional -# mixer_control "Master" # optional -# mixer_index "0" # optional + name "Global ALSA->Pulse stream" +# mixer_type "hardware" + mixer_control "Master" + mixer_device "pulse" + device "pulse" } # # An example of an OSS output: @@ -311,9 +314,9 @@ audio_output { # Please see README.Debian if you want mpd to play through the pulseaudio # daemon started as part of your graphical desktop session! # -# audio_output { - # type "pulse" - # name "My Pulse Output" +#audio_output { +# type "pulse" +# name "My Pulse Output" # server "remote_server" # optional # sink "remote_server_sink" # optional # } diff --git a/docker/config/docker.pulse.mpd.conf b/docker/config/docker.pulse.mpd.conf deleted file mode 100644 index ad7713d0d..000000000 --- a/docker/config/docker.pulse.mpd.conf +++ /dev/null @@ -1,412 +0,0 @@ -# An example configuration file for MPD. -# Read the user manual for documentation: http://www.musicpd.org/doc/user/ -# or /usr/share/doc/mpd/html/user.html - - -# Files and directories ####################################################### -# -# This setting controls the top directory which MPD will search to discover the -# available audio files and add them to the daemon's online database. This -# setting defaults to the XDG directory, otherwise the music directory will be -# be disabled and audio files will only be accepted over ipc socket (using -# file:// protocol) or streaming files over an accepted protocol. -# -music_directory "~/RPi-Jukebox-RFID/shared/audiofolders" -# -# This setting sets the MPD internal playlist directory. The purpose of this -# directory is storage for playlists created by MPD. The server will use -# playlist files not created by the server but only if they are in the MPD -# format. This setting defaults to playlist saving being disabled. -# -# playlists are inside the Phoniebox path: -playlist_directory "~/.config/mpd/playlists" -# -# This setting sets the location of the MPD database. This file is used to -# load the database at server start up and store the database while the -# server is not up. This setting defaults to disabled which will allow -# MPD to accept files over ipc socket (using file:// protocol) or streaming -# files over an accepted protocol. -# -db_file "~/.config/mpd/database" -# -# These settings are the locations for the daemon log files for the daemon. -# These logs are great for troubleshooting, depending on your log_level -# settings. -# -# The special value "syslog" makes MPD use the local syslog daemon. This -# setting defaults to logging to syslog, or to journal if mpd was started as -# a systemd service. -# -log_file "~/.config/mpd/log" -# -# This setting sets the location of the file which stores the process ID -# for use of mpd --kill and some init scripts. This setting is disabled by -# default and the pid file will not be stored. -# -pid_file "~/.config/mpd/pid" -# -# This setting sets the location of the file which contains information about -# most variables to get MPD back into the same general shape it was in before -# it was brought down. This setting is disabled by default and the server -# state will be reset on server start up. -# -state_file "~/.config/mpd/state" -# -# The location of the sticker database. This is a database which -# manages dynamic information attached to songs. -# -sticker_file "~/.config/mpd/sticker.sql" -# -############################################################################### - - -# General music daemon options ################################################ -# -# This setting specifies the user that MPD will run as. MPD should never run as -# root and you may use this setting to make MPD change its user ID after -# initialization. This setting is disabled by default and MPD is run as the -# current user. -# -# user "root" -# -# This setting specifies the group that MPD will run as. If not specified -# primary group of user specified with "user" setting will be used (if set). -# This is useful if MPD needs to be a member of group such as "audio" to -# have permission to use sound card. -# -#group "nogroup" -# -# This setting sets the address for the daemon to listen on. Careful attention -# should be paid if this is assigned to anything other then the default, any. -# This setting can deny access to control of the daemon. Choose any if you want -# to have mpd listen on every address. Not effective if systemd socket -# activation is in use. -# -# For network -bind_to_address "any" -# -# And for Unix Socket -#bind_to_address "/run/mpd/socket" -# -# This setting is the TCP port that is desired for the daemon to get assigned -# to. -# -port "6600" -# -# This setting controls the type of information which is logged. Available -# setting arguments are "default", "secure" or "verbose". The "verbose" setting -# argument is recommended for troubleshooting, though can quickly stretch -# available resources on limited hardware storage. -# -log_level "default" -# -# Setting "restore_paused" to "yes" puts MPD into pause mode instead -# of starting playback after startup. -# -#restore_paused "no" -# -# This setting enables MPD to create playlists in a format usable by other -# music players. -# -#save_absolute_paths_in_playlists "no" -# -# This setting defines a list of tag types that will be extracted during the -# audio file discovery process. The complete list of possible values can be -# found in the user manual. -#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc" -# -# This example just enables the "comment" tag without disabling all -# the other supported tags: -#metadata_to_use "+comment" -# -# This setting enables automatic update of MPD's database when files in -# music_directory are changed. -# -auto_update "yes" -# -# Limit the depth of the directories being watched, 0 means only watch -# the music directory itself. There is no limit by default. -# -auto_update_depth "10" -# -############################################################################### - - -# Symbolic link behavior ###################################################### -# -# If this setting is set to "yes", MPD will discover audio files by following -# symbolic links outside of the configured music_directory. -# -#follow_outside_symlinks "yes" -# -# If this setting is set to "yes", MPD will discover audio files by following -# symbolic links inside of the configured music_directory. -# -#follow_inside_symlinks "yes" -# -############################################################################### - - -# Zeroconf / Avahi Service Discovery ########################################## -# -# If this setting is set to "yes", service information will be published with -# Zeroconf / Avahi. -# -#zeroconf_enabled "yes" -# -# The argument to this setting will be the Zeroconf / Avahi unique name for -# this MPD server on the network. %h will be replaced with the hostname. -# -#zeroconf_name "Music Player @ %h" -# -############################################################################### - - -# Permissions ################################################################# -# -# If this setting is set, MPD will require password authorization. The password -# setting can be specified multiple times for different password profiles. -# -#password "password@read,add,control,admin" -# -# This setting specifies the permissions a user has who has not yet logged in. -# -#default_permissions "read,add,control,admin" -# -############################################################################### - - -# Database ####################################################################### -# - -#database { -# plugin "proxy" -# host "other.mpd.host" -# port "6600" -#} - -# Input ####################################################################### -# - -input { - plugin "curl" -# proxy "proxy.isp.com:8080" -# proxy_user "user" -# proxy_password "password" -} - -# QOBUZ input plugin -input { - enabled "no" - plugin "qobuz" -# app_id "ID" -# app_secret "SECRET" -# username "USERNAME" -# password "PASSWORD" -# format_id "N" -} - -# TIDAL input plugin -input { - enabled "no" - plugin "tidal" -# token "TOKEN" -# username "USERNAME" -# password "PASSWORD" -# audioquality "Q" -} - -# Decoder ##################################################################### -# - -decoder { - plugin "hybrid_dsd" - enabled "no" -# gapless "no" -} - -decoder { - plugin "wildmidi" - enabled "no" -} -# -############################################################################### - -# Audio Output ################################################################ -# -# MPD supports various audio output types, as well as playing through multiple -# audio outputs at the same time, through multiple audio_output settings -# blocks. Setting this block is optional, though the server will only attempt -# autodetection for one sound card. -# -# An example of an ALSA output: -# -audio_output { - type "alsa" - name "Global ALSA->Pulse stream" -# mixer_type "hardware" - mixer_control "Master" - mixer_device "pulse" - device "pulse" -} -# -# An example of an OSS output: -# -#audio_output { -# type "oss" -# name "My OSS Device" -# device "/dev/dsp" # optional -# mixer_type "hardware" # optional -# mixer_device "/dev/mixer" # optional -# mixer_control "PCM" # optional -#} -# -# An example of a shout output (for streaming to Icecast): -# -#audio_output { -# type "shout" -# encoder "vorbis" # optional -# name "My Shout Stream" -# host "localhost" -# port "8000" -# mount "/mpd.ogg" -# password "hackme" -# quality "5.0" -# bitrate "128" -# format "44100:16:1" -# protocol "icecast2" # optional -# user "source" # optional -# description "My Stream Description" # optional -# url "http://example.com" # optional -# genre "jazz" # optional -# public "no" # optional -# timeout "2" # optional -# mixer_type "software" # optional -#} -# -# An example of a recorder output: -# -#audio_output { -# type "recorder" -# name "My recorder" -# encoder "vorbis" # optional, vorbis or lame -# path "/var/lib/mpd/recorder/mpd.ogg" -## quality "5.0" # do not define if bitrate is defined -# bitrate "128" # do not define if quality is defined -# format "44100:16:1" -#} -# -# An example of a httpd output (built-in HTTP streaming server): -# -#audio_output { -# type "httpd" -# name "My HTTP Stream" -# encoder "vorbis" # optional, vorbis or lame -# port "8000" -# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 -# quality "5.0" # do not define if bitrate is defined -# bitrate "128" # do not define if quality is defined -# format "44100:16:1" -# max_clients "0" # optional 0=no limit -#} -# -# An example of a pulseaudio output (streaming to a remote pulseaudio server) -# Please see README.Debian if you want mpd to play through the pulseaudio -# daemon started as part of your graphical desktop session! -# -#audio_output { -# type "pulse" -# name "My Pulse Output" -# server "remote_server" # optional -# sink "remote_server_sink" # optional -# } -# -# An example of a winmm output (Windows multimedia API). -# -#audio_output { -# type "winmm" -# name "My WinMM output" -# device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional -# or -# device "0" # optional -# mixer_type "hardware" # optional -#} -# -# An example of an openal output. -# -#audio_output { -# type "openal" -# name "My OpenAL output" -# device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional -#} -# -## Example "pipe" output: -# -#audio_output { -# type "pipe" -# name "my pipe" -# command "aplay -f cd 2>/dev/null" -## Or if you're want to use AudioCompress -# command "AudioCompress -m | aplay -f cd 2>/dev/null" -## Or to send raw PCM stream through PCM: -# command "nc example.org 8765" -# format "44100:16:2" -#} -# -## An example of a null output (for no audio output): -# -#audio_output { -# type "null" -# name "My Null Output" -# mixer_type "none" # optional -#} -# -############################################################################### - - -# Normalization automatic volume adjustments ################################## -# -# This setting specifies the type of ReplayGain to use. This setting can have -# the argument "off", "album", "track" or "auto". "auto" is a special mode that -# chooses between "track" and "album" depending on the current state of -# random playback. If random playback is enabled then "track" mode is used. -# See for more details about ReplayGain. -# This setting is off by default. -# -#replaygain "album" -# -# This setting sets the pre-amp used for files that have ReplayGain tags. By -# default this setting is disabled. -# -#replaygain_preamp "0" -# -# This setting sets the pre-amp used for files that do NOT have ReplayGain tags. -# By default this setting is disabled. -# -#replaygain_missing_preamp "0" -# -# This setting enables or disables ReplayGain limiting. -# MPD calculates actual amplification based on the ReplayGain tags -# and replaygain_preamp / replaygain_missing_preamp setting. -# If replaygain_limit is enabled MPD will never amplify audio signal -# above its original level. If replaygain_limit is disabled such amplification -# might occur. By default this setting is enabled. -# -#replaygain_limit "yes" -# -# This setting enables on-the-fly normalization volume adjustment. This will -# result in the volume of all playing audio to be adjusted so the output has -# equal "loudness". This setting is disabled by default. -# -volume_normalization "yes" -# -############################################################################### - -# Character Encoding ########################################################## -# -# If file or directory names do not display correctly for your locale then you -# may need to modify this setting. -# -filesystem_charset "UTF-8" -# -############################################################################### diff --git a/docker/docker-compose.linux.yml b/docker/docker-compose.linux.yml index 9609dc18d..6285484f8 100755 --- a/docker/docker-compose.linux.yml +++ b/docker/docker-compose.linux.yml @@ -12,7 +12,7 @@ services: volumes: - ../shared/audiofolders:/home/pi/RPi-Jukebox-RFID/shared/audiofolders - ../shared/playlists:/home/pi/.config/mpd/playlists - - ./config/docker.pulse.mpd.conf:/home/pi/.config/mpd/mpd.conf + - ./config/docker.mpd.conf:/home/pi/.config/mpd/mpd.conf - $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse-sock jukebox: @@ -25,5 +25,5 @@ services: - PULSE_SERVER=unix:/tmp/pulse-sock volumes: - ../shared:/home/pi/RPi-Jukebox-RFID/shared - - ./config/docker.pulse.mpd.conf:/home/pi/.config/mpd/mpd.conf + - ./config/docker.mpd.conf:/home/pi/.config/mpd/mpd.conf - $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse-sock diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 03191dbd5..38a112551 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -8,7 +8,7 @@ services: - USER=root - HOME=/root context: ../ - dockerfile: ./docker/mpd.Dockerfile + dockerfile: ./docker/Dockerfile.mpd container_name: mpd image: phoniebox/mpd environment: @@ -17,7 +17,7 @@ services: volumes: - ../shared/audiofolders:/root/RPi-Jukebox-RFID/shared/audiofolders - ../shared/playlists:/root/.config/mpd/playlists - - ./config/docker.pulse.mpd.conf:/root/.config/mpd/mpd.conf + - ./config/docker.mpd.conf:/root/.config/mpd/mpd.conf jukebox: build: @@ -26,7 +26,7 @@ services: - USER=root - HOME=/root context: ../ - dockerfile: ./docker/jukebox.Dockerfile + dockerfile: ./docker/Dockerfile.jukebox container_name: jukebox image: phoniebox/jukebox depends_on: @@ -43,13 +43,13 @@ services: - ../src/jukebox:/root/RPi-Jukebox-RFID/src/jukebox - ../src/webapp/public/cover-cache:/root/RPi-Jukebox-RFID/src/webapp/build/cover-cache - ../shared:/root/RPi-Jukebox-RFID/shared - - ./config/docker.pulse.mpd.conf:/root/.config/mpd/mpd.conf + - ./config/docker.mpd.conf:/root/.config/mpd/mpd.conf command: python run_jukebox.py webapp: build: context: ../ - dockerfile: ./docker/webapp.Dockerfile + dockerfile: ./docker/Dockerfile.webapp container_name: webapp image: phoniebox/webapp depends_on: diff --git a/documentation/developers/docker.md b/documentation/developers/docker.md index 9b4db4697..74d95c112 100644 --- a/documentation/developers/docker.md +++ b/documentation/developers/docker.md @@ -20,14 +20,14 @@ need to adapt some of those commands to your needs. 2. Pull the Jukebox repository: ```bash - $ git clone https://github.com/MiczFlor/RPi-Jukebox-RFID.git + git clone https://github.com/MiczFlor/RPi-Jukebox-RFID.git ``` 3. Create a jukebox.yaml file * Copy the `./resources/default-settings/jukebox.default.yaml` to `./shared/settings` and rename the file to `jukebox.yaml`. ```bash - $ cp ./resources/default-settings/jukebox.default.yaml ./shared/settings/jukebox.yaml + cp ./resources/default-settings/jukebox.default.yaml ./shared/settings/jukebox.yaml ``` * Override/Merge the values from the following [Override file](../../docker/config/jukebox.overrides.yaml) in your `jukebox.yaml`. @@ -39,127 +39,168 @@ need to adapt some of those commands to your needs. ## Run development environment -In contrary to how everything is set up on the Raspberry Pi, it\'s good +In contrary to how everything is set up on the Raspberry Pi, it's good practice to isolate different components in different Docker images. They can be run individually or in combination. To do that, we use `docker-compose`. ### Mac +
+ +See details + 1. [Install Docker & Compose (Mac)](https://docs.docker.com/docker-for-mac/install/) -2. Install pulseaudio +1. Install pulseaudio 1. Use Homebrew to install ```bash - $ brew install pulseaudio + brew install pulseaudio ``` - 2. Enable pulseaudio network capabilities. In an editor, open `/opt/homebrew/Cellar/pulseaudio/16.1/etc/pulse/default.pa` (you might need to adapt this path to your own system settings). Uncomment the following line: + 1. Enable pulseaudio network capabilities. In an editor, open `/opt/homebrew/Cellar/pulseaudio/16.1/etc/pulse/default.pa` (you might need to adapt this path to your own system settings). Uncomment the following line: ```text load-module module-native-protocol-tcp ``` - 3. Restart the pulseaudio service + 1. Restart the pulseaudio service ```bash - $ brew services restart pulseaudio + brew services restart pulseaudio ``` - 4. If you have trouble with your audio, try these resources to troubleshoot: [[1]](https://gist.github.com/seongyongkim/b7d630a03e74c7ab1c6b53473b592712), [[2]](https://devops.datenkollektiv.de/running-a-docker-soundbox-on-mac.html), [[3]](https://stackoverflow.com/a/50939994/1062438) + 1. If you have trouble with your audio, try these resources to troubleshoot: [[1]](https://gist.github.com/seongyongkim/b7d630a03e74c7ab1c6b53473b592712), [[2]](https://devops.datenkollektiv.de/running-a-docker-soundbox-on-mac.html), [[3]](https://stackoverflow.com/a/50939994/1062438) -> [!NOTE] -> In order for Pulseaudio to work properly with Docker on your Mac, you need to start Pulseaudio in a specific way. Otherwise MPD will throw an exception. See [Pulseaudio issues on Mac](#pulseaudio-issue-on-mac) for more info. +1. Run `docker-compose` -``` bash -// Build Images -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml build + > [!NOTE] + > In order for Pulseaudio to work properly with Docker on your Mac, you need to start Pulseaudio in a specific way. Otherwise MPD will throw an exception. See [Pulseaudio issues on Mac](#pulseaudio-issue-on-mac) for more info. -// Run Docker Environment -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml up + 1. Build libzmq for your host machine -// Shuts down Docker containers and Docker network -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml down -``` + ```bash + docker build -f docker/Dockerfile.libzmq -t libzmq:local . + ``` + + 1. Build Images + + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml build + ``` + + 1. Run Docker Environment -> Runs the entire Phoniebox environment + + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml up + ``` + + * Shuts down Docker containers and Docker network + + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.mac.yml down + ``` + +
### Windows +
+ +See details + 1. Install [Docker & Compose (Windows)](https://docs.docker.com/docker-for-windows/install/) -2. Download [pulseaudio](https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/Support/) +1. Download [pulseaudio](https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/Support/) -3. Uncompress somewhere in your user folder +1. Uncompress somewhere in your user folder -4. Edit `$INSTALL_DIR/etc/pulse/default.pa` +1. Edit `$INSTALL_DIR/etc/pulse/default.pa` -5. Add the following line +1. Add the following line ``` bash load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 ``` -6. Edit `$INSTALL_DIR/etc/pulse//etc/pulse/daemon.conf`, find the +1. Edit `$INSTALL_DIR/etc/pulse//etc/pulse/daemon.conf`, find the following line and change it to: ``` bash exit-idle-time = -1 ``` -7. Execute `$INSTALL_DIR/bin/pulseaudio.exe` +1. Execute `$INSTALL_DIR/bin/pulseaudio.exe` -8. Make sure Docker is running (e.g. start Docker Desktop) +1. Make sure Docker is running (e.g. start Docker Desktop) -9. Run `docker-compose` +1. Run `docker-compose` - ``` bash - // Build Images - $ docker-compose -f docker/docker-compose.yml build + 1. Build libzmq for your host machine - // Run Docker Environment - $ docker-compose -f docker/docker-compose.yml up + ```bash + docker build -f docker/Dockerfile.libzmq -t libzmq:local . + ``` - // Shuts down Docker containers and Docker network - $ docker-compose -f docker/docker-compose.yml down - ``` + 1. Build Images + + ```bash + docker-compose -f docker/docker-compose.yml build + ``` + + 1. Run Docker Environment -> Runs the entire Phoniebox environment + + ```bash + docker-compose -f docker/docker-compose.yml up + ``` + + * Shuts down Docker containers and Docker network + + ```bash + docker-compose -f docker/docker-compose.yml down + ``` + +
### Linux +
+ +See details + 1. Install Docker & Compose * [Docker](https://docs.docker.com/engine/install/debian/) * [Compose](https://docs.docker.com/compose/install/) -2. Make sure you don\'t use `sudo` to run your `docker-compose`. Check out +1. Make sure you don\'t use `sudo` to run your `docker-compose`. Check out Docker\'s [post-installation guide](https://docs.docker.com/engine/install/linux-postinstall/) for more information. -```bash -// Build Images -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml build +1. Run `docker-compose` -// Run Docker Environment -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml up + 1. Build libzmq for your host machine -// Shuts down Docker containers and Docker network -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml down -``` + ```bash + docker build -f docker/Dockerfile.libzmq -t libzmq:local . + ``` -Note: if you have `mpd` running on your system, you need to stop it -using: + 1. Build Images -``` bash -$ sudo systemctl stop mpd.socket -$ sudo mpd --kill -``` + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml build + ``` -Otherwise you might get the error message: + 1. Run Docker Environment -> Runs the entire Phoniebox environment -``` bash -$ docker-compose -f docker-compose.yml -f docker-compose.linux.yml up -Starting mpd ... -Starting mpd ... error -(...) -Error starting userland proxy: listen tcp4 0.0.0.0:6600: bind: address already in use -``` + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml up + ``` -Read these threads for details: [thread 1](https://unix.stackexchange.com/questions/456909/socket-already-in-use-but-is-not-listed-mpd) and [thread 2](https://stackoverflow.com/questions/5106674/error-address-already-in-use-while-binding-socket-with-address-but-the-port-num/5106755#5106755) + * Shuts down Docker containers and Docker network + + ```bash + docker-compose -f docker/docker-compose.yml -f docker/docker-compose.linux.yml down + ``` + +
## Test & Develop @@ -175,7 +216,7 @@ restart your `jukebox` container. Update the below path with your specific host environment. ``` bash -$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.[ENVIRONMENT].yml restart jukebox +docker-compose -f docker/docker-compose.yml -f docker/docker-compose.[ENVIRONMENT].yml restart jukebox ``` ## Known issues @@ -208,13 +249,13 @@ To fix the issue, try the following. brew service stop pulseaudio ``` -2. Start Pulseaudio with this command +1. Start Pulseaudio with this command ```bash pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon ``` -3. Check if daemon is working +1. Check if daemon is working ```bash pulseaudio --check -v @@ -224,6 +265,27 @@ Everything else should have been set up properly as a [prerequisite](#mac) * [Source](https://gist.github.com/seongyongkim/b7d630a03e74c7ab1c6b53473b592712) +#### `mpd` issues on Linux + +If you have `mpd` running on your system, you need to stop it using: + +``` bash +sudo systemctl stop mpd.socket +sudo mpd --kill +``` + +Otherwise you might get the error message: + +``` bash +docker-compose -f docker-compose.yml -f docker-compose.linux.yml up +Starting mpd ... +Starting mpd ... error +(...) +Error starting userland proxy: listen tcp4 0.0.0.0:6600: bind: address already in use +``` + +Read these threads for details: [thread 1](https://unix.stackexchange.com/questions/456909/socket-already-in-use-but-is-not-listed-mpd) and [thread 2](https://stackoverflow.com/questions/5106674/error-address-already-in-use-while-binding-socket-with-address-but-the-port-num/5106755#5106755) + #### Other error messages When starting the `mpd` container, you will see the following errors. @@ -274,7 +336,7 @@ jukebox | 319:server.py - jb.pub.server - host.timer.cputemp If you encounter the following error, refer to [Pulseaudio issues on Mac](#pulseaudio-issue-on-mac). -```text +``` bash jukebox | 21.12.2023 08:50:09 - 629:plugs.py - jb.plugin - MainThread - ERROR - Ignoring failed package load finalizer: 'volume.finalize()' jukebox | 21.12.2023 08:50:09 - 630:plugs.py - jb.plugin - MainThread - ERROR - Reason: NameError: name 'pulse_control' is not defined ``` @@ -289,8 +351,8 @@ run `mpd` or `webapp`. The following command can be run on a Mac. ``` bash -$ docker build -f docker/jukebox.Dockerfile -t jukebox . -$ docker run -it --rm \ +docker build -f docker/Dockerfile.jukebox -t jukebox . +docker run -it --rm \ -v $(PWD)/src/jukebox:/home/pi/RPi-Jukebox-RFID/src/jukebox \ -v $(PWD)/shared/audiofolders:/home/pi/RPi-Jukebox-RFID/shared/audiofolders \ -v ~/.config/pulse:/root/.config/pulse \ @@ -314,7 +376,6 @@ Mount the device into the container by configuring the appropriate device in a ` ### Resources - #### Mac * @@ -328,8 +389,6 @@ Mount the device into the container by configuring the appropriate device in a ` * * - - #### Audio * diff --git a/installation/routines/setup_jukebox_core.sh b/installation/routines/setup_jukebox_core.sh index cb85198be..9dcca2256 100644 --- a/installation/routines/setup_jukebox_core.sh +++ b/installation/routines/setup_jukebox_core.sh @@ -86,7 +86,7 @@ _jukebox_core_build_and_install_pyzmq() { fi ZMQ_PREFIX="${JUKEBOX_ZMQ_PREFIX}" ZMQ_DRAFT_API=1 \ - pip install -v --no-binary pyzmq pyzmq + pip install -v pyzmq --no-binary pyzmq else print_lc " Skipping. pyzmq already installed" fi