0x646e78 / mpcontainer

Music player container - a streaming Jukebox setup made from MPD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MPContainer

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.

build status

linting security-scans CodeQL docker-hub-release

Thanks to Github Actions each time this repo changes the images in the registry are updated too.

build-container-mpd build-container-hpx build-container-web build-container-shell build-containers-pyapp

App Architecture

mpcontainer.mermaid

containers

What runs in each of the 5 containers that MPContainer consists of.

πŸ“¦ mpd

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

haproxy is the frontend proxy, do L7 redirects to backends.

πŸ“¦ Nginx

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.

πŸ“¦ admin-shell

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.

πŸ“¦ Python-App

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.

Use

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.

docker-compose

Deploy MPContainer in prod, or work in dev.

production

Start the system with images on docker hub:

docker-compose -f docker-compose.yml up -d

development

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 it

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).

manually build images

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

Kubernetes

For steps to run in Kubernetes see this README

About

Music player container - a streaming Jukebox setup made from MPD


Languages

Language:HTML 32.0%Language:Shell 22.0%Language:Dockerfile 18.6%Language:Python 12.0%Language:HCL 9.3%Language:Makefile 3.1%Language:JavaScript 1.5%Language:Lua 1.2%Language:CSS 0.2%Language:Vim Script 0.1%