Moving ABillS to another server

On the test I will transfer the ABillS billing system from one server to another.

First, we will comment out watchdog if it is configured and periodic tasks in cron, stop apache2 to prevent online payments.
Let the billing developers know about the migration to another server so that they reset the binding to the hardware.
Back up the database, billing files and configuration directories:

service apache2 stop
/usr/abills/libexec/periodic backup
cd /root/
tar -cvjf /root/abills_`date +%Y-%m-%d`.tar.bz2 /usr/abills/
tar -cvjf /root/etc_`date +%Y-%m-%d`.tar.bz2 /etc/

If the server is highly loaded, the first time for a test can be performed with a lower priority using the disk system and CPU:

nice -n 19 ionice -c2 -n7 /usr/abills/libexec/periodic backup
nice -n 19 ionice -c2 -n7 tar -cvjf /root/abills_`date +%Y-%m-%d`.tar.bz2 /usr/abills/
nice -n 19 ionice -c2 -n7 tar -cvjf /root/etc_`date +%Y-%m-%d`.tar.bz2 /etc/

Copy backups to the new server in the user’s home directory:

scp -P 22 /usr/abills/backup/stats-`date +%Y-%m-%d`.sql.gz user@
scp -P 22 /root/abills_`date +%Y-%m-%d`.tar.bz2 user@
scp -P 22 /root/etc_`date +%Y-%m-%d`.tar.bz2 user@

On a new server we will partially install ABillS as I described in this article – Installing and configuring the billing system ABillS

Do not forget to transfer the Apache2 configuration /etc/apache2/sites-enabled/abills_httpd.conf

Also transfer or install an SSL certificate, for example from Let’s Encrypt, as I described in the article – Installing Certbot in Ubuntu

On the new server, we will create a MySQL database and users, unpack the archive with a backup copy and import it:

mysql --default-character-set=utf8 -u root -p
drop database abills;
flush privileges;
gzip -d stats-`date +%Y-%m-%d`.sql.gz
tar -xvjf stats_`date +%Y-%m-%d`.tar.bz2
mysql -D abills < stats-`date +%Y-%m-%d`.sql

If the SQL file is large and you can use the PV utility to see the status of the import:

apt install pv
pv stats-`date +%Y-%m-%d`.sql | mysql -u root -D abills

Check the integrity of the database and run a script that will help you find errors:

cd /usr/abills/misc/db_check
cd /usr/abills/misc/
perl apt-get -batch
cd /usr/abills/misc/

Check the logs:


Let’s check the work of additional modules, including payment ones, if billing has also been updated, it’s better to delete your templates and then make changes to new ones, as new fields, functions, etc. can be added to new versions of ABillS in templates.
In FreeRadius we specify the new address of the billing database and restart it.

Check if there are any errors when running billd:

/usr/abills/libexec/billd -all DEBUG=5

When everything is set up we transfer jobs to /etc/crontab

Leave a comment

Leave a Reply