Skip to content
Download

How to move Sonata Stats to a remote server?

If you’d like to move Sonata Stats to another server, to reduce the load on the main VitalPBX server.

  1. Install the Sonata Stats on your new server.

  2. Then, you will need to edit this file /usr/share/queues-stats/backend/.env

DB_ASTERISK_HOST=VITALPBX_IP_SERVER
DB_ASTERISK_PORT=3306
DB_ASTERISK_USERNAME=REMOTE_MYSQL_USER
DB_ASTERISK_PASSWORD=REMOTE_MYSQL_SECURE_PWD

On this configuration, you will need to enter the IP address of the asterisk, server port, and credentials.

  1. In the Linux CLI, execute the command below.
mysql -uroot -e"create database sonata_stats"
  1. Create a user with all permissions for the sonata_stats database.
mysql -uroot

grant all privileges on sonata_stats.* to “stats”@“localhost” identified by “SECURE_PWD”

  1. On the .env file edit these configurations and enter the credentials created in the previous step.
DB_USERNAME=stats
DB_PASSWORD=SECURE_PWD
  1. From this location /usr/share/sonata/queues-stats/backend execute these commands
php artisan config:cache
php artisan migrate
  1. To create our admin user, we have to execute the command below.
php artisan tinker
  1. Then, we have to paste the following code.
use App\Role;
use App\User;
$user = User::updateOrCreate(
['name' => 'admin'],
['password' => 'enter your password here',
'full_name' => 'admin',
'tenant_id' => 1,
'tenant' => 'vitalpbx']
);
$user->roles()->sync(Role::where('name', 'admin')->first());
  1. Finally, edit the file /var/lib/sonata/stats/wizard.conf and configure the flag below.
installed=yes

Now, you should be able to access sonata stats from your new server.