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 Security Server Ubuntu 20.04 to 22.04 In-place Upgrade. 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
For MongoDB database backup see https://www.mongodb.com/docs/manual/core/backups/#:~:text=You%20can%20create%20a%20backup,an%20exact%20moment%20in%20time.
For PostgresSQL database backup see https://www.postgresql.org/docs/12/backup.html
Gradually migrate MongoDB 4.4 to 5.0, then to 6.0 as https://www.mongodb.com/docs/upcoming/release-notes/6.0-upgrade-standalone/#upgrade-recommendations-and-checklists 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 https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-standalone/
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 https://www.mongodb.com/docs/upcoming/release-notes/6.0-upgrade-standalone/#upgrade-a-standalone-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
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: