Your own in-house snap factory

When working with customers on snaps and Ubuntu Core one of the most asked questions I get in calls and at events in booth discussions is about building your code in-house.

Many companies simply do not allow their sources to leave the house …yet many of these customers have also used before for their test projects …

Typically I point such customers to use lxd and snapcraft manually, or to just go with multipass … but then the question comes up “how do I build for my ARM IoT device” ?

There is no easy way to cross-build snaps so it usually boils down to some complex setup that has some ARM device in the back end doing the actual building and requires some more or less complex work to get it up and running.

This gave me an idea … and I started to write a bunch of pylxd scripts that you could easily install as a snap to do a build in lxd… pretty much like does, just without a UI … This was during the annual company shutdown at the end of last year (canonical shuts down for two weeks over christmas each year).

In February I tried to actually create a UI, using web sockets talking to the build script to show the output … but I didn’t really get forward with this, the result looked like below and my python looked like shell (it always does somehow !!). Even though it didn’t look too bad, I wasn’t really satisfied with the result, this needed someone who is better with UIs than I am:

Bildschirmfoto vom 2020-02-19 17-46-48

I decided to ask my colleague James if he would be interested in a little spare-time Web UI project and pointed him to my three little python scripts on github … the next evening I got a PR with (felt) 100 new files, lots of go and react code … this went on for several weeks during the Covid-19 shutdown and eventually only a few lines of my original python code survived in the end … the app got shinier every day and James did not stop making awesome usability improvements with every commit …

So yet the thing was initially my prototype and I still maintain the code tree and the snap package, let me present you James Jesudasons Fabrica !

Bildschirmfoto von 2020-06-01 21-55-22

Fabrica is your own in-house, it allows you to build any branch of any cloneable git tree (yes, it supports gitlab, not only github and you can select different branches, not just master !)

Bildschirmfoto von 2020-06-02 17-03-15

It will run a native build for the used host architecture inside an lxd container …

Bildschirmfoto von 2020-06-02 17-04-15

Bildschirmfoto von 2020-06-02 17-04-22

You might have noticed the URL in the browser screenshots above, there Fabrica runs a build on top of an Ubuntu Core 18 installed 8GB Raspberry Pi4 where I put the /writable partition onto a very fast USB 3.1 SSD. For the fun of it I made Fabrica build its own git tree in parallel on my local Fabrica instance as well as on

Bildschirmfoto von 2020-06-02 13-39-59

Bildschirmfoto von 2020-06-02 13-39-44

There might be some additional stuff that does here and all this is indeed totally unscientific but I still find 10min faster builds actually significant 🙂

You can easily install Fabrica yourself, it is available for all snap architectures except i386, all you need is an already installed lxd:

sudo snap install lxd
sudo lxd init # just hit enter for all the questions

Then install the Fabrica snap and connect its interfaces:

sudo snap install fabrica
sudo snap connect fabrica:mount-observe
sudo snap connect fabrica:system-observe
sudo snap connect fabrica:lxd lxd

Point your browser to either http://localhost:8000 or use an IP instead of localhost if you are accessing from another machine.

Git trees you add will be checked for new commits every 5 minutes and snap builds start automatically for each new commit of the branch you defined when adding the tree.

There is no auto-upload feature yet, so you need to download the snap through the web UI and manually upload it to the store. The whole thing uses only http, not https and there is no user authentication mechanism, so please do not use Fabrica on an internet site, it is really just designed for usage in a protected LAN currently.

Since it is still some work to set up an instance and since the snap world focuses on pre-made appliances this cycle, here is a first (very experimental) attempt of creating a pi4 pre-configured Ubuntu Core18 appliance that you can just dump on your pi4 to get started quickly (I will write a few more blog posts about building such an appliance image soon)

The source tree as well as the URL for filing issues are linked on the Fabrica page. Any feedback is indeed very very welcome by James and me.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s