Music Player Container 🔊 - A streaming Jukebox setup built around MPD.
Moving the CLI programs I like, and refuse to give up, into the modern world of browsers and containers. For learning and fun, not profit.
See screenshots of the front and admin web interfaces.
Thanks to Github Actions each time this repo changes the images in the registry are updated too.
What runs in each of the 5 different container types.
Music Player Daemon is a music server that can be controlled with a client over an API (mpc protocol). Can output vorbis audio stream over http.
haproxy is the frontend proxy, handle L7 redirects to backend services.
nginx web server is used for hosting static files. Hosts bootstrap jquery frameworks (installed with npm). This is the default haproxy backend.
A Multi-stage build is done, npm is not included in the final image.
ttyd lets you run a terminal in your browser. From tmux (a terminal multiplexer) you can use ncmpcpp (an ncurses MPD client app) to control the MPD server.
Access to this should be restricted on public deployments, don't put this on the open internet without changing the password variables. This web shell is for trusted users only so they can control the music.
A python flask web app, run from Gunicorn.
Connects to the MPD api (with a read only user) to get stream and other dynamic information about MPD.
On MacOS or Windows Docker Desktop makes for a nice container experience, especially with VSCode (get the Docker, yaml and kubernetes extensions).
Put some music into .\music\db\
so you can use the Jukebox, these files will be exluded from Git.
Starting MPContainer in prod/dev.
If you're deving and want to mount config files from the repo and expose ports etc:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
Or for a contained local Dev environment there is a VM managed by Vagrant here
Start the MPContainer with images on docker hub:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Check on everything:
docker-compose ps
docker-compose top
By default MPContainer is available on port 3000 of your local interface.
The admin shell is password protected, and the HAPX_US_USER
& HAPX_US_PASS
can be set to override the defaults (set in docker-compose and haproxy.conf).
For manually updating first create a Personal Access Token (pat) for git, then add create environment vars for this and your username.
export GIT_TOKE="xxxxx"
export GIT_UN="<git username>"
login to registry:
echo $GIT_TOKE | docker login https://ghcr.io/ -u $GIT_UN --password-stdin
Build and push Images:
make build
make publish
For steps to run in Kubernetes see this README