- 06 Feb 2026
- 1 Minute to read
-
Print
-
DarkLight
-
PDF
Back Up or Restore a Polarity Server
- Updated on 06 Feb 2026
- 1 Minute to read
-
Print
-
DarkLight
-
PDF
How to back up and restore a standard Polarity Server v5 system on the Polarity Server’s command line.
Polarity Server Backups
The Polarity Server runs a cron job daily at midnight (system time) to back up the following components:
The Polarity database (schema and data dumps)
The
.envfileAll installed integrations
These backups are place in the /app/backups directory by default, and are named in this format:
polarity-server-backup-YYYYMMDDhhmmss.tgz
where:
YYYYis the 4-digit yearMMis the 2-digit monthDDis the 2-digit day of the monthhhis the 2-digit hour of the day (in 24-hour time format)mmis the minute of the hourssis the seconds
Manual Backups
The Polarity Command Line Utility may be used to create a manual backup in the same format, on demand.
To initiate a manual back up:
Log into the Polarity Server’s back end operating system command line as the root user or a user with
sudoprivileges.Change working directories to the
/appdirectory:cd /app
Execute the Polarity Server backup command:
bin/polarity backupThis command will assess the current state of the system and create a backup file, as described above.
Restoring Polarity Server Backups
A Polarity Server backup file may be restored using the same Polarity Command Line Utility.
Log into the Polarity Server’s back end operating system command line as the root user or a user with
sudoprivileges.Change working directories to the
/appdirectory:cd /app
Execute the Polarity Server restore command:
bin/polarity restore /absolute/path/to/polarity-server-backup.tgzThis command will:
Drop the currently-loaded Polarity database
Restore the database in the backup file
Replace the database-related variables in the
.envfile with those from the backup fileRestore the integrations from the backup file
Upon successful completion of this restore process, restart the Polarity Server containers:
cd /app && ./down.sh && ./up.sh
Note
If you receive an error during the restore process warning that one or more roles do not exist in the database, simply create the role(s) with the following command:
source /app/.env && psql -h $POLARITY_DB_HOST -U $POLARITY_DB_USER -d $POLARITY_DB_DATABASE -c “create role [MISSING_ROLE];”where
[MISSING_ROLE]is replaced with the role indicated by the error.After this, attempt the restore process again.