From 62c9330981a5fe38bfc9fb07dcd74b80a197d571 Mon Sep 17 00:00:00 2001 From: Werner Beroux Date: Tue, 21 Apr 2015 15:13:36 +0200 Subject: [PATCH] Initial version. --- .gitignore | 1 + Dockerfile | 44 +++++++++++++++++++++++++++++++ README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++- mopidy.conf | 12 +++++++++ 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 mopidy.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8f50f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +npm-debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b9c730 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +FROM debian:wheezy + +MAINTAINER Werner Beroux + +# Official Mopidy install for Debian/Ubuntu along with some extensions +# (see https://docs.mopidy.com/en/latest/installation/debian/ ) +ADD https://apt.mopidy.com/mopidy.gpg /tmp/mopidy.gpg +ADD https://apt.mopidy.com/mopidy.list /etc/apt/sources.list.d/mopidy.list + +RUN apt-key add /tmp/mopidy.gpg + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + mopidy \ + mopidy-soundcloud \ + mopidy-spotify + +# Install more extensions via PIP. +ADD https://bootstrap.pypa.io/get-pip.py /tmp/get-pip.py +RUN python /tmp/get-pip.py +RUN pip install -U six +RUN pip install \ + Mopidy-Moped \ + Mopidy-GMusic \ + Mopidy-YouTube + +# Clean-up to save some space +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Run as mopidy user +#RUN useradd --system --uid 377 -M --shell /usr/sbin/nologin mopidy +USER mopidy + +# Default configuration +RUN mkdir -p ~/.config/mopidy +ADD mopidy.conf /var/lib/mopidy/.config/mopidy/mopidy.conf + +VOLUME /var/lib/mopidy/local +VOLUME /var/lib/mopidy/media + +EXPOSE 6600 +EXPOSE 6680 + +ENTRYPOINT ["/usr/bin/mopidy"] diff --git a/README.md b/README.md index d8a36fc..2d1e728 100644 --- a/README.md +++ b/README.md @@ -1 +1,75 @@ -# docker-mopidy +docker-mopidy +============= + +Containerized **[Mopidy](https://www.mopidy.com/)** music server with support for [MPD clients](https://docs.mopidy.com/en/latest/clients/mpd/) and [HTTP clients](https://docs.mopidy.com/en/latest/ext/web/#ext-web). + + +Features +-------- + + * Follows [official installation](https://docs.mopidy.com/en/latest/installation/debian/) on top of [Debian](https://registry.hub.docker.com/_/debian/). + * With backend extensions for: + * [Mopidy-Spotify](https://docs.mopidy.com/en/latest/ext/backends/#mopidy-spotify) for **[Spotify](https://www.spotify.com/us/)** (Premium) + * [Mopidy-GMusic](https://docs.mopidy.com/en/latest/ext/backends/#mopidy-gmusic) for **[Google Play Music](https://play.google.com/music/listen)** + * [Mopidy-SoundClound](https://docs.mopidy.com/en/latest/ext/backends/#mopidy-soundcloud) for **[SoundCloud](https://soundcloud.com/stream)** + * [Mopidy-YouTube](https://docs.mopidy.com/en/latest/ext/backends/#mopidy-youtube) for **[YouTube](https://www.youtube.com)** + * With [Mopidy-Moped](https://docs.mopidy.com/en/latest/ext/web/#mopidy-moped) web extension. + * Runs as `mopidy` user inside the container. + +You may install additional [backend extensions](https://docs.mopidy.com/en/latest/ext/backends/). + + +Usage +----- + +General usage (see [mopidy commands](https://docs.mopidy.com/en/latest/command/)): + + $ docker run -d \ + -v /dev/snd:/dev/snd --lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \ + -v $PWD/media:/var/lib/mopidy/media:ro \ + -v $PWD/local:/var/lib/mopidy/local \ + -p 6600:6600 -p 6680:6680 \ + wernight/mopidy \ + -o spotify/username=USERNAME -o spotify/password=PASSWORD \ + -o gmusic/username=USERNAME -o gmusic/password=PASSWORD \ + -o soundcloud/auth_token=TOKEN + +Replace `USERNAME`, `PASSWORD`, `TOKEN` accordingly: + + * For *Spotify* you'll need a *Premium* account. + * For *Google Music* use your Google account (if you have *2-Step Authentication*, generate an [app specific password](https://security.google.com/settings/security/apppasswords)). + * For *SoundCloud*, just [get a token](https://www.mopidy.com/authenticate/) after registering. + +Ports: + + * 6600 - MPD server + * 6680 - HTTP server + +Volumes: + + * `/var/lib/mopidy/media` - Path to directory with local media files (optional). + * `/var/lib/mopidy/local` - Path to directory to store local metadata such as libraries and playlists in (optional). + * `/dev/snd` - Used to share ALSA socket and play audio. + +### Example using HTTP client to stream local files + + 1. Give read access to your audio files to user 102 (`mopidy`), group 29 (`audio`), or all users (e.g., `$ chgrp -R 29 $PWD/media && chmod -R g+r $PWD/media`). + 2. Index local files: + + $ docker run --rm -v $PWD/media:/var/lib/mopidy/media:ro -v $PWD/local:/var/lib/mopidy/local -p 6800:6800 wernight/mopidy local scan + 3. Start the server: + + $ docker run -d -v $PWD/media:/var/lib/mopidy/media:ro -v $PWD/local:/var/lib/mopidy/local -p 6800:6800 wernight/mopidy + + 4. Browse to http://localhost:6800/ + +### Example using [ncmpcpp](https://docs.mopidy.com/en/latest/clients/mpd/#ncmpcpp) MPD console client + + $ docker run --name mopidy -d wernight/mopidy + $ docker run --rm -it --link mopidy:mopidy wernight/ncmpcpp --host mopidy + + +Feedbacks +--------- + +Having more issues? [Report a bug on GitHub](https://github.com/wernight/docker-mopidy/issues). diff --git a/mopidy.conf b/mopidy.conf new file mode 100644 index 0000000..9f9ba0c --- /dev/null +++ b/mopidy.conf @@ -0,0 +1,12 @@ +[local] +data_dir = /var/lib/mopidy/local +media_dir = /var/lib/mopidy/media + +[m3u] +playlists_dir = /var/lib/mopidy/playlists + +[http] +hostname = 0.0.0.0 + +[mpd] +hostname = 0.0.0.0