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.
-
Install the Sonata Stats on your new server.
-
Then, you will need to edit this file /usr/share/queues-stats/backend/.env
DB_ASTERISK_HOST=VITALPBX_IP_SERVERDB_ASTERISK_PORT=3306DB_ASTERISK_USERNAME=REMOTE_MYSQL_USERDB_ASTERISK_PASSWORD=REMOTE_MYSQL_SECURE_PWDOn this configuration, you will need to enter the IP address of the asterisk, server port, and credentials.
- In the Linux CLI, execute the command below.
mysql -uroot -e"create database sonata_stats"- Create a user with all permissions for the sonata_stats database.
mysql -urootgrant all privileges on sonata_stats.* to “stats”@“localhost” identified by “SECURE_PWD”
- On the .env file edit these configurations and enter the credentials created in the previous step.
DB_USERNAME=statsDB_PASSWORD=SECURE_PWD- From this location /usr/share/sonata/queues-stats/backend execute these commands
php artisan config:cachephp artisan migrate- To create our admin user, we have to execute the command below.
php artisan tinker- 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());- Finally, edit the file /var/lib/sonata/stats/wizard.conf and configure the flag below.
installed=yesNow, you should be able to access sonata stats from your new server.
Was this article helpful?
Your feedback helps us improve the documentation.
Thank you for helping us improve!
