- Upgrading EMG Portal (minor upgrade)
- Upgrading from EMG Portal 2 to EMG Portal 3 (major upgrade)
- Re-running aggregation scripts
Upgrading EMG Portal (minor upgrade)
In order to upgrade an existing EMG Portal installation to a new minor version (from 2.x to 2.y or from 3.x to 3.y, where y > x), follow this procedure:
- Backup your existing EMG Portal directory.
cd /var/www/html
tar cvzf /tmp/emgportal2-backup.tar.gz emgportal - Download the latest EMG Portal 3 version to /tmp.
cd /tmp
wget https://nordicmessaging.se/wp-content/uploads/emgportal-eval.php - Extract the archive downloaded above. This must be done as the user that should own the files, user “emg” in this example.
Make sure you exclude the “install” directory and the evaluation license file.su - emg
cd /var/www/html/emgportal
tar xvzf /tmp/emgportal-3*-ioncube-*.tar.gz --exclude "install" --exclude "emgportal_eval.txt" - Apply any new database migrations.
echo yes | protected/yiic migrate
- Check if there are updated versions of aggregation scripts.
diff /var/www/html/emgportal/misc/hourly_summary.pl.sample /home/emg/bin/hourly_summary.pl | grep Change
# (And for EMG Portal 3:)
diff /var/www/html/emgportal/misc/hourly_summary_connector.pl.sample /home/emg/bin/hourly_summary_connector.pl | grep Change
If the version number in the first file is higher then you should replace the file:
If you are aware you have incorrect statistics consider Re-running aggregation scripts.cp /var/www/html/emgportal/misc/hourly_summary.pl.sample /home/emg/bin/hourly_summary.pl
cp /var/www/html/emgportal/misc/hourly_summary_connector.pl.sample /home/emg/bin/hourly_summary_connector.pl - Done! Verify that everything works as expected.
Upgrading from EMG Portal 2 to EMG Portal 3 (major upgrade)
Before installing EMG Portal 3 you need to use EMG 7.1 or later.
In order to upgrade an existing EMG Portal installation to a new major version (from 2.x to 3.y), follow this procedure:
- Backup your existing EMG Portal directory.
cd /var/www/html
tar cvzf /tmp/emgportal2-backup.tar.gz emgportal - Download the latest EMG Portal 3 version to /tmp.
cd /tmp
wget https://nordicmessaging.se/wp-content/uploads/emgportal-eval.php - Extract the archive downloaded above. This must be done as the user that should own the files, user “emg” in this example.
Make sure you exclude the “install” directory and the evaluation license file.su - emg
cd /var/www/html/emgportal
tar xvzf /tmp/emgportal-3*-ioncube-*.tar.gz --exclude "install" --exclude "emgportal_eval.txt" - Apply any new database migrations.
echo yes | protected/yiic migrate
- Update the billing plugin perl file:
cp /var/www/html/emgportal/misc/billing.pl /home/emg/etc/
- Add hourly_summary_connector.pl to crontab by running
cp /var/www/html/emgportal/misc/hourly_summary_connector.pl.sample /home/emg/bin/hourly_summary_connector.pl
crontab -e
and add the following line:* * * * * /home/emg/bin/hourly_summary_connector.pl >>/tmp/hourly_summary_connector.log 2>&1
- In order to enable MO routing add the new mo_routing plugin first copy the plugin perl file:
cp /var/www/html/emgportal/misc/mo_routing.pl /home/emg/etc/
- In EMG Portal add the new plugin via Dashboard -> Plugins -> Add new. Use the information below:
Name: mo_routing
Instances: 1
Library: mo_routing.pl
Database profile: emg
The plugin needs to be referenced (“PLUGIN=mo_routing”) on all connectors where MO messages will be received. - Restart emgd after adding the MO routing plugin.
- Done! Verify that everything works as expected.
Re-running aggregation scripts
If you have upgraded the aggregation scripts you may need to re-run them to fix incorrect statistics.
hourly_summary.pl
- Stop aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.
- Find the timestamp for the oldest entry in the routelog table by running SQL query:
MariaDB [emg]> SELECT MIN(starttime) FROM routelog;
+---------------------+
| MIN(starttime) |
+---------------------+
| 2015-12-13 14:26:12 |
+---------------------+1
row in set (0.00 sec) - Update the relevant record in table emgsystem with the correct timestamp:
UPDATE emgsystem SET value = '2015-12-13 14:26:12' WHERE keyname = 'hourly_summary_last_ts';
- Delete current entries from emgp_hourly_summary where the hour is larger or equal to timestamp above:
DELETE FROM emgp_hourly_summary WHERE time >= '2015-12-13 14';
- As user “emg”, run the aggregation script manually from command-line:
perl /home/emg/bin/hourly_summary.pl
- If everything seems ok, re-enable the cron scripts.
hourly_summary_connector.pl
Same principle as “hourly_summary.pl” above but the entry in table emgsystem has keyname “hourly_summary_connector_next_ts” and has hour resolution.
- Stop aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.
- Find the timestamp for the oldest entry in the routelog table by running SQL query:
MariaDB [emg]> SELECT MIN(starttime) FROM routelog;
+---------------------+
| MIN(starttime) |
+---------------------+
| 2015-12-13 14:26:12 |
+---------------------+
1 row in set (0.00 sec) - Update the relevant record in table emgsystem with the correct timestamp:
UPDATE emgsystem SET value = '2015-12-13 14' WHERE keyname = 'hourly_summary_connector_next_ts';
- Delete current entries from emgp_hourly_summary where the hour is larger or equal to timestamp above:
DELETE FROM emgp_hourly_summary_connector WHERE time >= '2015-12-13 14';
- As user “emg”, run the aggregation script manually from command-line:
perl /home/emg/bin/hourly_summary_connector.pl
- If everything seems ok, re-enable the cron scripts.
- Re-enable the aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.