FusionPBX can be setup HA fairly easily. You can use a master-master configuration with Postgres BDR and use any number of filesystem sync tools for your files. Most of the process is actually built into the Fusion install process you just have to know where to look. Note that all this was pulled from my documentation I wrote as I worked through this setup, so there may be better way of doing this but this seems to work. Additionally you may need to make tweaks places for it to work for you. First in download the install files with
wget -O -
https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/debian/pre-install.sh | sh; and then edit the config file /usr/src/fusionpbx-install.sh/debian/resources/config.sh and edit your database settings.
Bash:
# Database Settings
database_password=<DB Password> # random or a custom value (safe characters A-Z, a-z, 0-9)
database_repo=2ndquadrant # PostgreSQL official, system, 2ndquadrant
database_version=9.4 # requires repo official
database_host=<NodeIP> # hostname or IP address
database_port=5432 # port number
database_backup=false # true or false
You also can change you fusionpbx version from master to stable here if you wish. Now edit /usr/src/fusionpbx-install.sh/Debian/resources/postgresql.sh and change the password field to match the database password you set in config.sh
From This:
Bash:
#generate a random password
password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64)
To This:
Bash:
#generate a random password
Password=<db Password>
I have issues with getting config.php to to take my settings, I am sure I am doing something wrong, but I just cahnge it in /usr/src/fusionpbx-install.sh/debian/resources/fusionpbx/config.php
PHP:
//pgsql: database connection information
$db_host = '<DATABASE IP>';
$db_port = '5432';
$db_name = 'fusionpbx';
$db_username = '{database_username}';
$db_password = '{database_password}';
Also I change the database host in /usr/src/fusionpbx-install.sh/debian/resources/finish.sh. Now you can run /usr/src/fusionpbx-install.sh/debian/install.sh
Then you need to go to /usr/src/fusionpbx-install.sh/debian/resources/postgresql and run empty.sh on all but one of the databases then use node.sh to build your BDR cluster, this will need ran on all you databases. You will need to choose whether or not to replicate your freeswitch database as I understand it if you do you may reduce your scalability due to performance issues but without it you will not be able to track things like conference calls across nodes. Honestly I am not sure if node.sh actually makes changes to freeswitch or just sets up the BDR. If it doesn't you can make this change in /etc/freeswitch/autoload_configs/db.conf.xml
Change This:
XML:
<configuration name="db.conf" description="LIMIT DB Configuration">
<settings>
<!--<param name="odbc-dsn" value="$${dsn}"/>-->
</settings>
</configuration>
To This:
XML:
<configuration name="db.conf" description="LIMIT DB Configuration">
<settings>
<param name="odbc-dsn" value="psql://hostaddr=<IP of DB> dbname=freeswitch user=freeswitch password='<DB Password>'"/>
<!--<param name="odbc-dsn" value="$${dsn}"/>-->
</settings>
</configuration>
Then delete /var/lib/freeswitch/db/core.db and restart freeswitch. Last thing is filesystem replication. I think officially syncthing is recomended but you can use any number of programs for this. Syncthing has a web gui which can be nice but you have to build an ssh tunnel to access it. To install it add your nodes to the hosts file in /etc/hosts and use the following to install syncthing:
Bash:
# Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
# Add the "stable" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing
chown www-data:www-data /usr/bin/syncthing
chown -R www-data:www-data /var/www
apt install apt-transport-https
systemctl enable --now syncthing@www-data
To access the Web GUI of Syncthing you need to setup an ssh tunnel before browsing to it. Im sure there is a way to change it so syncthing will listen on more then just local host but you can just use:
ssh -L 8384:127.0.0.1:8384 <USERNAME>@<node IP>
Then browse to 127.0.0.1:8384
I'm sure there are better ways to do this, but this is what I have found. I have never had occasion to put this setup into production, though I put a lot of effort into working out the kinks, but non the less I would recommend testing thing obviously, and if anyone else is reading this I would love feed back on this.