Skip to content

Commit 9b3fe34

Browse files
Merge pull request #6421 from hotosm/fix/ohsome-envvar-infra
Fix/ohsome envvar infra
2 parents b019377 + 5812627 commit 9b3fe34

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/pull_request_template.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ Notes for the reviewer. How to test this change?
3636
- ✅ Provide tests for your changes.
3737
- 📝 Use descriptive commit messages.
3838
- 📗 Update any related documentation and include any relevant screenshots.
39+
- 🔠 Does this PR introduce or change any environment variables? If so, make sure to specify this change in the description.
3940

4041
## [optional] What gif best describes this PR or how it makes you feel?

docs/sysadmins/ci-cd.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We use CircleCI to manage Continuous Integration and Continuous Deployment.
1010
| TeachOSM | deployment/teachosm-tasking-manager |
1111
| Indonesia | deployment/id-tasking-manager |
1212

13-
Each environment has its own set of environment variables which are stored as secrets in the CircleCI Organization Settings under Contexts.
13+
Each environment has its own set of environment variables which are stored as secrets in the CircleCI Organization Settings under Contexts. At the moment, these variables are for the frontend builds only. See the [deployment docs](deployment.md) for updating backend variables.
1414

1515
- OPSGENIE_API
1616
- TM_APP_API_URL

docs/sysadmins/deployment.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ aws s3 sync build/ <TaskingManagerReactBucket> --delete
3636
When deploying updates to the infrastructure or code, follow the steps below.
3737

3838
#### Backup Database
39-
Before updating it's always recommended to backup the database. You can make a snapshot in AWS RDS console, or run the database dump directly. Make sure you have set your security group to allow access to the database on your local machine.
39+
Before updating it's always recommended to backup the database. You can make a snapshot in AWS RDS console, or run the database dump directly. You will need sufficient access to a server on the same VPC as the RDS instance in order to connect to it directly.
4040

4141
```
4242
PGPASSWORD=<PostgresPassword> pg_dump -Fc \
@@ -48,7 +48,7 @@ PGPASSWORD=<PostgresPassword> pg_dump -Fc \
4848

4949
#### Update backend infrastructure
5050

51-
If the deployment contains any changes to the cloudformation template, then we must update the infrastructure prior to deployment. These changes are deliberately outside the CI/CD process to prevent accidental deletion of data.
51+
If the deployment contains any changes to the cloudformation template, including new or changes to environment variables, then we must update the infrastructure prior to deployment. These changes are deliberately set outside the CI/CD process to prevent accidental deletion of data. For the HOT Tasking Manager, only staff with sufficient AWS privileges have the ability to perform these functions.
5252

5353
1. Pull the latest changes locally
5454
2. Run the `cfn-config update` command, keeping in mind to update any new parameters that were added.

scripts/aws/cloudformation/tasking-manager.template.js

+5
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ const Parameters = {
187187
TaskingManagerLogo: {
188188
Description: "URL for logo",
189189
Type: "String"
190+
},
191+
OhsomeStatsToken: {
192+
Description: "Ohsome Stats Token (must be same as frontend)",
193+
Type: "String"
190194
}
191195
};
192196

@@ -474,6 +478,7 @@ const Resources = {
474478
'echo "------------------------------------------------------------"',
475479
cf.sub('export NEW_RELIC_LICENSE_KEY="${NewRelicLicense}"'),
476480
cf.sub('export TM_SENTRY_BACKEND_DSN="${SentryBackendDSN}"'),
481+
cf.sub('export OHSOME_STATS_TOKEN="${OhsomeStatsToken}"'),
477482
'export NEW_RELIC_ENVIRONMENT=$TM_ENVIRONMENT',
478483
cf.sub('NEW_RELIC_CONFIG_FILE=./scripts/aws/cloudformation/newrelic.ini newrelic-admin run-program gunicorn -b 0.0.0.0:8000 --worker-class gevent --workers 5 --timeout 179 --access-logfile ${TaskingManagerLogDirectory}/gunicorn-access.log --access-logformat \'%(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s %(T)s \"%(f)s\" \"%(a)s\"\' manage:application &'),
479484
cf.sub('sudo /usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource TaskingManagerLaunchTemplate --region ${AWS::Region} --configsets default'),

0 commit comments

Comments
 (0)