# Updating RivetMSP

An update has two parts: new application code, then any database changes that code needs. Always take a backup first.

## Before you start

Run a backup, or confirm the scheduled timer ran recently (see [Backups and disaster recovery](/docs/msp/backups-and-disaster-recovery)). A schema migration is exactly the kind of change you want a tested way back from.

## Update a server installed with the install script

```bash
sudo deploy/update.sh
```

The script wraps `scripts/update_cli.php`. It pulls the new code with a plain `git pull`, then runs the pending database migrations up to the version the new code expects.

It deliberately uses `git pull` and never a hard reset. A hard reset in an automated wrapper would silently discard any edit made directly on the box, whereas `git pull` merges or fails loudly.

**Suggested cadence:** monthly, or straight away when a fix you need has shipped. Operating-system security updates arrive on their own if you have run the hardening pass, which enables unattended security upgrades.

## Update a Docker Compose install

```bash
cd RivetMSP
git pull
docker compose up -d --build
```

Then run any pending database updates from the admin area, as described below.

## Database updates, one step at a time

The database version is stored in the settings table. Migrations are a flat sequence of steps and **exactly one version step advances per page load**. In the admin area, the update page keeps showing its **Update Database** button as long as a newer version exists, so crossing several versions means clicking it several times. The command-line equivalent, `scripts/update_cli.php --update_db`, also advances one step per run.

That is normal. Keep going until the page says you are current.

## What to check afterwards

- Sign in and open a ticket and a client.
- Confirm the scheduled backup timer is still active: `systemctl list-timers itflow-backup.timer`.
- Look at the Cron Manager to confirm the last successful run is recent (see [Cron Manager](/docs/msp/cron-manager)).

## Release notes

Every release has notes on the [release notes page](/releases), pulled live from GitHub, including anything that needs a database migration or a change to your configuration.
