PasswordLab Software Upgrade Guide

Upgrading the PasswordLab software ensures you benefit from the latest features, security patches, and performance improvements. Follow these steps to safely upgrade your installation.

1. Preparation

a. Backup Your Data

Before any upgrade, always back up your database and configuration files.

b. Notify Users

Inform users about a short maintenance window, as the service will be restarted.

2. Stop the PasswordLab Service

systemctl stop passwordlab

3. Download the Latest PasswordLab Binary

wget -O /tmp/passwordlab.zip http://download.passwordlab.io/latest.zip

4. Verify the Downloaded Binary

  1. Get the latest SHA1 checksum:

    curl -s https://download.passwordlab.io/shasum.txt
  2. Unzip the downloaded file:

    unzip -o /tmp/passwordlab.zip -d /tmp/
  3. Check the downloaded file:

    sha1sum /tmp/passwordlab
  4. Compare the output with the official checksum. Only proceed if they match.

5. Replace the Old Binary

  1. Create a backup of the existing binary:

    cp /usr/local/bin/passwordlab /usr/local/bin/passwordlab-backup
  2. Copy the new binary:

    cp /tmp/passwordlab /usr/local/bin/
  3. Set executable permissions:
    chmod +x /usr/local/bin/passwordlab

6. Run Database Migration

After updating the binary, run the migration command to upgrade the database schema:

/usr/local/bin/passwordlab --exec upgrade

This ensures your database structure is compatible with the new binary version.

7. Restart the PasswordLab Service

systemctl start passwordlab

8. Verify the Upgrade

9. Rollback (If Needed)

If you encounter issues after the upgrade, follow these steps in order:

  1. Stop the PasswordLab service (if running):

    systemctl stop passwordlab
  2. Make sure the service is stopped before proceeding:

    systemctl status passwordlab
  3. Restore the database from your backup with new database name:
    This is a precautionary step in case the new binary changed the database structure.

    mysql -u [db_username] -p [new_db_name] < /root/passwordlab-backup-YYYYMMDD.sql

    Replace [db_username] and [new_db_name] with your actual values.

  4. Update the new database name in configuration file:

    nano /etc/passwordlab/passwordlab.json

    Change the database name to [new_db_name] and save the file.

  5. Delete the latest binary and replace it with the backup binary:

    rm /usr/local/bin/passwordlab
    cp /usr/local/bin/passwordlab-backup /usr/local/bin/passwordlab
    chmod +x /usr/local/bin/passwordlab
    systemctl restart passwordlab

This order is important: the new binary may have changed the database structure, so always restore the database first, then the old binary.

10. Clean Up

Best Practices

By following this guide, you can safely upgrade your PasswordLab binary with minimal risk and downtime.