Deploy in an offline or airgapped environment

This feature requires Juju 3

The feature described in this page is not available on Juju 2.9.

An airgapped 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 MySQL VM in an airgapped environment.

Requirements

Canonical does not prescribe how you should set up your specific airgapped environment. However, it is assumed that it meets the following conditions:

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:

  1. Export the necessary artifacts: charms, snaps, or OCI resources

  2. Transfer the binary blobs into your airgapped environment

  3. Import or upload the artifacts into their corresponding store or registry in the airgapped environment

  4. Deploy MySQL

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:

Caution

Always use the snap.yaml and bundle.yaml from the same Git commit!

The snap.yaml shipped by the MySQL bundle is mapped to the published bundle.yaml.

For example:

store-admin export snaps --from-yaml snaps.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 MySQL bundle:

store-admin export bundle mysql-bundle --channel=8.0/edge --series=jammy --arch=amd64
store-admin export bundle mysql-k8s-bundle --channel=8.0/edge --series=jammy --arch=amd64

Transfer the binary blobs

Transfer the binary blobs using your method of your choice into the airgapped 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/mysql-k8s-bundle-20241006T231254.tar.gz /media/usb/
...
cp /media/usb/mysql-k8s-bundle-20241006T231254.tar.gz /var/snap/snap-store-proxy/common/charms-to-push/

Tip

Always check 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-mysql-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:

For example:

sudo snap-store-proxy push-charm-bundle /var/snap/snap-store-proxy/common/charms-to-push mysql-bundle-20241003T104903.tar.gz
sudo snap-store-proxy push-charm-bundle /var/snap/snap-store-proxy/common/charms-to-push/mysql-k8s-bundle-20241006T231254.tar.gz

When re-importing charms or importing other revisions, make sure to provide the --push-channel-map.

Deploy MySQL

Deploy and operate Juju charms normally:

juju deploy mysql
juju deploy mysql-k8s --trust

Caution

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