Migrating Polarity Servers
Last updated
Last updated
The following instructions walk through the steps required to migrate from an existing Polarity Server (the Source, to a new Polarity Server (the Target).
These instructions will wipe out any data currently existing on the Target server and replace it with data from the Source server.
Ensure the Target server is setup and is running the exact same version of the server as the Source server. You can check the versions by running the following script on both servers and ensuring the RPM versions match:
In the event the versions or RPMs don't match please contact us at for additional instructions on how to upgrade your Source server.
If the servers are the same version, continue with the below instructions.
Both servers need to be running the same version of PostgreSQL to ensure the database backup file from the Source server can be applied correctly to the Target server. To check the version of PostgreSQL that is running locally, use the following command:
Ensure the versions on both servers match.
If your Source server is running version 9.5 of PostgreSQL we recommend upgrading to version 13 prior to doing the migration. Follow the guide below to upgrade the Source servers database to version 13. Once complete, proceed with the rest of the migration steps below.
On both the Source and Target server stop the polarityd
process:
The next step is to backup the source server. Run the following command on the source server:
If you see cannot access
errors related to the logs
directory of integrations these errors can be safely ignored. The backup script does not copy any logs you may have from your integrations but the integrations themselves are copied.
After the backup is complete you will find a tgz
file on the server located at /app/polarity-server-backups
. The backup files include timestamps in the filename. Find the most recent backup file which will be the one you just created. The file will be of the format:
Copy the backup file (new-<date>.sql.tgz
) to the Target server. Once copied over you can now run the database restore script using the following command on the Target server.
Replace new-<date>-sql.tgz
with the path to your database backup copied from the Source server.
Additionally, please ensure you provide the full absolute path to the backup file (not a relative path)
When the restore process finishes you will need to copy the integrations to the correct location on the server using the command:
Finally, ensure the integrations directory is owned by the polarityd
user
You will need to copy the secret key from the Source server config file to the Target server config file. Find the key by opening the config file on the Source server and looking for the property polarity.integrations.secretKey
.
Copy the property polarity.integrations.secretKey
to the config.js
file on the Target server and then save the config.js
file.
The next step is to regenerate the materialized view which contains user statistics information.
Flush the redis backed database cache on the target server to ensure that old database values are not used.
On both the Source and Target server you can now restart the polarityd process:
To ensure all services are up and running as expected you can run the status script on the Target server using the following command:
You may need to move your license file from the Source server to the Target server. If so, please copy the following file from the Source server and place it in the same location on the Target server. The file should be owend by the polarityd:polarityd
user:
After copying, ensure ownership of the license is correct and restart the polarityd
service:
If you get an error that the backup file is not of the right format please ensure that the backup file is readable by the postgres
user. This includes the directory the file is located in. Copying the file to /tmp
will often fix these permission issues.