Charmed PostgreSQL VM

Channel Revision Published Runs on
latest/stable 345 09 Nov 2023
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 239 09 Feb 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 226 01 Apr 2021
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
14/stable 468 11 Sep 2024
Ubuntu 22.04
14/stable 467 11 Sep 2024
Ubuntu 22.04
14/candidate 468 02 Sep 2024
Ubuntu 22.04
14/candidate 467 02 Sep 2024
Ubuntu 22.04
14/beta 502 23 Oct 2024
Ubuntu 22.04
14/beta 503 23 Oct 2024
Ubuntu 22.04
14/edge 514 09 Nov 2024
Ubuntu 22.04
14/edge 513 09 Nov 2024
Ubuntu 22.04
juju deploy postgresql --channel 14/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04 16.04 14.04

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:

Air-gapped setup summary

1. Export snaps and charms
2. Transfer binary blobs
3. Import snaps and charms
4. Deploy PostgreSQL

Air-gapped day-to-day example

1. Export snaps and charms

Exporting VM SNAPs and Charms and are currently independent processes. The store-admin tool is designed to simplify the process.

Future improvements are planned to the store-admin tool so that it could potentially export all necessary SNAP resource(s) from the official SnapStore with Charms simultaneously. Other planned improvements include supporting the export of specific charm and resource by revisions (PF-5369, PF-5185).

Charms

The necessary charm(s) can be exported as bundle or independently (charm-by-charm). See the Snap Proxy documentation:

The bundle export example:

store-admin export bundle postgresql-bundle --channel=14/edge --series=jammy --arch=amd64
Downloading postgresql-bundle revision 140 (14/edge)
  [####################################]  100%
Downloading data-integrator revision 71 (edge)
  [####################################]  100%
Downloading grafana-agent revision 286 (edge)
  [####################################]  100%          
Downloading landscape-client revision 69 (edge)
  [####################################]  100%
Downloading pgbouncer revision 473 (1/edge)
  [####################################]  100%          
Downloading postgresql revision 487 (14/edge)
  [####################################]  100%          
Downloading postgresql-test-app revision 256 (edge)
  [####################################]  100%          
Downloading s3-integrator revision 59 (edge)
  [####################################]  100%          
Downloading self-signed-certificates revision 200 (edge)
  [####################################]  100%          
Downloading sysbench revision 78 (edge)
  [####################################]  100%          
Downloading ubuntu-advantage revision 113 (edge)
  [####################################]  100%          
Successfully exported charm bundle postgresql-bundle: /home/ubuntu/snap/store-admin/common/export/postgresql-bundle-20241008T083251.tar.gz

SNAPs

Usually charms require SNAPs (and some manually pin them). For the manual SNAP exports, follow the official Snap Store Proxy documentation: Offline Charmhub configuration > Export SNAP. Data team is shipping the mapping snap.yaml to the published bundle.yaml:

Warning: always use snap.yaml and bundle.yaml from the same Git commit (to match each other)!

store-admin export snaps --from-yaml snaps.yaml
Downloading grafana-agent revision 51 (latest/stable amd64)
  [####################################]  100%          
Downloading grafana-agent revision 82 (latest/stable amd64)
  [####################################]  100%          
Downloading charmed-pgbouncer revision 16 (1/edge amd64)
  [####################################]  100%          
Downloading charmed-postgresql revision 133 (14/edge amd64)
  [####################################]  100%          
Downloading canonical-livepatch revision 282 (latest/stable amd64)
  [####################################]  100%          
Successfully exported snaps:
grafana-agent: /home/ubuntu/snap/store-admin/common/export/grafana-agent-20241008T082122.tar.gz
charmed-pgbouncer: /home/ubuntu/snap/store-admin/common/export/charmed-pgbouncer-20241008T082122.tar.gz
charmed-postgresql: /home/ubuntu/snap/store-admin/common/export/charmed-postgresql-20241008T082122.tar.gz
canonical-livepatch: /home/ubuntu/snap/store-admin/common/export/canonical-livepatch-20241008T082122.tar.gz

2. Transfer the binary blobs

Transfer the binary blobs using the way of your choice into the air-gapped environment.

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/

Note: always check checksum for the transferred blobs!

3. Import snaps and charms

Import the snap and charm blobs into local air-gapped CharmHub:

Note: when importing machine charms that depend on a snap for functionality, you must first manually import the required snap.

sudo snap-store-proxy push-snap /var/snap/snap-store-proxy/common/snaps-to-push/charmed-postgresql-20241008T082122.tar.gz

sudo snap-store-proxy push-charm-bundle /var/snap/snap-store-proxy/common/charms-to-push/postgresql-bundle-20241003T104903.tar.gz

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

4. Deploy PostgreSQL

Deploy and operate Juju charms normally:

juju deploy postgresql

Note: All the charms revisions and snap revisions deployed in the air-gapped environment must match the official CharmHub and SnapStore revisions.

Use the official release notes as a reference.

Additional resources

If you expect having several concurrent connections frequently, it is highly recommended to deploy PgBouncer alongside PostgreSQL. For more information, read our explanation about Connection pooling.