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.
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
Infos
- Docker: https://www.docker.com/
- rkt: https://coreos.com/rkt/docs/latest/
- Open Container Initiative: https://www.opencontainers.org/
- Snapcraft: https://snapcraft.io/
- snapd: https://github.com/snapcore/snapd/blob/master/README.md
- snapcraft.io: https://snapcraft.io/docs/reference/confinement
- Debugging docs: https://snapcraft.io/docs/build-snaps/debugging
- Snapcraft docs: https://snapcraft.io/docs/snaps/metadata
- The snap format: https://snapcraft.io/docs/snaps/metadata
- Snap Store: https://dashboard.snapcraft.io/dev/snaps
- Common snap commands: https://snapcraft.io/docs/core/usage
- Source code: https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap
- Snap tutorial: https://tutorials.ubuntu.com/tutorial/create-your-first-snap
- Flatpak: http://flatpak.org/
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.