An overview of the most important EMG components are shown below. EMG itself consists of a server application, emgd, and a web application. They both talk to a MySQL database. The server application optionally also runs one or more plugins. These may also talk to the MySQL database.
The EMG owner at the bottom left is the company that runs and configures the EMG components. Their customers are shown at the top left. These customers typically have three roles: an administrator, normal users, and applications. These talk to EMG in various ways, and pay the EMG owner for the traffic they send.
To the bottom right are one or more operators, which receive the traffic from EMG and forward this to mobile phones. This traffic is paid for by the EMG owner, which hopefully then can make a profit from the price difference.
More concretely, the source code for the server application and web portal are maintained in private Git repositories. The compiled artefacts are then pushed to docker.io as public docker images.
The EMG owner, when installing a new EMG server, needs to do several things. The public “emg-prod” repository contains many of the scripts and configuration files needed here.
- Install a Docker server, for running various images.
- Install a MySQL server, and create the database to be used.
- Install a web server, e.g., Apache or Nginx.
- Install the Let’s Encrypt Certbot for generating TLS certificates. Other tools may of course be used here.
Next, a few files need to be created or updated.
- In the etc/server.cfg file, the ADDRESS parameter in the “DB emg” section must be updated to match the database created earlier.
- Create the file emgd.env, and add the usernames and passwords of any external services, as introduced in EMG 7.2.9. You can set the database credentials here as well if you prefer.
- Create the file portal.env, used by the run-portal.sh script. Here, EMG_PORTAL_DB must be set to the full URL of the database. In this file you can also set SMTP_HOST, SMTP_PORT, SMTP_USERNAME and SMTP_PASSWORD for the SMTP service that EMG Portal will use for sending password reset links etc.
Update the hostname in portal.conf, and then copy the file to /etc/nginx/conf.d. Now, start the web server, and then get a TLS certificate. For example:
letsencrypt -d emg.example.se --nginx -m email@example.com
The run-emgd.sh script will combine the necessary files into an emg.pem file used by emgd.
Then run the run-migrations.sh script. This will create the necessary database tables.
After this, you can run the run-emgd.sh script, to start emgd. Please examine the etc/log/general file for warnings, and make any corrections needed. Running the “./emgstat” script will run the emgstat command within the emgd docker container, showing the list of available connectors.
Then, run the run-portal.sh script. This will start the web portal application. Opening a web browser and pointing it towards your server, should now reach the EMG Portal.
You can now add customers and operators as needed. Some options are easiest to add in the server.cfg file, but most things can be done in the web application.