Upgrading EMG Portal

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:

  1. Backup your existing EMG Portal directory.
    cd /var/www/html
    tar cvzf /tmp/emgportal2-backup.tar.gz emgportal
  2. Download the latest EMG Portal 3 version to /tmp.
    cd /tmp
    wget https://nordicmessaging.se/wp-content/uploads/emgportal-eval.php
  3. 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"
  4. Apply any new database migrations.
    echo yes | protected/yiic migrate
  5. 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:
    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
    If you are aware you have incorrect statistics consider Re-running aggregation scripts.
  6. 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:

  1. Backup your existing EMG Portal directory.
    cd /var/www/html
    tar cvzf /tmp/emgportal2-backup.tar.gz emgportal
  2. Download the latest EMG Portal 3 version to /tmp.
    cd /tmp
    wget https://nordicmessaging.se/wp-content/uploads/emgportal-eval.php
  3. 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"
  4. Apply any new database migrations.
    echo yes | protected/yiic migrate
  5. Update the billing plugin perl file:
    cp /var/www/html/emgportal/misc/billing.pl /home/emg/etc/
  6. 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
  7. 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/
  8. 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.
  9. Restart emgd after adding the MO routing plugin.
  10. 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

  1. Stop aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.
  2. 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)
  3. 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';
  4. 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';
  5. As user “emg”, run the aggregation script manually from command-line:
    perl /home/emg/bin/hourly_summary.pl
  6. 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.

  1. Stop aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.
  2. 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)
  3. 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';
  4. 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';
  5. As user “emg”, run the aggregation script manually from command-line:
    perl /home/emg/bin/hourly_summary_connector.pl
  6. If everything seems ok, re-enable the cron scripts.
  7. Re-enable the aggregration scripts by commenting out the respective commands from crontab using “crontab -e ” as user “emg”.