Ampache: is an open source server which will let you stream your own music.
Just like WordPress/Drupal, and others let you host your own blogging website.
Point is why am writing this article? If you’re here, possibly you already know.
There is no document to deploy Ampache on Kubernetes/K8s.
I tried directly using the Docker image, but few problems faced,
1. Every time Container restarted, I had to go through the initial server configuration again and again. Need to find the configuration which can be mounted as ConfigMap. 2. Exposing it through Google Cloud Load Balancer Ingress requires "health check" to pass on, only after which traffic will be allowed to it. Need to find the configuration where health check can be defined.
Pre-requisites:
1. A running Kubernetes Cluster
2. Access to Cluster using 'kubectl'
Am using Google Cloud for the demo, first let’s create
1. Namespace
$ kubectl create ns music
2. ConfigMaps
a.path to ampache web server configuration file
$ kubectl apply -f amp-server-config.yaml
b. path to ampache (apache2) webserver configuration file where
we can add health check.
$ kubectl apply -f ampache-health.yamlNote- below are both the config manifest files.
Initially I ran the default ampache pod, and exposed it as LoadBalancer, and from browser filled the configuration details.
Post that, copied the context from the path “/var/www/config/ampache.cfg.php” and created a configmap from it. which in my case looks like,
post that also modified the apache2 conf file for health-check.
2. A Deployment where our Ampache Server will run as pod
3. A PVC (persistence Volume Claim) where we can store our local songs.
4. A service for exposing the Deployment as NodePort
5. A Secret of our mysql password. By default 'root' is taken as username.
$ kubectl create secret generic musql-pass --from-literal=password=mypassword
Now Let’s give a database to our Ampache music streaming webserver to handle users.
For this make sure, secret "mysql-pass" from previous step was completed, by checking
$ kubectl get secrets
Now create the mysql deployment from below manifest mysql.yaml$ kubectl create -f mysql.yaml
if everything is going fine till now, you can check via
Now the Important part. Using a domain and an ingress to expose our application publicly.
Make sure you have the domain and respective ‘ssl’ which will be used to create ‘tls’ secret.
create 'tls' secret
$ kubectl create secret tls nirvana-ssl --from-cert cert.tls --from-key tls.key
to see the secret
$ kubectl get secrets
Now lets focus on Ingress
Once this is done, Make sure to change the health check of the Ampache Backend to ‘server-status’ from GCP LoadBalancer (ingress)
You can copy music to this path using
$ kubectl cp /path/to/my/local/music/directory pod_id:/data/Music/
I've uploaded around 500 songs here, using cloud storage not
'$ kubectl cp' command as this method is going to get excruciating.
Once all these steps are done, Lets check our Streaming server,
which in my case “https://warmpillow.xyz”
To add songs, Go to admin>Add Catalog
Give a name to your Catalog > Type- Local > and Path to our local Music Store ‘/data/Music’
That is it. Once Music Library is updated, you can check your songs at your domain, which in my case is
https://warmpillow.xyz
For demo you can check @
username: medium
password: ilikereading
Link to my Repository,
Link to my other work;