Here are general steps to perform the migration:
- Install the required software on a new server;
- Copy the Headwind MDM database
- Copy the Headwind MDM files (executable, configuration, other files)
- Copy the SSL certificates and set up Tomcat (if required)
- Set up ports using iptables (if required)
- Make sure the new server works
- Change the DNS record
Here is the detailed manual.
1. Install the required software
# sudo apt update
# sudo apt install openjdk-8-jdk aapt tomcat8 postgresql
2. Copy the Headwind MDM database
2.1. Make a dump of the database on the legacy server
# su postgres
# pg_dump hmdm > hmdm_dump.sql
2.2. Copy the dump file to the new server
2.3. Create the database on the new server
Notice: keep the old password. The database access credentials can be found in the Headwind MDM configuration file: /var/lib/tomcat8/conf/Catalina/localhost/ROOT.xml (or .../hmdm.xml).
# su postgres
postgres=# CREATE USER hmdm WITH PASSWORD 'topsecret';
postgres=# CREATE DATABASE hmdm WITH OWNER=hmdm;
2.4. Fill the database with the dump
# su postgres
# psql hmdm < hmdm_dump.sql
3. Copy the Headwind MDM files to the new server
Headwind MDM uses files stored in the following directories
Important! /var/lib/tomcat8/conf is a link, not a directory, so do not copy a whole directory, copy its contents only.
For example, you can copy files between servers using scp:
# scp /var/lib/tomcat8/conf/Catalina/localhost/ROOT.xml email@example.com:/var/lib/tomcat8/conf/Catalina/localhost
If you're using FTP to copy files, copy /etc/tomcat8/Catalina/localhost instead of /var/lib/tomcat8/conf/Catalina/localhost, because FTP doesn't resolve Linux links.
4. Copy the SSL certificates and set up Tomcat
This step is required if you are using HTTPS
4.1. Copy the JKS file (Java Key Store) from the old to the new server
4.2. Set up the path and password to the JKS file in /var/lib/tomcat8/conf/server.xml
4.3. If you're using LetsEncrypt and set up automatic certificate renewal, copy the certificate renewal scripts to the new server
See more details about HTTPS here: https://qa.h-mdm.com/1240/
5. Set up ports using iptables
This step is required if you're using standard ports (80 or 443) instead of default Tomcat ports 8080 and 8443. See details here: https://qa.h-mdm.com/1533/
6. Make sure the new server is working
Try to open the web panel on a new server using http and IP address. It must show the login window. Notice: https may not work if you do not specify the domain name. Also, some functions like QR code generation or app uploads may not work as well.
7. Change the DNS record
If everything is working well, change the DNS record so the domain name of your MDM points to the new server.