How to deploy in an offline or air-gapped environment¶
An air-gapped environment refers to a system that does not have access to the public internet. This guide goes through the special configuration steps for installing Charmed PostgreSQL VM in an air-gapped environment.
Requirements¶
Canonical does not prescribe how you should set up your specific air-gapped environment. However, it is assumed that it meets the following conditions:
DNS is configured to the local nameservers.
Juju 3
Juju is configured to use local airgapped services.
The
store-admintool is installed and configured.Air-gapped CharmHub is installed and running.
Local APT and LXD Images caches are reachable.
On machines:
A VM/hardware resources are available for Juju
On Kubernetes:
A K8s cluster is running
An air-gapped container registry (such as Artifactory ) is reachable from the K8s cluster over HTTPS
Note: Secure (HTTPS) OCI access is important, otherwise Juju won’t work!
Summary of an airgapped setup¶
The general steps for setting up an airgapped deployment for charms are as follows:
Export the necessary artifacts: charms, snaps, or OCI resources
Transfer the binary blobs into your airgapped environment
Import or upload the artifacts into their corresponding store or registry in the airgapped environment
Deploy PostgreSQL
Export artifacts from online stores¶
Exporting charms, snaps, and OCI resources are currently independent processes. The store-admin tool is designed to simplify the process.
Export snaps (VM only)¶
Machine charms usually require snaps (and some manually pin them).
To learn how to manually exports snaps, follow the official Enterprise Store documentation:
For example:
store-admin export snaps --from-yaml snaps.yaml
Always use the snap.yaml and bundle.yaml from the same Git commit!
The snap.yaml shipped by the PostgreSQL bundle is mapped to the published bundle.yaml .
Export OCI images (K8s only)¶
Follow the official Enterprise Store documentation:
Export charms¶
The necessary charm(s) can be exported as bundle or independently (charm-by-charm). See the Snap Proxy documentation:
For example, to export all charms in the PostgreSQL 14 bundle:
store-admin export bundle postgresql-bundle --channel=14/edge --series=jammy --arch=amd64
store-admin export bundle postgresql-k8s-bundle --channel=14/edge --series=jammy --arch=amd64
There is no bundle yet for PostgreSQL 16.
Contact us for guidance on exporting the right charms for an offline deployment of PostgreSQL 16.
Transfer the binary blobs¶
Transfer the binary blobs using the way of your choice into the air-gapped environment.
For example:
cp /home/ubuntu/snap/store-admin/common/export/*.tar.gz /media/usb/
...
cp /media/usb/*.tar.gz /var/snap/snap-store-proxy/common/<charms-to-push>/
cp /home/ubuntu/snap/store-admin/common/export/postgresql-k8s-bundle-20241003T104903.tar.gz /media/usb/
...
cp /media/usb/postgresql-k8s-bundle-20241003T104903.tar.gz /var/snap/snap-store-proxy/common/<charms-to-push>/
Tip
Always verify the checksum for the transferred blobs!
Import artifacts to airgapped stores¶
Artifacts must now be uploaded into their corresponding stores in the airgapped environment.
Import snaps (VM only)¶
When importing machine charms that depend on a snap for functionality, you must first manually import the required snap.
See:
For example:
sudo snap-store-proxy push-snap /var/snap/snap-store-proxy/common/snaps-to-push/charmed-postgresql-20241008T082122.tar.gz
Import OCI images (K8s only)¶
Before importing Kubernetes charms, ensure that the corresponding OCI image is copied to the local registry, maintaining its original path.
Import charms¶
Upload the charm blobs into the local airgapped Charmhub. See:
sudo snap-store-proxy push-charm-bundle /var/snap/snap-store-proxy/common/<charms-to-push>/postgresql-bundle-20241003T104903.tar.gz
sudo snap-store-proxy push-charm-bundle /var/snap/snap-store-proxy/common/<charms-to-push>/postgresql-k8s-bundle-20241003T104903.tar.gz
Tip
When re-importing charms or importing other revisions, make sure to provide the --push-channel-map.
Deploy PostgreSQL¶
Deploy and operate Juju charms normally:
juju deploy postgresql --channel 16/stable
juju deploy postgresql-k8s --channel 16/stable --trust
Artifact store revisions
All the charm, snap, and OCI revisions deployed in the airgapped environment must match the official Charmhub and Snap Store revisions.
Use the official release notes as a reference.
Additional resources¶
Enterprise Store documentation (formerly Snap Store Proxy)