Upgrading


Upgrading Minio

First, you'll need to install the mc command:
  1. Backup your server
  2. Visit the MinIO console at media.your-server.social:45135 and log in with the MINIO_ROOT_USER from the server config file at /etc/default/minio. Visit "Access Keys" and create an Access Key + Secret Key
  3. Install the mc command. This will need an alias - use the Access Key + Secret Key created in the previous step. There's also a detailed guide on how to create an alias available. Use port 9000 for the alias' address (media.your-server.social:9000).
  4. Now you can follow the upgrade guide, but if you haven't used systemctl edit --full to edit the service file, you need to ensure that the systemd service file won't get overwritten and forget its custom settings. So, do it like this:
    1. (Backup the systemd service file: cp /lib/systemd/system/minio.service /lib/systemd/system/minio.service.bak)
    2. Install the deb package (you can copy/paste from the minio upgrade guide to get the current version):

      wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_<current_version>_amd64.deb -O minio.deb
      sudo dpkg -i minio.deb


    3. (Restore the systemd service file: cp /lib/systemd/system/minio.service.bak /lib/systemd/system/minio.service)
    4. Update the service definition: sudo systemctl daemon-reload
    5. Restart the service: mc admin service restart ALIAS
    6. Check service health: mc admin info ALIAS

  5. Reboot the server to ensure that the service will survive a reboot

If you forgot your alias' name, run mc alias list.

You should also update the mc commandline tool, both on the server and on your local installation where you pull backups from: mc update

Upgrading Mastodon to Debian 12 Bookworm

  1. Follow the Debian Upgrade Guide
  2. Elasticsearch will complain about 2 missing packages: libicu67 and libidn11
    1. Download them from the links above using the command:
      wget -O <local-file>.deb
    2. Install using the command:
      sudo dpkg -i <local-file>.deb

Upgrading PostgreSQL from version 15 to version 16

  1. Stop all Mastodon services:
    systemctl stop mastodon-*

  2. Check the installed clusters:
    pg_lsclusters

    I only had one, looked like this:
    Ver Cluster Port Status Owner Data directory Log file
    15 main 5432 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log


    If version 16 is already listed, you'll need to drop it:
    sudo pg_dropcluster 16 main --stop

  3. Stop the service and upgrade:
    sudo service postgresql stop
    sudo pg_upgradecluster 15 main


    I got warnings in the style:
    WARNING: database "mastodon_production" has a collation version mismatch
    We'll deal with them below.

  4. Restart the service and check the version:
    sudo service postgresql restart
    psql --version

    This should report version 16 now.

  5. For fixing the collation:
    1. Enter the database system
      sudo -u postgres psql
      This will list your databases.
    2. For each database, run the following commands to upgrade the collation:
      \c <database>
      REINDEX DATABASE <database>;
      ALTER DATABASE <database> REFRESH COLLATION VERSION;

    3. Elasticsearch also complained about a view, so we run:
      \c mastodon_production
      REFRESH MATERIALIZED VIEW instances;

    4. We're done, leave with:
      \q

  6. We're now ready to restart Mastodon:
    systemctl restart mastodon-{web,sidekiq,streaming}.service

  7. Now it's time to clean up:
    1. Drop old database cluster:
      sudo pg_dropcluster 15 main
      pg_lsclusters

    2. Remove old database system packages:
      dpkg -l | grep postgres
      sudo apt remove postgresql-15 postgresql-client-15
Last edited: 17 March 2024 07:30:19