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 backups | Server backup script | |
|---|---|---|
| Where | System Settings → Backups | Installation directory |
| When | Every night, automatically, and on demand | When you run or schedule it |
| Content | Business data and application files | Everything: business data, user accounts, files, licence, configuration |
| Use | Recover business data | Rebuild 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.
- Linux
- Windows
sh scripts/backup-stack.sh [destination-directory]
.\scripts\backup-stack.ps1
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:
cronon 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.
- Extract the new package next to the installation, never over it.
- From the new package directory, first run a simulation, which shows what would change without changing anything:
- Linux
- Windows
./install.sh --upgrade /opt/nadigit-ims --dry-run
./install.sh --upgrade /opt/nadigit-ims
.\install.ps1 -Upgrade C:\nadigit-ims -DryRun
.\install.ps1 -Upgrade C:\nadigit-ims
- Then run the actual upgrade (second command).
What the upgrade does
- Refuses to go backwards: a package older than the running version is refused.
- Loads the new version's images.
- Backs everything up before touching anything: databases, persistent data
and configuration, into
backups/pre-upgrade-<from>-to-<to>-<date>/. - 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.
- Starts the new version and waits for every component. The database schema is migrated automatically at startup.
- 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.