Skip to content
Shenjian Yuan edited this page Mar 31, 2016 · 111 revisions

RapidPro

  1. Create a RapidPro account and get the API key for that account (you will need this key for the below provisioning steps).
  2. Clone the appropriate flows from an existing RapidPro account and import them into your new account.
  3. Within each flow, make sure to point the Webhooks to the appropriate EUMS hostname (which is specified below in the provisioning steps).
  4. 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
  1. Config the RapidPro server

    1. Add contact group named EUMS
    2. Make sure all below fields exist in the EUMS group: (Please note it's case sensitive)
    Field Name Type
    firstname Text
    lastname Text
    districts Text
    ips Text
    outcomes Text
    types Text

EUMS

Environment Variables

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 The email password that corresponds to the email account for exporting csv reports
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; see map reference
MAP_LONGITUDE No the longitude that represents the center longitude of your respective map; see map reference
MAP_LEVEL No this is the zoom level for your respective map; see map reference
ADMIN_PASSWORD Yes this is the password for the EUMS super user for logging into the EUMS system after a deploy
SENTRY_DSN Yes this is the Sentry DSN that corresponds to the appropriate Sentry account used by EUMS to communicate with Sentry
GA_TRACKING_ID Yes this is the Google Analytics ID that corresponds to the appropriate EUMS instance

Prerequisites

  1. Make sure the system requirements of the new production server meet the ones given here.
  2. 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).
  3. Make sure you have obtained the appropriate GeoJSON map file for your EUMS instance. Refer to the map reference to understand what is needed for obtaining the appropriate GeoJSON map file.

Deployment Steps

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 ...

  1. 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.
  2. 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.
  3. 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 ...

  1. Clone a previous production-like pipeline. Make sure the name reflects your new production deploy (e.g. 'eums-prod-uganda').
  2. Update the environment variables in the pipeline's top level 'Environment Variables' tab. Refer to the above environment variables table. Save the new pipeline.
  3. 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.)
  4. Un-pause the pipeline.
  5. Kick off the first stage of the pipeline, 'fetch-artifacts'. Wait for this stage and the 'packaging' stage to complete.
  6. Once the 'packaging' stage is complete, place the GeoJSON map in the appropriate directory on the Go server through the following steps:
  • ssh into the Go 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'.
  1. 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).