Upgrade from 5.x to 6.0

From Proxmox Mail Gateway
Revision as of 13:43, 20 August 2019 by Stoiko Ivanov (talk | contribs) (Created page with "== Introduction == Proxmox Mail Gateway 6.x is based on a new major version of Debian. Carefully plan the upgrade, '''make and verify backups''' before beginning, and test ext...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Proxmox Mail Gateway 6.x is based on a new major version of Debian. Carefully plan the upgrade, make and verify backups before beginning, and test extensively. Depending on the existing configuration, several manual steps — including some downtime — may be required.

Note: A valid and tested backup is always needed before starting the upgrade process. Test the backup beforehand in a test lab setup.

In case the system is customized and/or uses additional packages or any other third party repositories/packages, ensure those packages are also upgraded to and compatible with Debian Buster.

In general, there are two ways to upgrade a Proxmox Mail Gateway 5.x system to Proxmox Mail Gateway 6.x:

  • A new installation (and restoring the configuration and database from the backup)
  • An in-place upgrade via apt (step-by-step)

In both cases emptying the browser cache and reloading the GUI page is required after the upgrade.

New Installation

  • Install Proxmox Mail Gateway in one of the following three ways:
  • Restore the backup you have made before the upgrade.
  • Change the IP address and the hostname.
  • For clustered setups:
    • setup the slaves again
    • then join them to the upgraded master-node (recreate the cluster).

In-place Upgrade

Preconditions

  • Upgrade to the latest version of Proxmox Mail Gateway 5.2.
apt update
apt dist-upgrade
  • Make a valid and tested backup of Proxmox Mail Gateway
pmgbackup backup
  • At least 1GB free disk space at root mount point.

In-place upgrades are done with apt. Familiarity with apt is required to proceed with this upgrade mechanism.

Actions step-by-step

sed -i 's/stretch/buster/g' /etc/apt/sources.list

Make sure to also edit all files in /etc/apt/sources.list.d/ accordingly. For a Installation from the ISO with the enterprise repository the following command will work:

echo "deb https://enterprise.proxmox.com/debian/pmg buster pmg-enterprise" > /etc/apt/sources.list.d/pmg-enterprise.list

  • Stop postfix and all Proxmox Mail Gateway services (emails will be queued by the servers trying to contact the Proxmox Mail Gateway)

This is necessary to prevent changes to the database before the upgrade

systemctl stop postfix pmg-smtp-filter pmgpolicy pmgdaemon pmgproxy pmgmirror pmgtunnel
  • Mask postfix and all Proxmox Mailgateway services to prevent them from starting during the upgrade
systemctl mask postfix pmg-smtp-filter pmgpolicy pmgdaemon pmgproxy pmgmirror pmgtunnel 

  • If you have a cluster:
    • Stop and mask all cluster-daemons on all nodes before you start the upgrade of the first node.
systemctl stop pmgmirror pmgtunnel
systemctl mask pmgmirror pmgtunnel
    • Then proceed by upgrading all nodes sequentially.
    • The service is provided by the nodes not being upgraded.
  • Upgrade the system:
apt update
apt dist-upgrade
  • Before you upgrade the postgres main cluster, you need to remove the automatically created cluster in the new version.
pg_dropcluster --stop 11 main
  • Upgrade the postgres main cluster from 9.6 to 11 by using pg_upgradecluster
    • If possible, use the default setting of dumping the old databases and restoring them to avoid problems.
pg_upgradecluster -v 11 9.6 main
  • Unmask postfix and all non-cluster Proxmox MG services to enable them again.
systemctl unmask postfix pmg-smtp-filter pmgpolicy pmgdaemon pmgproxy
  • Reboot and control the journal to ensure that everything runs correctly.
reboot
  • Remove the old postgres version and its data:
apt purge postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6

After the Proxmox Mail Gateway upgrade

  • After upgrading, unmask and start all cluster-daemons. This applies to upgrades of a single node as well as to upgrades of all nodes in a clustered setup:
systemctl unmask pmgmirror pmgtunnel
systemctl start pmgmirror pmgtunnel

Potential issues

  • If you've modified the configuration template for postgresql (/var/lib/pmg/templates/postgresql.conf), make sure to compare and update your copy in /etc/pmg/templates/
  • Also compare all other templates you've overriden for new changes through the packages

External links