Skip to main content

Upgrades and backups

This page is about installations on your own server. Every command runs from the installation directory.

Back up​

Two tools complement each other:

Application backupsServer backup script
WhereSystem Settings → BackupsInstallation directory
WhenEvery night, automatically, and on demandWhen you run or schedule it
ContentBusiness data and application filesEverything: business data, user accounts, files, licence, configuration
UseRecover business dataRebuild the installation, move it, protect yourself before an intervention

Application backups are described in Administration. The rest of this section is about the server script, which works while the application is running: it only reads.

sh scripts/backup-stack.sh [destination-directory]

Without a destination, it creates a backup-<date>_<time> directory containing:

  • both databases (business and identities), as backup archives;
  • persistent data: financial documents, uploaded files, licence and application data;
  • a copy of the configuration (.env);
  • a manifest describing the backed-up installation (version, components).
The backup contains secrets

The copy of .env holds the database passwords and technical keys. Store backups in a protected location.

Good practice​

  • Schedule the backup at least once a day: cron on Linux, Task Scheduler on Windows.
  • Copy it off the server. A backup left on the disk it protects is lost with it.
  • Watch disk space: backups, images and databases share the same disk. Delete old backups according to your retention policy.
  • Test a restore from time to time, on another machine: a backup is only reliable once it has been restored successfully.

Upgrade​

Nadigit IMS is upgraded with the installer of the new package, pointed at the existing installation.

  1. Extract the new package next to the installation, never over it.
  2. From the new package directory, first run a simulation, which shows what would change without changing anything:
./install.sh --upgrade /opt/nadigit-ims --dry-run
./install.sh --upgrade /opt/nadigit-ims
  1. Then run the actual upgrade (second command).

What the upgrade does​

  1. Refuses to go backwards: a package older than the running version is refused.
  2. Loads the new version's images.
  3. Backs everything up before touching anything: databases, persistent data and configuration, into backups/pre-upgrade-<from>-to-<to>-<date>/.
  4. Replaces the package files, keeping every replaced file, and merges the configuration: your answers, secrets and settings are kept; only the values the new version changes are updated.
  5. Starts the new version and waits for every component. The database schema is migrated automatically at startup.
  6. Runs the full diagnosis.

Each step prints an identifier, from UPG-01 to UPG-07, explained in TROUBLESHOOTING.md and in Installation troubleshooting.

Two rules to follow​

  • The installation stays in its directory. Part of the data is tied to the directory name, and the licence is bound to the server ID kept in that data. Moving or renaming the directory makes the application start on empty data.
  • Database credentials never change. They are set when the databases are created; changing them by hand cuts the application off from its own data. The upgrade keeps them.

Roll back​

  • Failure before the new version starts: nothing changed for the running application, and files already replaced are put back automatically.
  • Failure after the start: the installer prints the exact commands to return to the previous version. They restore the configuration and the replaced files, kept in install/upgrade-<date>/previous/.
  • Database already migrated by the new version: the previous version refuses to start on a migrated database. Both databases must then be restored from the backup taken before the upgrade; the procedure is in TROUBLESHOOTING.md (UPG-04). If in doubt, contact Nadigit support before acting.

See also​