Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Loading Temperate Data

Jenny Fung edited this page Feb 27, 2018 · 3 revisions

This is a list of tasks that I had to do for the initial Production deployment for Temperate. Many of them, such as Admin user creation, will not need to be run again, but I think it's useful to have a full log of all actions necessary to deploy Temperate from scratch. These commands are based on the Temperate README, adapted to run in Production.

Pre-Deployment Tasks

Create a Climate API user, add the username and password to the Production tfvars file. The username is the value of ccapi_user, and the password is the value of ccapi_password.

Post-deployment tasks

Before running these tasks, follow the deployment steps outlined in Temperate Deployment.

  • Set Climate API user throttling: The Climate user that was setup before deployment needs to have unlimited throttling. To configure this, run a Climate API ProductionManagement task from the ECS console. From the ProductionManagement task definition page, highlight a revision and select Run Task from the actions menu. ECS console In the container overrides, provide the set_throttling_rates subcommand and arguments as a comma separated list, then hit run. Set Throttling Rates

  • Populate Climate API token: We'll also need to set a Climate API token. Note: This will change the active token associated with your Climate Change API account. Other services using the existing token may lose access. From the ECS Console, select a Temperate ProductionManagementPlanItApp task, select a task revision, then select Run Task from the actions menu. In the Container Overrides, provide the refresh_token subcommand, and then hit run.

  • Do not create test organizations: This should only happen in Staging and Development.

  • Create Admin user: SSH into the bastion host, and from there SSH into a container instance that's running a planit-app container. Start a bash session inside the container, and run the management command.

$ chmod 600 /path/to/ssh-key.pem
$ ssh-add /path/to/ssh-key.pem
$ ssh -A -l ec2-user bastion.climate.azavea.com

# substitute container instance IP for 10.0.x.y
[ec2-user@ip-10-0-0-4 ~]$ ssh 10.0.x.y

# Container ID will be in output
[ec2-user@ip-10-0-x-y ~]$ docker ps | grep planit-app

# Replace <container_id> with container ID
[ec2-user@ip-10-0-x-y ~]$ docker exec -it <container_id> bash
root@111111111111:/usr/src $ ./manage.py createsuperuser
  • Load Suggested Actions: From a container instance that's running a planit-app container, download the suggested actions files from the azavea-climate-sandbox S3 bucket. Copy them into the planit-app container, start a bash session, and then run the management command.
[ec2-user@ip-10-0-x-y ~]$ aws s3 cp s3://azavea-climate-sandbox/missy_cities.csv .
[ec2-user@ip-10-0-x-y ~]$ aws s3 cp s3://azavea-climate-sandbox/missy_strategies_with_weather_events.csv .
# Get planit-app container ID
[ec2-user@ip-10-0-x-y ~]$ docker ps | grep planit-app
[ec2-user@ip-10-0-x-y ~]$ docker cp missy_cities.csv <planit-app container id>:/usr/src
[ec2-user@ip-10-0-x-y ~]$ docker cp missy_strategies_with_weather_events.csv <planit-app container id>:/usr/src
[ec2-user@ip-10-0-x-y ~]$ docker exec -it <planit-app container id> bash
root@111111111111:/usr/src $ ./manage.py  ingest_missy_dataset <cities_csv> <strategies_csv>
Clone this wiki locally