In case anyone whish to have Sangoma 7 FreePBX running in a container, here are the steps I´ve went through. It seems to be working just fine.
My LXD server is an Ubuntu 18.04 box (x86_64).
Make sure your LXD server accepts network connection and you know the trust password. You will need it in order to start the migration.
- Compile the lxd-p2c binary in your LXD box
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:dqlite/stable
sudo apt update
sudo apt install -y lxc-dev libcap-dev libacl1-dev libdqlite-dev golang-go
go get -v -x github.com/lxc/lxd/lxd-p2c
The binary will be in ~/go/bin/lxd-p2c
Copy the lxd-p2c and the required libraries to the Sangoma VM (which should be the same arch, in my case x86_64):
scp ~/go/bin/lxd-p2c root@[vmipaddress]:/tmp
scp -r /snap/lxd/13487/lib root@[vmipaddress]:/tmp
- Inside the Sangoma virtual machine:
Upgrade the system
yum update -y
fwconsole moduleadmin upgradeall
Install dependencies
yum install python2-lxc tcl libuv -y
Reboot
shutdown -r now
Stop FreePBX services
fwconsole stop
Disable services that won´t run inside the future container
systemctl disable dev-hugepages.mount
systemctl mask dev-hugepages.mount
systemctl disable wpa_supplicant.service
systemctl mask wpa_supplicant.service
systemctl disable plymouth-start.service
systemctl mask plymouth-start.service
systemctl disable auditd.service
systemctl mask auditd.service
systemctl disable chronyd.service
systemctl mask chronyd.service
systemctl disable kdump.service
systemctl mask kdump.service
systemctl disable lm_sensors.service
systemctl mask lm_sensors.service
systemctl disable sys-kernel-config.mount
systemctl mask sys-kernel-config.mount
systemctl disable systemd-sysctl.service
systemctl mask systemd-sysctl.service
systemctl disable tuned.service
systemctl mask tuned.service
Wipe fstab out
mv /etc/fstab /etc/fstab.orig
touch /etc/fstab
Define library dir env variable in order to run lxd-p2c
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/lib
Start the migration process
/tmp/lxd-p2c https://[lxdserveripaddress]:8443 sng7-pbx / --rsync-args “–stats --progress”
Now you can shutdown the VM and go to your LXD server.
- In your LXD server
Start the container
lxc start sng7-pbx
Take a look if it´s fine
lxc exec sng7-pbx – bash
Make sure to start all FreePBX services
fwconsole start
If you want to create an image
lxc stop sng7-pbx
lxc publish sng7-pbx --alias sng7-pbx-64bit
Now you can spin containers like a breeze
lxc init sng7-pbx-64bit mypbxcontainer
lxc start mypbxcontainer
Hope it helps.