Skip to main content

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 versionPostgreSQL version
>= 4.2 and < 5.09.3
>= 5.0 and < 5.213.4
>= 5.213.18

Before you upgrade

Use these guidelines to choose the correct upgrade process:

Upgrade Supermarket

To upgrade Supermarket, follow these steps:

  1. Stop the Supermarket services:

    sudo supermarket-ctl stop
    
  2. Back up the /var/opt/supermarket directory.

  3. Download a Supermarket package from Chef Downloads.

  4. 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
      
  5. Start the Chef Supermarket services:

    sudo supermarket-ctl start
    
  6. Reconfigure Chef Supermarket server:

    sudo supermarket-ctl reconfigure
    
  7. After the upgrade finishes, restart the services that run Chef Supermarket to clear the old installation from server memory.

    systemctl list-units | grep runsvdir
    
  8. Restart the unit:

    systemctl restart <UNIT_NAME>
    

    This restarts the runsvdir, runsv, and svlogd 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:

  1. In the supermarket.rb settings, set the pg_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.

  2. Remove the checkpoint-segments attribute from your supermarket.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:

  1. 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.

  2. 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:

  1. Stop the Supermarket services:

    sudo supermarket-ctl stop
    
  2. Back up the /var/opt/supermarket directory.

  3. Download a Supermarket package from Chef Downloads.

  4. 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
      
  5. Reconfigure Chef Supermarket server:

    sudo supermarket-ctl reconfigure
    
  6. After the upgrade finishes, restart the services that run Chef Supermarket to clear the old installation from server memory.

    systemctl list-units | grep runsvdir
    
  7. Restart the unit:

    systemctl restart <UNIT_NAME>
    

    This restarts the runsvdir, runsv, and svlogd service processes that run Chef Supermarket.

Clean up the PostgreSQL database

Follow these steps to remove the old PostgreSQL installation and clear the cache:

  1. Stop Supermarket:

    sudo supermarket-ctl stop
    
  2. Start the newly installed PostgreSQL server:

    sudo supermarket-ctl start postgresql
    
  3. Reindex the PostgreSQL database:

    sudo -u supermarket /opt/supermarket/embedded/bin/reindexdb --all -p 15432
    

    reindexdb rebuilds PostgreSQL database indexes.

  4. 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:

  1. Drop the Supermarket PostgreSQL database:

    /opt/supermarket/embedded/bin/psql -U supermarket -d postgres -p 15432 -c "drop database supermarket"
    
  2. Recreate the Supermarket PostgreSQL database:

    /opt/supermarket/embedded/bin/psql -U supermarket -d postgres -p 15432 -c "create database supermarket"
    
  3. 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
    
  4. Restart Supermarket:

    supermarket-ctl restart
    
Edit this page on GitHub

Thank you for your feedback!

×