Migrating FusionPBX to a new server

Status
Not open for further replies.

Bounty

New Member
Aug 31, 2017
22
0
1
44
Hi, I sure could use some help with this one...

I spent months getting my FusionPBX 4.2 server set up and now wish to move it to the cloud.

I would very much appreciate some details on what needs to be moved, poked, and kicked to put it into the new VM I have created running Debian 8 and a FusionPBX 4.4 (clean installs). I saw a recent thread with some round about info but not enough for me to pull this off. Any help would be super!

Thanks!
 

roger_roger

Member
Oct 12, 2016
198
19
18
70
Below is a script that runs on my system every night. It backs up all the necessary files as well as the postgres database. You can run this to back it up and you will wind up with a gz files. Just copy that file to the new server and restore.

Backup Script:
#!/bin/sh
now=$(date +%Y-%m-%d)
#delete backups older 7 days
find /var/backups/fusionpbx/postgresql/fusionpbx_pgsql* -mtime +7 -exec rm {} \;
find /var/backups/fusionpbx/*.tgz -mtime +7 -exec rm {} \;
#delete freeswitch logs older 7 days
find /usr/local/freeswitch/log/freeswitch.log.* -mtime +7 -exec rm {} \;
echo "Starting Backup"
#backup the database
pg_dump -Fc -h 127.0.0.1 -U fusionpbx fusionpbx -f /var/backups/fusionpbx/postgresql/fusionpbx_pgsql_$now.sql
#mysqldump -u root -pZZZ fusionpbx > /var/backup/fusionpbx/mysql/fusionpbx_mysql_$now.sql
#backup the files and directories
tar -zvcf /var/backups/fusionpbx/pbx1-backup_$now.tgz /var/backups/fusionpbx/postgresql/fusionpbx_pgsql_$now.sql /var/www/fusionpbx /usr/local/fre
eswitch/scripts /var/lib/freeswitch/storage /var/lib/freeswitch/recordings /etc/fusionpbx /usr/local/freeswitch/conf /var/scripts
echo "Backup Complete";

Restore Script:

#!/bin/sh
now=$(date +%Y-%m-%d)
remote_server=162.208.16.3
#delete freeswitch logs older 7 days
find /usr/local/freeswitch/log/freeswitch.log.* -mtime +7 -exec rm {} \;
#message to the console
echo "Restoring the Backup"
#extract the backup from the tgz file
tar -xvpzf /var/backups/fusionpbx/backup_$now.tgz -C /
#remove the old database
psql --host=127.0.0.1 --username=fusionpbx -c 'drop schema public cascade;'
psql --host=127.0.0.1 --username=fusionpbx -c 'create schema public;'
#restore the database
pg_restore -Fc --host=127.0.0.1 --dbname=fusionpbx --username=fusionpbx /var/backups/fusionpbx/postgresql/fusionpbx_pgsql_$now.sql
echo "Restore Complete";
 

mfelli

New Member
Dec 24, 2017
16
1
3
44
Hi @Bounty , did you test this? Backing up your 4.2 version, installing new 4.4, then using these gz files to run the restore script and have a running system? I tried and it didn't work for me
 
Last edited:

roger_roger

Member
Oct 12, 2016
198
19
18
70
Hi @Bounty , did you test this? Backing up your 4.2 version, installing new 4.4, then using these gz files to run the restore script and have a running system? I tried and it didn't work for me

You will still need to delete the dial plan entries and run upgrade / app defaults as shown in the upgrade doc. Further, you may be changing freeswitch version and if so, some file locations have changed.
 

mfelli

New Member
Dec 24, 2017
16
1
3
44
The FusionPBX web gui is giving a SQL error like it can't connect to it. Which I got with trying to rsync my old server also to a new provider. So I think I'm missing something. Thanks for that extra info though.
 
Status
Not open for further replies.