# Updates and versions

A CrushMFT 27 container can get a new version in two ways: you start a newer image, or CrushMFT's own updater fetches one. Both are signed builds, both are put at the top of the volume the same way, and the version before is kept in the volume to go back to. At every start the **newer version** runs: `27.0.0_290` is newer than `27.0.0_289`.

## Updating by image

```
docker pull crushftp/crushmft27:27.0.0_290
docker stop -t 120 crushmft27 && docker rm crushmft27
docker run -d --name crushmft27 ... crushftp/crushmft27:27.0.0_290    # the same options and volume as before
```

At the start the image's version is staged in the volume and put at the top; the version before stays in `backup/updates/` as the one to go back to. Your settings, users and jobs are untouched, and the files you may change in `WebInterface/` (`favicon.ico`, `expired.html`, `mime_types.txt`) are kept.

With Compose: change the tag (or keep `latest`), then `docker compose pull && docker compose up -d`. With Kubernetes: `helm upgrade ... --set image.tag=27.0.0_290` ([Kubernetes and Helm](Kubernetes.md#upgrade)).

## Updating in the app

CrushMFT's updater works in a container as on any server: it finds a newer build, fetches it into the volume, checks its signature and switches to it while the server runs, without a restart (connections that are open finish on the old version). The admin pages show its state on the About page and in Preferences, Updates.

The next start of the container keeps that newer version, even though the image is older: the volume's version is newer. The log says:

```
CrushContainer: The volume runs version 27.0.0_295, newer than the image's 27.0.0_289 (an in-app update): it keeps running.
```

So an in-app update is never undone by a restart. When you later start an image newer than the volume's version, the image's version runs.

## Pinning a version

To decide the version only by image tag:

1. Pin the tag (`crushftp/crushmft27:27.0.0_290`, not `latest`).
2. Turn CrushMFT's updater off (below), so it does not fetch a newer build into the volume.

## Turning the updater off

Two settings, as [split_prefs](Configuration.md#settings-as-files-split_prefs) files in `/app/CrushMFT27/split_prefs/`:

| File | Content |
|---|---|
| `_daily_check_and_auto_update_on_idle.txt` | `false` |
| `_daily_check_and_auto_update_on_idle_all_builds.txt` | `false` |

They apply from the very first start. In the Kubernetes chart: `inAppUpdater: false`. You can also turn the automatic update off in the admin pages (Preferences, Updates); the files make sure it stays off.

## Going back a version

The volume keeps the version before the current one in `backup/updates/v<version>/` (and more, as set in the updater's settings). To go back:

- **In the admin pages:** the About page lists the versions the server keeps, with **Switch to this version**. The switch happens without a restart.
- **And the image:** at the next container start, an image newer than the version you chose puts its own version at the top again. To stay on the older version, start the image of that version (or an older one) from then on.
- Starting an older image alone does **not** go back: the volume's newer version keeps running.

A version that fails to start is marked bad on the volume and the version kept before it is put back; the update screen can allow it again.

## Which version runs

- The About page shows it.
- The log of the start shows it (`CrushContainer: Version 27.0.0_289, ...`).
- The image's label `com.crushftp.version` shows which version the image brings ([Images and tags](Images.md#which-build-is-in-an-image)).

## Old versions in the volume

CrushMFT keeps the current version, the one before it and a few more in `backup/updates/`, and removes older ones by itself (the count is the updater's backup setting). Each is about 45 MB.
