Upgrade Chef Supermarket
This document explains how to upgrade Supermarket.
Supported versions
Progress Chef supports Supermarket 5.0 and later. For more details about supported Chef Software, see the supported versions documentation.
PostgreSQL bundled with Supermarket
Supermarket is bundled with PostgreSQL. The following table shows which version of PostgreSQL is bundled with each Supermarket version.
Supermarket version | PostgreSQL version |
---|---|
>= 4.2 and < 5.0 | 9.3 |
>= 5.0 and < 5.2 | 13.4 |
>= 5.2 | 13.18 |
Before you upgrade
Use these guidelines to choose the correct upgrade process:
If you’re upgrading from Supermarket 4.2.x to Supermarket 5.x, this also upgrades the version of PostgreSQL embedded with Supermarket. This process requires extra steps for managing the database and Supermarket configuration. Follow the Upgrade to Supermarket 5.0 documentation.
If you want to upgrade from a version earlier than 4.2 to Supermarket 5.x, first upgrade to Supermarket 4.2.x using the regular upgrade process, then upgrade to version 5.x.
For all other upgrades, follow the regular upgrade process.
Upgrade Supermarket
To upgrade Supermarket, follow these steps:
Stop the Supermarket services:
sudo supermarket-ctl stop
Back up the
/var/opt/supermarket
directory.Download a Supermarket package from Chef Downloads.
Install the new package using your distribution’s package manager:
For Ubuntu:
dpkg -i /path/to/package/supermarket*.deb
For RHEL:
rpm -Uvh /path/to/package/supermarket*.rpm
Start the Chef Supermarket services:
sudo supermarket-ctl start
Reconfigure Chef Supermarket server:
sudo supermarket-ctl reconfigure
After the upgrade finishes, restart the services that run Chef Supermarket to clear the old installation from server memory.
systemctl list-units | grep runsvdir
Restart the unit:
systemctl restart <UNIT_NAME>
This restarts the
runsvdir
,runsv
, andsvlogd
service processes that run Chef Supermarket.
Upgrade to Supermarket 4.2.x to 5.x
When you upgrade from Supermarket 4.2.x to 5.x, this also upgrades PostgreSQL from 9.3 to 13.x. This process requires a one-time downtime to vacuum, upgrade, and re-index the database.
Configure PostgreSQL in the Supermarket settings
Prepare for the upgrade:
In the
supermarket.rb
settings, set thepg_upgrade_timeout
attribute to the intended timeout value in seconds.For example:
default['supermarket']['postgresql']['pg_upgrade_timeout'] = <SECONDS>
Set this value based on your data size.
Remove the
checkpoint-segments
attribute from yoursupermarket.rb
settings:# This setting is EOL in Supermarket 5.x and PostgreSQL 13 # default['supermarket']['postgresql']['checkpoint_segments']
PostgreSQL removed the
checkpoint_segments
attribute and we removed it from the Supermarket configuration.
Prepare PostgreSQL embedded with Supermarket
Prepare the PostgreSQL database for upgrading:
Create a backup of the PostgreSQL databases:
cd / sudo -u supermarket /opt/supermarket/embedded/bin/pg_dumpall -U supermarket -p 15432 > /tmp/supermarket-dump.sql
Important: Always back up your PostgreSQL data before upgrading. Store a copy of the backup in a separate, safe location that is not on the Supermarket server. This ensures you can restore your data if anything goes wrong during the upgrade.
Vacuum the database:
cd / sudo -u supermarket /opt/supermarket/embedded/bin/vacuumdb --all --full -p 15432
This reduces the database size by deleting unnecessary data and speeds up the migration. Vacuuming takes about 1 to 2 minutes per gigabyte of data, depending on data complexity, and requires free disk space at least as large as your database.
For more information, see the
vacuumdb
documentation.
Upgrade Supermarket
To upgrade Supermarket, follow these steps:
Stop the Supermarket services:
sudo supermarket-ctl stop
Back up the
/var/opt/supermarket
directory.Download a Supermarket package from Chef Downloads.
Install the new package using your distribution’s package manager:
For Ubuntu:
dpkg -i /path/to/package/supermarket*.deb
For RHEL:
rpm -Uvh /path/to/package/supermarket*.rpm
Reconfigure Chef Supermarket server:
sudo supermarket-ctl reconfigure
After the upgrade finishes, restart the services that run Chef Supermarket to clear the old installation from server memory.
systemctl list-units | grep runsvdir
Restart the unit:
systemctl restart <UNIT_NAME>
This restarts the
runsvdir
,runsv
, andsvlogd
service processes that run Chef Supermarket.
Clean up the PostgreSQL database
Follow these steps to remove the old PostgreSQL installation and clear the cache:
Stop Supermarket:
sudo supermarket-ctl stop
Start the newly installed PostgreSQL server:
sudo supermarket-ctl start postgresql
Reindex the PostgreSQL database:
sudo -u supermarket /opt/supermarket/embedded/bin/reindexdb --all -p 15432
reindexdb
rebuilds PostgreSQL database indexes.Restart Supermarket:
sudo supermarket-ctl restart
Release-specific upgrade: Chef Infra Server 15.8.x
If you use Private Supermarket and upgrade to Chef Infra Server version 15.8.0 or above, refresh your logins and re-authenticate Supermarket with Chef Identity.
Troubleshooting
Recovering from database cleanup failures
If the vacuumdb
or reindexdb
commands fail, follow these steps:
Drop the Supermarket PostgreSQL database:
/opt/supermarket/embedded/bin/psql -U supermarket -d postgres -p 15432 -c "drop database supermarket"
Recreate the Supermarket PostgreSQL database:
/opt/supermarket/embedded/bin/psql -U supermarket -d postgres -p 15432 -c "create database supermarket"
Restore the Supermarket PostgreSQL database from the existing
supermarket-dump-archive.sql
dump file:/opt/supermarket/embedded/bin/psql -U supermarket -d supermarket -p 15432 -f /tmp/supermarket-dump-archive.sql
Restart Supermarket:
supermarket-ctl restart