My snappy website

I wanted to start this off with an interesting point about how I develop and deploy my website. I'll start off with a note:

Note: I'm not going to be talking about Flatpak, Appimage (or insert whatever other packaging format is cool right now here) right here, just what I'm using and workflow. Snappy fits my workflow so I'm using it :)


Let's start off with the technology. Snappy is a packaging format from Canonical the makers of Ubuntu. I have been around Ubuntu for almost 10 years now so it seemed like an easy choice but from a technology standpoint it also helps quite a bit. What Snappy does it wraps up all the things needed for your app and it makes a super portable installer for most Linux platforms. Your mileage may vary on non-Debian/Ubuntu systems but the design is meant to be portable.

It also has some pretty easy to use confinement features which made deploying it a bit of a challenge because I wanted to keep it all in the one package. Basically I only gave the package permissions to do only things in the package and then do a network bind or some external networking (for the database or grabbing assets elsewhere).

How I use it?

The development app life cycle for this website is:

  • Write the code
  • git commit
  • I have a git hook that generates a snapcraft.yaml file
  • When I have something I'm happy with I push it to git (hosted privately on github)
  • Jenkins automatically pulls the git branch periodically
  • Jenkins builds the website with snapcraft and a semi-autogenerated snapcraft.yaml file
  • Install the snap directly or push it up to the snapcraft store privately
  • Snappy will automatically install updates once a day

That is pretty hands off which is how I think app development should be really. It took some fiddling to get it to this point but in the future I can reuse a lot of this life cycle for my Ubuntu apps. Below is the basic Snap config for a django website like mine, I generate mine so I don't change this directly instead just overwrite it when changes are uploaded.

name: shanefagan-com
summary: Shane Fagan's website
version: '20180716'

confinement: strict
description: I wanted a more flexible website that I can add some example code and stuff.
grade: stable

plugin: python
python-version: python3
source: .
stage-packages: [python3-gevent, python3-dev]

command: bin/wsgi
daemon: simple
plugs: [network-bind, network]

Published: 2018-18-07 18:50 UTC