-
Notifications
You must be signed in to change notification settings - Fork 13
Deployment Guide
- Create a RapidPro account and get the API key for that account (you will need this key for the below provisioning steps).
- Clone the appropriate flows from an existing RapidPro account and import them into your new account.
- Within each flow, make sure to point the Webhooks to the appropriate EUMS hostname (which is specified below in the provisioning steps).
- Make sure to apply the following labels to the corresponding flows (it is important to specify these correctly in order for the EUMS application to work):
Flow | Label Name |
---|---|
IP Flow | IMPLEMENTING_PARTNER |
Middle Man / Sub-consignee Flow | SUB_CONSIGNEES |
End User Flow | END_USER |
The following environment variables need to be set in order for a successful deployment. Note that for deploying from the CI server, the 'Secure Variable?' column refers to whether the variable needs to be set in the Secure Variable section of the 'Environment Variables' tab in the top level section for the pipeline. If you are not deploying EUMS from the CI server, disregard that column.
Variable Name | Secure Variable? | Explanation |
---|---|---|
DEPLOY_USER | No | this is the deploy user you will set up in step 1 below |
DEPLOY_HOST | No | this is the IP or hostname of the production server |
EUMS_HOST | No | this will be the hostname of the production server |
DJANGO_SECRET_KEY | Yes | this should be set to a unique, unpredictable value |
RAPIDPRO_API_TOKEN | Yes | this is the token that corresponds to the appropriate RapidPro account that the production server will be talking to |
EMAIL_PASSWORD | Yes | we are unsure if this is necessary so can put a random placeholder here for now |
VISION_USER | Yes | this is the user name you will use to sync the vision data |
VISION_PASSWORD | Yes | this is the password you will use to sync the vision data |
VISION_BUSINESS_AREA_CODE | No | this is the business area code you will use to sync the vision data |
TIME_ZONE | No | the time zone for your instance; you can find time zones here |
MAP_LATITUDE | No | the latitude that represents the center latitude of your respective map |
MAP_LONGITUDE | No | the longitude that represents the center longitude of your respective map |
MAP_LEVEL | No | this is the zoom level for your respective map |
ADMIN_PASSWORD | Yes | this is the password for the EUMS super user for logging into the EUMS system after a deploy |
-
Make sure the system requirements of the new production server match the specs given here.
-
Also, the expectation is that outside of the normal libraries that come installed with the OS, nothing else has been installed. For example, the initial deploy depends on PostgreSQL not having been set up yet (PostgreSQL is set up during the automated deployment).
Deployment is currently done using the Go Release Management system. Below are the steps for deploying EUMS to production. Note that the steps for the production server only need to be done once, as well as a few of the initial steps for the Go Release Management server.
On the new production server ...
- Create a deploy user with a home directory (no password necessary). This user should be the same one referenced in the environment variable section above.
- Allow remote access via public / private keys.
- Create or retrieve the public key for the user on the machine being deploying from.
- Copy this public key to a 'authorized_keys' file within the the /home/<name-of-deploy-user>/.ssh/ directory on the production server.
- Allow this user to run sudo on any command without a password.
- Run 'sudo visudo'
- Add this line to the bottom of the file: 'deployuser ALL=(ALL) NOPASSWD:ALL' (without quotes)
On the Go Release Management server ...
- Clone a previous production-like pipeline. Make sure the name reflects your new production deploy (e.g. 'eums-prod-uganda').
- Update the environment variables in the pipeline's top level 'Environment Variables' tab. Refer to the above environment variables table. Save the new pipeline.
- Place the new pipeline within the 'eums-prod' environment. You can do this via the 'Environments' menu item at the top of the page. (This allows a dedicated agent to pick and execute production deploys.)
- Un-pause the pipeline.
- Kick off the first stage of the pipeline, 'fetch-artifacts'. Wait for this stage and the 'packaging' stage to complete.
- Once the 'packaging' stage is complete, place the map in the appropriate directory.
- ssh into the CI server. Switch to the go user (sudo su - go)
- cd to the /var/lib/go-agent2/pipelines/<name of your new pipeline>/
- Create a 'map' directory in this directory.
- Within the 'map' directory, place your map GeoJSON file. This map GeoJSON file must be named 'districts.json'.
- Reminder: Ensure your map environment variables are set correctly. This tool provides a way to find the appropriate latitude, longitude, and zoom level of your map for EUMS.
- Kick off the 'deploy' stage. This should take roughly 20-30 minutes.
For doing subsequent upgrades to the production server, repeat steps 5) through 7).