First connect to the old Server via SSH and take the backup of AlbiSmart MongoDB database with the following command on Linux/Ubuntu:
cd /api && docker compose exec app php artisan backup
The backup will be generated to the following directory:
/api/storage/backups/history/$date/
for example:
/api/storage/backups/history/12-08-2024
The filename is premise.zip
See an example below:
This backup we can either download from the old server to our pc, and upload it to the new server or we can do it via SCP.
To upload the file to a new server use the following command:
rsync -av /api/storage/backups/history/12-08-2024/premise.zip albismart@10.110.0.253:/home/albismart/
We need to modify the ip addresses(swap ip addresses) with netplan
nano /etc/netplan/xxx
After that we can install AlbiSmart via Wizard and re-import the database by using the following command
cp /home/albismart/premise.zip /api/storage/ cd /api && docker compose exec app php artisan restore --path="/var/www/storage/premise.zip"
Please restart the following services just in case:
cd /api && docker compose exec app bash pkill -9 isc-dhcp-server pkill -9 dhcp pkill -9 dhcpd service isc-dhcp-server restart service freeradiusd restart
The freeeradius database can be pushed with the data via the following commands:
cd /api docker compose exec app bash php artisan tinker
$pppoes = model('internet/pppoe')->noCounter()->where('created_at', '!=', null)->get(); foreach ($pppoes as $pppoe) { \App\Repositories\Action::dispatch('ManagePppoe', ['pppoe' => $pppoe->id, 'action' => 'registerimport']); }
The DOCSIS cable modem tftp files will be generated automatically. However you can also do it via the following commands:
$modems = model('internet/modems')->where('created_at', '!=', null)->get(); $count = $modems->count(); foreach ($modems as $key => $modem) { dump($key . '/' . $count); \App\Repositories\Action::dispatchNow("generatemodemconfig",['model' => $modem, 'restart' => false]); }