Music Player Container π - A streaming Jukebox setup.
Moving the programs I like, and refuse to give up, into the modern world of browsers and containers. For learning and fun, not profit.
Thanks to Github Actions each time this repo changes the images in the registry are updated too.
What runs in each of the 5 containers that MPContainer consists of.
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, do L7 redirects to backends.
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 MPC client) to control the MPD server.
Access to this should be restricted on public deployments, this security is left to the user (don't just put this on the open internet). This web shell is for trusted users only.
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.
Deploy MPContainer in prod, or work in dev.
Start the system with images on docker hub:
docker-compose -f docker-compose.yml up -d
If you're deving and want to mount config files from the repo and expose ports etc:
docker-compose -f docker-compose.yml -f dev-compose.yaml up --build
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