Upgrading X-Road Metrics packages when upgrading Ubuntu 20.04 to 22.04
This document describes the steps required to upgrade X-Road Metrics packages on Ubuntu 20.04 LTS host to Ubuntu 22.04.
Refer to https://nordic-institute.atlassian.net/wiki/spaces/XRDKB/pages/82313217 as a base document for in-place upgrades.
Preparations
Review the Ubuntu release notes and upgrade instructions: https://discourse.ubuntu.com/t/jammy-jellyfish-release-notes/24668
Update all packages to the latest versions:
sudo apt update && sudo apt full-upgrade
Recommended: Make sure that you have an up-to-date backup (or virtual machine snapshot) of the server and database
Gradually migrate MongoDB 4.4 to 5.0, then to 6.0 as suggests. Ensure all needed roles are given to MongoDB admin user:
mongo
use admin
db.auth(“root”)
db.grantRolesToUser("root", [{ role: "clusterMonitor", db: "admin" }])
db.grantRolesToUser("root", [{ role: "clusterAdmin", db: "admin" }])
Upgrade MongoDB from 4.4 to 5.0
Check Feature Compatibility Version:
mongo
use admin
db.auth(“root”)
db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})
# should return { "featureCompatibilityVersion" : { "version" : "4.4" }, "ok" : 1 }
Edit
/etc/apt/sources.list
and comment out the repository setting for Ubuntu 20.04 and MongoDB 4.4:
Add key:
Add repo for MongoDB 5.0:
Stop MongoDB:
Upgrade MongoDB to 5.0:
Start MongoDB:
Set Feature Compatibility Version:
Upgrade MongoDB from 5.0 to 6.0
Edit
/etc/apt/sources.list
and comment out the repository setting for Ubuntu 20.04 and MongoDB 5.0:
Add key:
Add repo for MongoDB 6.0:
Stop MongoDB:
Upgrade MongoDB to 6.0:
Start MongoDB:
Set Feature Compatibility Version:
Recommended: mark xroad-metrics-*
deb packages as hold to prevent it from being updated/removed
Optional: mark MongoDB deb packages as hold to prevent them from being updated/removed
Stop X-Road Metrics services
Systemd services:
Cron-based tasks:
Upgrading Ubuntu 20.04 to 22.04
Install
update-manager-core
if it is not already installed.Make sure the Prompt line in
/etc/update-manager/release-upgrades
is set to 'lts'Launch the upgrade tool with the command
sudo do-release-upgrade
Follow the on-screen instructions.
When the upgrade is finished, reboot when prompted.
Upgrade PostgreSQL database
See
Upgrade MongoDB
If MongoDB deb packages were marked to hold:
Add repository for MongoDB 6.0 on Ubuntu 22.04:
Stop MongoDB:
Do upgrade:
Start MongoDB:
Upgrade X-Road Metrics packages
Remove package holding:
Add apt repository:
Upgrade X-Road Metrics packages:
Start X-Road Metrics services
Systemd services:
Cron-based tasks: