-
Notifications
You must be signed in to change notification settings - Fork 0
Loading Temperate Data
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.
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.
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
ProductionManagementtask from the ECS console. From theProductionManagementtask definition page, highlight a revision and selectRun Taskfrom the actions menu.
In the container overrides, provide the set_throttling_ratessubcommand and arguments as a comma separated list, then hit run.
-
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
ProductionManagementPlanItApptask, select a task revision, then selectRun Taskfrom the actions menu. In the Container Overrides, provide therefresh_tokensubcommand, 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-appcontainer. 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-appcontainer, download the suggested actions files from theazavea-climate-sandboxS3 bucket. Copy them into theplanit-appcontainer, start abashsession, 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>