Packaging Apps To Run on Any Linux Device

It's a Snap!

It's a Snap

Once you're happy that your snap is working, you should alter the name in your config file so that it will be appropriate and unique in the Snap Store. The next step is to upload to the Snap Store. If you've used Docker, the purpose of the following commands are easy to guess:

$ snapcraft login
$ snapcraft register echo-chrisbinnie
$ snapcraft push echo-chrisbinnie_0.1_amd64.snap --release=candidate

You need an Ubuntu One login for the first step; the second step reserves a name(space) for your snap. The --release option in the last line indicates that you are uploading to the candidate channel.

You should receive email saying that a number of unassisted robots are currently pouring over your code to make sure it's not going to combust spontaneously if someone tries to use it. After it's given a titanium thumbs-up, it will be available in the Snap Store.

The docs remind you that you can't push snaps with confinement set to devmode to either the stable or candidate channels. Figure 8 shows a successful upload; a few moments later, an Upload Status: Approved email should hit your inbox.

Figure 8: Publishing a snap to the Snap Store.

Keep It Snappy

To install this snap from the Snap Store after it's been automagically cleared for usage, it's simply a matter of entering the command:

$ snap install echo-chrisbinnie --channel=candidate

Outside of my chroot, directly on my host prompt, I can now see how my command works:

$ echo-chrisbinnie Chris Loves Linux
Chris Loves Linux

The End

According to the docs, "when you have a working snap, the next step is to use build.snapcraft.io to link your code repository and automate amd64 and armhf builds and releases." This apparently allows fully functional compatibility across many devices.

I hope to get some free time to experiment further with Ubuntu's snaps. Certainly, after a relatively cursory inspection, they hold lots of promise. Although I feel a little late to the party, I'm pleased with the nice, warm feeling knowing that the product has matured somewhat.

The security aspects in snaps make lots of sense for IoT devices and the like, considering that strict confinement is enforced by default. Over time, I'm sure the process of creating snaps will become second nature.

Although the container landscape shifts with changes in power and popularity, you should not dismiss the snaps concept. Should you want to delve deeper into this area, you might also want to look at a very similar product called Flatpak [14]. I hope this article has provided enough food for thought that you will give at least one of these products a try.

Special Thanks

This article was made possible by support from Linux Professional Institute

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Container Apps
    Canonical’s Snapcraft (Snappy) package manager creates self-contained applications that work across Linux distributions. We show you how to install, publish, and run a simple snap.
  • Flatpak, Snap, and AppImage
    The Flatpak, Snap, and AppImage package formats work across distributions, but each has its specific disadvantages.
  • Zero-Ops Kubernetes with MicroK8s
    A zero-ops installation of Kubernetes with MicroK8s operates on almost no compute capacity and roughly 700MB of RAM.
comments powered by Disqus