All apps · 0 apps
Mopidy3
Docker app from daredoes' Repository
Overview
Mopidy is an extensible music server written in Python.
Mopidy plays music from local disk, Spotify, SoundCloud, Google Play Music, and more. You edit the playlist from any phone, tablet, or computer using a range of MPD and web clients.
This is Mopidy3 for Unraid with support for snapcast and multiple instances with automatic snapcast stream management.
- set up the docker
- set up volume mount to /mnt/user/appdata/mopidy/ >> /config/
- add TCP ports for MPD, HTTP and TCP ports for each additional instance you want
A configuration has been autogenerated with basic settings. The template for it can be found in the container in /home/templates. It is located in /etc/mopidy
Do NOT modify the part of the audio output setting that says port=4953. This is automatically replaced for each instance generated to fill in the host and port.
To configure the instance and snapcast settings, copy the template to your config folder and modify it. cp /home/templates/server.json /config/.
Readme
View on GitHubThis container packages mopidy3
Comes pre-loaded with spotify, youtube, gstreamer, iris, etc
Built on Ubuntu.
Made because the only other option wasn't working for me :(
Examples
Run Mopidy3 with in host mode with a /music folder in the present working directory, and mapping mopidy's internal data to /data:
docker run --network host -d \
-v $(pwd)/music:/media \
-v $(pwd)/data:/home/.local/share/mopidy \
daredoes/mopidy3
Run Mopidy3 with specified ports with a `/music`` folder in the present working directory:
docker run --network host -d \
-p 9001:9001 \
-p 6680:6680 \
-p 6600:6600 \
-p 4953:4953 \
-v $(pwd)/music:/media \
-v $(pwd)/data:/home/.local/share/mopidy \
daredoes/mopidy3
How It Works
Here's a detailed explanation of how the Mopidy Docker container and its components interact:
Dockerfile Setup: The Dockerfile sets up the Mopidy environment by installing essential dependencies, including Mopidy with YouTube support, Supervisor, and other required packages. It also copies necessary files into the container. Additionally, a custom sed hack is applied to enable library scanning from Iris.
Entrypoint Execution: When the Docker container is started, it executes an entrypoint script. This script triggers a Python script responsible for creating a Supervisord configuration entry for each server defined in the
servers.jsonfile. Each configuration entry stores unique information specific to the instance as environment variables.Supervisor Initialization: Supervisor is launched and listens on port 9001. It orchestrates the following tasks:
- Initiates a library scan using
scan_library.shand the configuration from/etc/mopidy/mopidy.conf. This step ensures that Mopidy has up-to-date information about available music. - Starts each Mopidy instance defined in the Supervisord configuration. These instances are configured based on the environment variables set during entrypoint execution.
- Initiates a library scan using
Instance Startup: The Mopidy instances start by executing
start_mopidy.sh. This script performs the following actions:- Logs relevant information to the console for debugging and monitoring purposes.
- Attempts to install Python packages listed in the
requirements.txtfile, with the file path specified in theREQUIREMENTS_FILEenvironment variable. - Triggers
start.py, which serves several key functions:- It checks for and terminates any processes already running on the specified ports, ensuring a clean start.
- Removes any streams in Snapcast with the same ID as the current instance to prevent conflicts.
- Sends Snapcast information about the new stream, allowing synchronized audio playback.
Mopidy Execution: With all the necessary preparations complete, Mopidy starts running. Users can access it via the specified web port. Note that issues with Mopidy's configuration file (
mopidy.conf) can lead to connectivity problems. Be cautious when modifying this file, as adding a;to a line renders the entire line invalid. Ensure that any changes made are properly configured to avoid disruptions in Mopidy's operation.
Environment Variables
Here's a table describing the environment variables used in the Dockerfile and how they are utilized in the Python file:
| Environment Variable | Description | Usage in Python File |
|---|---|---|
XDG_CACHE_DIR |
Cache directory path | Used to define the cache directory where Mopidy and other components can store cached data. |
XDG_CONFIG_DIR |
Configuration directory path | Specifies the directory where Mopidy should look for its configuration file (mopidy.conf). |
XDG_DATA_DIR |
Data directory path | Indicates the directory where Mopidy stores data, such as databases and other persistent information, except sometimes it just puts it in /home/.local/share/mopidy instead. |
REQUIREMENTS_FILE |
Requirements file path | Points to the location of the requirements.txt file, which is used for installing Python dependencies. |
IRIS_USE_SUDO |
Boolean flag (true or false) | Determines whether Mopidy Iris should use sudo when executing certain commands (typically set to false). |
TEMPLATES_DIR |
Templates directory path | Specifies the directory where various templates, including mopidy.conf, are stored for configuration purposes. |
These environment variables are utilized in the Python file to configure and customize the behavior of the Mopidy and related services. They are used for various purposes such as defining file paths, configuring Mopidy, and specifying options for different components.
Install Mopidy3 on Unraid in a few clicks.
Find Mopidy3 in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.
Download Statistics
Related apps
Explore more like this
Explore allLinks
Details
daredoes/mopidy3:stableRuntime arguments
- Web UI
http://[IP]:[PORT:9001]/- Network
bridge- Shell
bash- Privileged
- false
Template configuration
Where the config files live
- Target
- /etc/mopidy/
- Default
- /mnt/user/appdata/Mopidy3/config
- Value
- /mnt/user/appdata/mopidy/config
Where the Mopidy Data lives
- Target
- /data/
- Default
- /mnt/user/appdata/Mopidy3/data
- Value
- /mnt/user/appdata/mopidy/data
The location of your music
- Target
- /media
The location where DB files are stored. If you don't add this, your docker image will bloat.
- Target
- /home/.local/share/mopidy/
- Default
- /mnt/user/appdata/Mopidy3/share
This should match whats in your config
- Target
- 6600
- Default
- 6600
- Value
- 6600
Where the webserver lives
- Target
- 6680
- Default
- 6680
- Value
- 6680
The default port for TCP Streams in Snapcast
- Target
- 4593
- Default
- 4593
- Value
- 4593
Where the supervisord web UI lives
- Target
- 9001
- Default
- 9001
- Value
- 9001
The folder location where template files are accessed
- Target
- TEMPLATES_DIR
- Default
- /home/templates
The file location of a custom requirements.txt you want installed at the start of each mopidy instance.
- Target
- REQUIREMENTS_FILE
- Default
- /etc/mopidy/requirements.txt