# Updating CrushMFT

CrushMFT updates itself. It asks crushftp.com for the newest version, downloads it, checks its signature and switches to it
without a restart: connected users stay connected, an idle connection moves to the new version, and a transfer in progress
finishes on the version it started on. You start an update from [About](Admin-About.md), or let the server do it on its own.

## Where updates come from

- **Two channels.** *Releases* (the default) are the versions published as releases; *Daily builds* are every build, usually
  newer than the latest release. Preferences, Updates chooses the channel; **Check for updates** on the About page asks which
  one to look at.
- **One address.** Everything comes from `https://www.crushftp.com/updates/27/` with plain HTTPS downloads. A firewall needs
  to let the server reach `www.crushftp.com` on port 443. A server behind a proxy uses the update proxy of Preferences,
  Updates; a DMZ server fetches its update through its internal server.
- **Only signed versions.** Every version comes with a signed list of its files. The server checks the signature and the
  SHA-256 of every file before it installs anything, and installs only the files the list names. A file that does not match
  is never used.

## What is downloaded

An update downloads only what changed since the version you run:

- **One small file with the changes.** From any of the last 100 builds, and from every release, there is a file that holds
  just the changes from that version to the newest one. From the build before it is usually well under a megabyte; from far
  back, a few megabytes. The server rebuilds the new files from the ones it has and checks each against the signed list.
- **The whole version, when there is no such file.** A server further back, or one whose small file can not be used, downloads
  the whole version as one zip of about 33 MB. A few small files that are still missing come one by one.
- **Downloaded ahead.** When a check finds a newer version, the server downloads it at once (by default), so **Update now**
  only has to switch.

To download whole versions only, start CrushMFT with the Java option `-Dcrushmft.update_delta=false` (see
[Java and memory settings](Java-and-Memory.md) for where Java options go).

## Update now

**Update now** on the About page asks for confirmation, then shows the download and the switch in a progress window. The
window closes by itself once the server switches; the page shows the new version a few seconds later.

- If another update is already running, the page says so and starts nothing.
- **Cancel** stops the download, and calls off the switch until the moment it is handed over.
- With *Restart* chosen under Preferences, Updates, the server restarts instead of switching, and every user is disconnected.

## Update when idle

**Update when idle** stops new logins at once and installs the update once no transfer and no job runs, on its own. Users
already connected stay connected. While it waits, the About page says **Updates when idle** and shows the waiting with a
**Call off** button: Call off lets logins in again (a download already running goes on).

If the update ends without installing anything (there is nothing newer, or the download fails), logins are let in again by
themselves.

## The versions on this server

The About page lists the versions kept on this server: the one running, the one before it, and versions downloaded but not
switched to yet. **Switch to this version** moves to one of them; going back is explained in
[Going back to the version before](Updates-Rollback.md).

## Without internet access

A server that can not reach crushftp.com updates from the CrushMFT27.zip download: see
[Updating without internet access](Updates-Offline.md).
