Upgrading Peertube and Running the Livechat Plugin

A quick video guide for upgrading Peertube running in Docker Engine on Reclaim Cloud Peertube4.0 was recently released, and I was excited to see what's new and improved in what is becoming one of my favorite pieces of open source software. Feeling emboldened by some recent experimenting in Reclaim Cloud, I decided to upgrade bava.tv running on Peertube version 3.0. I have Peertube running via a Docker container spun up within Docker Engine, or a container within a container---turtles all the way down. I was a bit nervous to upgrade versions given I have over 500 videos hosted there at this point.* Fortunately, I was pleasantly surprised just how easy upgrading a Docker image of Peertube proved to be, which reinforces that Docker can be a much easier and more efficient process for managing your infrastructure once you wrap your head around it. So, below are the steps I followed using this guide for upgrading Peertube Docker images.
You change into your Peertube directory in the Docker Engine container (mine is /home/peertube/ but yours may be different):
cd /your/peertube/directory
Then pull the version you want, I wanted the latest release which is called bullseye:
docker pull chocobozzz/peertube:v4.0.0-bullseye
After that you want to delete the containers and internal volumes:
docker-compose down -v
Re-run the container, but before you do make sure the new version you want to pull is specified in the docker-compose.yml file (located in /your/peertube/directory which for me is /home/peertube). In the docker-compose file look for the section titled peertube and the following lines:
peertube:
# If you don't want to use the official image and build one from sources
# build:
# context: .
# dockerfile: ./support/docker/production/Dockerfile.buster
image: chocobozzz/peertube:v4.0.0-bullseye
env_file:
- .env
Note the line specifying the image the bullseye 4.0.0 release needs to be for the image you want to install, which for me is chocobozzz/peertube:v4.0.0-bullseye
Save the docker-compose.yml file and the run the following command:
docker-compose up -d
And that worked swimmingly, I could load the latest version of Peertube and lost none of my existing videos, data, metadata, etc.
While reading about new features/updates within the software I noticed that they're funding the development of a Livechat plugin I tried unsuccessfully to get working several months ago. As a result that plugin has now been regularly updated, so I decided to test it out. After reading around I realized it still needs the chat server Prosody installed, which can be tricky on Docker Engine given it is a pared down version of Linux that often makes installing dependencies hard, if not impossible.
Turns out the ease of upgrading and swapping infrastructure became readily apparent when I realized I could simply redefine a new Docker image in the docker-compose file and spin down the old one and spin up the new one with Prosody pre-installed. I got the heads up from the Livechat plugin documentation that has a copy of the Peertube 3.4 version with prosody installed, so after running the docker-compose down -v
command I swapped out the image in the docker-compose file to be johnxlivingston/peertubelivechat:production-buster:
peertube:
# If you don't want to use the official image and build one from sources
# build:
# context: .
# dockerfile: ./support/docker/production/Dockerfile.buster
image: johnxlivingston/peertubelivechat:production-buster
env_file:
- .env
Then saved the file and ran docker-compose up -d
which had Peertube 3.4 with Prosody pre-installed, with that working I could then install the Livechat plugin from the Peertube Administration --> Plugins/Themes:

Once you have installed the Livechat plugin you might need to add the API URL to get the Livechat plugin to work, for me that URL was http://localhost:9000. The fix of adding localhost:9000 was a result of the plugin author responding to my issue right away with a fix, so that was pretty awesome of John Livingston!

After that I was able to incorporate Livechat into my Peertube live streaming videos which was pretty awesome!

I wonder if doing this with the straight-up Docker image versus Docker Engine would make for a different experience? I am not sure, but worth experimenting on that front with another instance, but for now bava.tv is running cleanly with the livechat plugin working, and I am very, very happy.
*Although I had managed to convert from traefik to nginx for the reverse proxy a little while ago (with help from Chris Blankenship), so I was not entirely clueless about what I was getting into.
