Pi Garage Deployment

The next decision to make was how to deploy the backend application. I had many different ways that I could release the application. However there were some key considerations to make.

  • Ease of deployment (especially for target audience)
  • Versioned releases
  • Ease of rollback?

This lead me to consider the following.

NPM package

As the backend is built in Node.JS it would be easy to just push the built packages to npm. Although this would get versioning and rollback I thought that this would be a pretty 💩 experience to deploy and run it.

Zip package

The next idea would be to have a CDN host a zip package that you could download and install. It’s is a bit annoying that you cannot do this natively on GitHub Packages (probably for security reasons with zip files to be honest). So I would need to host this somewhere but that would mean that you would need to know the url for the latest version.

Also I have created linux systemd services before but unless you have an installer it can be quite difficult (especially considering the target audience). So I would need to write an install script as well.

Deb package

As I’m using Rasberry Pi OS (formally Raspbian) it uses deb packages. This could mean that I could simply piggy back off of this as it also gets me the versioning. However I have never created a deb package before and this solution doesn’t work if I decided to change OS to another linux distribution.

Docker (final solution)

To encapsulate all the dependencies to run the app I decided to use Docker to deploy the backend service. This allows me to have cross device/OS support (to a degree) and then install/update becomes much easier as the node version for example is contained within the Docker image.

The only caveat that you needed to run the container in “privileged” mode so that it could access the Raspberry Pi’s GPIO from inside Docker container.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *