Seamless PostgreSQL Deployment on RISC-V with Juju and Ubuntu

Seamless PostgreSQL Deployment on RISC-V with Juju and Ubuntu

This article demonstrates the great and simple user experience of deploying PostgreSQL on RISC-V CPU architectures using Juju, Canonical’s open source control plane, and Ubuntu’s diverse packaging options. Drawing inspiration from the talk “PostgreSQL on RISC-V Apt/Snap/Charm/Rock/Juju” presented by Alex Lutay at UbuCon Asia/Africa, we explore how Juju, Charms, and Rocks provide a powerful, model-driven approach for deploying and managing complex data applications like PostgreSQL.

Why PostgreSQL on RISC-V?

PostgreSQL (Postgres) is a powerful, 20-year-old open-source object-relational database system that uses the SQL language. RISC-V is an open-standard Instruction Set Architecture (ISA) that offers flexibility and customisation. Canonical is actively working to make the data ecosystem accessible and stable on the RISC-V architecture.

While the traditional apt package manager is a well-known method for installation, modern application deployment requires more agility, stability, and day-2 operations automation. Canonical provides multiple “flavours” of stable PostgreSQL deployment for AMD64/ARM64, including experimental support for RISC-V on:

  • Debian package
  • Snap package
  • Rock (OCI-compliant container)
  • Charm

The Canonical Vision and Juju Ecosystem

Within Canonical, the Charm Engineering vision is to “Revolutionise the speed and quality of software operations in distributed systems through a unique model-driven approach to deploying, composing and operating software at any scale, on any infrastructure.” This vision is realised through Juju and its associated components:

  • Juju: An open source control plane for the deployment, integration, and lifecycle management of applications at any scale, on any infrastructure.
  • Charm: A Juju operator; business logic encapsulated in reusable software packages for automated application’s life. Charms use Snaps for VM deployments and Rocks for Kubernetes deployments.
  • ROCKs (OCI): OCI-compliant container images, compatible with Docker and Kubernetes, built to be secure and stable by design.

Beyond APT: Why Modern Deployment Methods Matter

The choice of artifact is a wise one, as different methods offer distinct benefits, especially when considering Day-0 (Design, Planning), Day-1 (Provisioning, Deployment), and Day-2 (Monitoring, Maintenance, Upgrade) operations.

Artifact Key Advantages Day-2 Automation
Debian package No setup, well known, Ubuntu PRO (10 years) No Day-2 automation
Snap package No-setup, many versions, easy OS upgrade No Day-2 automation
Rock Popular, many versions, easy OS upgrade No Day-2 automation
Charm VM All above (uses Snaps), Day-2 automations Full
Charm K8s All above (uses ROCKs), Day-2 automations Full

The presentation argues that “APT is not enough!” for production-grade deployments, particularly due to the lack of Day-2 automation and the complexity of managing shared libraries and OS upgrades.

Simple Deployment of PostgreSQL on RISC-V with Charms

Charms and Juju simplify the deployment process across different infrastructures, including RISC-V. The commands are simple and declarative.

1. Deploying on a Virtual Machine with Charm

To deploy a PostgreSQL database on a RISC-V-based virtual machine, you would use the following command:

juju deploy postgresql --channel 16/edge/riscv --base ubuntu@24.04

This single command leverages the postgresql Charm, fetching a RISC-V compatible version from the specified channel and handling the provisioning and deployment (Day-1 operations). Charmed PostgreSQL VM deployment example on RISC-V:

2. Deploying on Kubernetes with a Charm

For a Kubernetes deployment, the Charm uses a Rock image for consistency and stability:

juju deploy postgresql-k8s --channel 16/edge/riscv --base ubuntu@24.04 --trust --force

Example of results:

3. Integrating Applications (Juju Simplicity)

The true power of Juju comes from its ability to easily integrate applications using relations, simplifying complex deployments like setting up Mattermost with a PostgreSQL backend.

Instead of manually configuring connection strings, Juju handles the integration with a single command:

juju integrate postgresql-k8s mattermost-k8s

4. Deploying a Complete Stack with a Simple YAML Bundle

For deploying an entire application stack, Juju uses YAML bundles, making the process repeatable and model-driven.

Here is an example of a simple YAML that defines a PostgreSQL and Mattermost deployment on Kubernetes (amd64/arm64), including a self-signed TLS certificate Charm for security:

bundle: kubernetes
applications:
  db:
    charm: postgresql-k8s
    channel: 14/stable
    trust: true
    num_units: 3
  chat:
    charm: mattermost-k8s
    channel: latest/stable
    num_units: 3
  tls:
    charm: self-signed-certificates
    channel: latest/stable
    num_units: 1
relations:
  - [db:db-admin, chat:db]
  - [db, tls]

This bundle is deployed with one command:

juju deploy ./myportal.yaml --trust

This demonstrates how Juju makes the deployment of complex, integrated systems simple and declarative.

Get Started Today

The necessary tools for this seamless experience are available for download and installation on RISC-V as an experimental snap/charm branches:

Canonical offers solutions for data of all kinds, running wherever you are, with an open-source self-hosted PaaS for cloud, IaaS or K8s. You can find more Charms and deployment models on CharmHub.io!

Contact the Canonical Data team with all your further questions, let’s collaborate!


Interested in joining the team? Canonical is hiring! Apply for career opportunities!

2 Likes