Getting started with the store¶
In this tutorial, we will set up and test the Enterprise Store in an online environment. We will cover how to set the store up, how to make specific snaps available from the store, and how to obtain those snaps on a connected device.
Once you’ve completed this tutorial, you should be able to set the Enterprise Store up in your own environment, connect your devices to it, and be able to use it to control snap revisions on any connected devices.
Lesson plan¶
This tutorial will run through basic processes to set up and utilise an Enterprise Store. We will show you how to:
Install the Enterprise Store in an online environment
Register your store
Pin a revision within the store
Connect a device to the store
Obtain a snap from the store in proxy mode
What you’ll need¶
For this tutorial, you will need:
An x64 system running Ubuntu 22.04 or Ubuntu 24.04
A local user with super user privileges
30GB of free storage
A stable internet connection
Before you begin¶
Ensure LXD is installed on your host machine:
Ensure LXD is set up properly:
Launch two containers, test-store, and test-device:
Note
For this tutorial, it is recommended to open each container in a separate terminal tab or window for convenience.
How-to open a container’s shell
We can open a container by running bash. For example, to open the CLI of the test-store:
This will simulate SSH access to the container, and show you as root within the container:
Enterprise Store installation¶
Within the test-store container, install the Enterprise Store snap and verify the installation:
Next, configure the domain for Enterprise Store:
Warning
During the registration step later, the domain value will be embedded in a store assertion that devices use to securely connect to your enterprise store. Make sure the desired value is set before registering.
Set up a database for the Enterprise Store. This requires installing and configuring PostgreSQL.
Install PostgreSQL:
Configure database for use with the Enterprise Store:
Paste the contents of the following into proxydb.sql.
CREATE ROLE "snapproxy-user" LOGIN CREATEROLE PASSWORD 'snapproxy-password';
CREATE DATABASE "snapproxy-db" OWNER "snapproxy-user";
\connect "snapproxy-db"
CREATE EXTENSION "btree_gist";
Save the file with ctrl + x and press y and then enter when prompted.
Run configure and start the postgres instance:
Configure the Enterprise Store to use the database.
Enter snapproxy-password
, then check that the postgres instance has started successfully:
This will open the postgres database. Return to the store CLI with quit
:
Finally, check the store’s connections:
You should now have the Enterprise Store installed, a valid domain provided by LXD, and a database configured for your store.
Enterprise Store registration¶
Within the test-store container, register your Enterprise Store:
Note
Registering your store will require you to provide some information when prompted. After all information is provided, an ID will be provided for your store.
Use the status
command to retrieve the ID of your store:
Your Enterprise Store is now up and running, now we can connect devices to and install snaps from it.
Connect a device to the store¶
From within the test-device container, connect to your Enterprise Store and acknowledge the store assertion of the Enterprise Store:
Verify the assertion on your device:
Configure test-device to use the store:
Check the store is configured:
Note
This process obtains the store assertion from the test-store and adds that assertion to the system assertion database so the device can trust the store.
Pin a revision in the store¶
The Enterprise Store acts as a proxy for the SaaS Snap Store, allowing you to override revisions in a channel for specific snaps. This allows us to control what can be installed on connected devices. In this tutorial we will use the jq
snap.
Within the test-device, query the available jq version:
This shows the revisions of the snap set for the available channels.
Next, within the test-store, add an override for the jq
snap:
Ensure the override is set properly:
From the test-device, query the jq
snap:
This shows the override in place, providing revision 11 in the latest/stable channel.
Download a snap from the store¶
We have verified that the jq
snap has been overridden, but does this successfully change what is downloaded on a device connected to the store?
Using test-device, try downloading the jq
snap:
By default, the latest/stable
jq
snap is on version 1.5+dfsg-1
, which is
the version you would obtain using the online SaaS Store. In this case, the
override changes the version to that of revision 11, which is 1.6
, and that is
the version test-device should downloaded from the test-store.
Cleaning up¶
To revert the override, refresh to the current stable jq snap, and even remove the device from the Enterprise Store, there are a few steps to go through.
First, from within the test-store, delete the override:
From the test-device, query the jq snap info again:
Now, within the test-device, refresh the snap:
Finally, from within the test-device, we can disconnect the device from the store:
Cleanup¶
This tutorial has deployed a couple of LXC containers on your host machine. Make sure you remove them:
This should return your system to the state it was in before this tutorial.
Next steps¶
Once you’ve completed this tutorial, you may want to try the tutorial for an air-gapped Enterprise Store deployment.