Making Music on Lockdown New Year’s Eve

Covid 19 has changed the world in so many ways we’re all missing that contact and togetherness that seems a bit like a distant memory.

One of the things we’ve all missed this year is meeting up with mates, having a few drinks and listening to some great music together. Parties via video conference have sprung up to to help fill (a bit) this need. So on New Years Eve my mates and I were going to have a get together, I thought wouldn’t it be great for us to share the same tunes, not just listen to a livestream online but be able to have our own online radio station where we can choose the playlist.

I’d saved this article a few months back that built a personal music streaming service that took in feeds from Soundcloud, Spotify (premium only), YouTube playlists, TuneIn radio as well as any local music you happed to have lying around either locally or from my Airsonic server (and loads of others have a look at the other extensions here) and streamed them through Icecast.

So I did what I’ve done so many times in the past spun up a VM, and it work. Cool but rather than pat myself on the back thought “Yeah but can I get it in a container”. So I jumped on docker hub and there were repositories for both Mopidy and Icecast, great I thought. I’ll need to read the docs to get them to work together but we have a solution. Then I found Kasim Lemur’s github repo where already had a working docker-compose file. Even better.

There was an outstanding pull request in his repo, so I forked it, ran the build on my machine. It needed the fix in the pull request. So I amended the mopidy Dockerfile and added the fix and all the extra extensions that I wanted in my implementation and pushed it all backup to Github. Have a look here

I couple of things to note. Security wise there is no authentication for Mopidy so if like me you’re planning to share this with friends you will need to open the relevant ports on your router. I did secure this behind a reverse proxy with Authelia. And secondly the implementation of Icecast exposes far to much over the internet by default so that will need securing, there’s a good stackoverflow question about putting Icecast behind a reverse proxy but it was getting close to party time and I had a quick and dirty solution that would work for new years eve and I could shut everything off afterwards and look closer at at securing Icecast once the headache starts to wear off in the new year.

Biting the Bullet

Or how I learned to stop worrying and love containerisation

I love Nextcloud, it amazing. It’s grown from humble beginnings to some that is (almost) a full Goole docs replacement. I started off running Owncloud since release 3.0, as a replacement for Dropbox as I was always wanted to store more data than the free plan on Dropbox would allow. And the desktop client allowed me to replicate Dropbox functionality where my data didn’t go to a third party and I had as much storage as I could cram into my machine at home. However as soon as Nextcloud was forked nearly 5 years ago I moved over to that as it was more actively developed.

It’s been on my HP microserver running openmediavault, which was on version 4 using the mysql and nginx plugins that were part of openmediavault. This was all fine until version 16 of Nextcloud came out as it required a php version of at least 7.2 and openmediavault 4 only had version 7. 0.

I’d tried the docker plugin for openmediavault 4 but hadn’t grasped the benefit of docker at the time as the plugin required too much manual data entry in the web interface.

My world changed when I saw this post on the openmediavault forums, and I was introduced to docker compose. A tool that enabled anyone to deploy a complete software stack with just a simple yaml file. I was sold, and within a few minutes I had a reverse proxy with SSL certificates, application server, database server and a redis caching server up and running with the latest and greatest version of Nextcloud.

Here’s my docker-compose.yml file should you want to have a go

version: "2"
services:
  nextcloud:
    image: linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000 #change PUID if needed
      - PGID=100  #change PGID if needed
      - TZ=Europe/London #change Time Zone if needed
    volumes:
      - /srv/dev-disk-by-label-disk1/appdata/nextcloud/config:/config #/srv/dev-disk-by-label-disk1 needs to be adjusted
      - /srv/dev-disk-by-label-disk1/appdata/nextcloud/data:/data     #/srv/dev-disk-by-label-disk1 needs to be adjusted
    depends_on:
      - mariadb
#    ports: # uncomment this and the next line if you want to bypass the proxy
#      - 450:443
    restart: unless-stopped
  mariadb:
    image: linuxserver/mariadb
    container_name: nextclouddb
    environment:
      - PUID=1000 #change PUID if needed
      - PGID=100  #change PGID if needed
      - MYSQL_ROOT_PASSWORD=PASSWORDHERE
      - MYSQL_DATABASE=nextcloud

      - TZ=Europe/London #Change Time Zone if needed
    volumes:
      - /srv/dev-disk-by-label-disk1/appdata/nextclouddb:/config    #/srv/dev-disk-by-label-disk1 needs to be adjusted
    restart: unless-stopped
  swag:
    image: linuxserver/swag         #swag is the replacement for letsencrypt (see link below)
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000 #change PUID if needed
      - PGID=100  #change PGID if needed
      - TZ=Europe/London # change Time Zone if needed
      - URL=nextcloud.mydomain.com
      - VALIDATION=http

      - [email protected] # define email; required to renew certificate
    volumes:
      - /srv/dev-disk-by-label-disk1/appdata/swag:/config  #/srv/dev-disk-by-label-disk1 needs to be adjusted
    ports:
      - 443:443
      - 82:80
    restart: unless-stopped
  redis:
    image: redis
    container_name: redis
    hostname: redis
    volumes:
      - /srv/dev-disk-by-label-disk1/appdata/redis/data:/data    #--> needs to be changed to your config
    restart: unless-stopped

© 2024 Blog @ Bartrip

Theme by Anders NorĂ©nUp ↑