Skip to content

canonical/postgresql-k8s-bundle

Repository files navigation

Canonical Distribution of PostgreSQL + PgBouncer

Charmhub Release Update bundle Tests

Welcome to the Canonical Distribution of PostgreSQL + PgBouncer.

The objective of this page is to provide directions to get up and running with Canonical PostgreSQL charms.

A repo containing infrastructure, configs, and tests for the PostgreSQL K8s Juju bundle, containing:

These charms are all on edge branches, so this bundle should also be considered an edge product until Canonical is publishing to stable.

Installation

Multipass is a quick and easy way to launch virtual machines running Ubuntu. It uses "cloud-init" standard to install and configure all the necessary parts automatically.

Let's install Multipass from Snap and launch a new VM using "charm-dev" cloud-init config:

sudo snap install multipass && \
multipass launch --cpus 4 --memory 8G --disk 30G charm-dev # tune CPU/RAM/HDD accordingly to your needs

Note: all 'multipass launch' params are described here.

Multipass list of commands is short and self-explanatory, e.g. show all running VMs:

multipass list

As soon as new VM started, enter inside using:

multipass shell charm-dev

Note: if at any point you'd like to leave Multipass VM, enter Ctrl+d or type exit.

All the parts have been pre-installed inside VM already, like Microk8s and Juju (the file '/var/log/cloud-init.log' contains all low-level installation details). Juju uses models to isolate applications, let's add a new model for our K8s application:

juju add-model my-postgresql-k8s

Finally deploy the bundle:

juju deploy postgresql-k8s-bundle --trust # --channel edge # Choose a channel: edge, candidate, stable!
juju status # you are ready!
juju status --watch 1s --storage --relations # watch all the information

Feel free to increase DEBUG verbosity for troubleshooting:

juju model-config 'logging-config=<root>=INFO;unit=DEBUG'
juju debug-log # show all logs together
juju debug-log --include postgresql-k8s/0 --replay --tail # to check specific unit

To destroy the complete Juju model with all newly deployed charms and data:

juju destroy-model my-postgresql-k8s -y --destroy-storage --force

To get rid of multipass VM, run:

multipass delete charm-dev --purge

Bundle Components

  • PostgreSQL - K8s charm to deploy PostgreSQL.
  • PgBouncer - K8s charm to deploy PgBouncer.
  • TLS Certificates - TLS operator.

Note: The TLS settings in bundles use self-signed-certificates which are not recommended for production clusters, the tls-certificates-operator charm offers a variety of configurations, read more on the TLS charm here.

Troubleshooting

If you have any problems or questions, please feel free to reach out. We'd be more than glad to help!

The fastest way to get our attention is to create a discourse post.