mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-24 18:09:41 -04:00
Add terraform/development for retrieving credentials for local development use
This commit is contained in:
@@ -36,24 +36,39 @@ In addition to terraform directories in the api and admin apps above:
|
||||
|
||||
## Terraform
|
||||
|
||||
### Development
|
||||
|
||||
There are several remote services required for local development:
|
||||
|
||||
* s3
|
||||
* ses
|
||||
* sns
|
||||
|
||||
Credentials for these services are created by running:
|
||||
|
||||
1. `cd terraform/development`
|
||||
1. `./run.sh`
|
||||
|
||||
This will append credentials to your `.env` file. You will need to manually clean up any prior runs from that file if you run that command again.
|
||||
|
||||
Offboarding: Service key bindings can be cleaned up from cloud.gov by running `./run.sh -d` yourself, or another developer running `./run.sh -d -u USER_TO_CLEANUP`
|
||||
|
||||
### Cloud.gov
|
||||
|
||||
The cloud.gov environment is configured with Terraform. See [the `terraform` folder](../terraform/) to learn about that.
|
||||
|
||||
## AWS
|
||||
|
||||
In addition to services provisioned through cloud.gov, we have several services provisioned directly in AWS. Our AWS services are currently located in the us-west-2 region using the tts-sandbox account. We plan to move to GovCloud shortly.
|
||||
In addition to services provisioned through cloud.gov, we have several services provisioned via [supplemental service brokers](https://github.com/GSA/usnotify-ssb) in AWS. Our AWS services are currently located in [several regions](https://github.com/GSA/usnotify-ssb#aws-accounts-and-regions-in-use) using Studio-controlled AWS accounts.
|
||||
|
||||
To send messages, we use Amazon Web Services SNS and SES. In addition, we use AWS Pinpoint to provision and manage phone numbers, short codes, and long codes for sending SMS.
|
||||
|
||||
In SES, we are currently using the "sandbox" mode. This requires email addresses to be pre-registered in the AWS console in order to receive emails. The DKIM settings live under the verified domain entry.
|
||||
|
||||
In SNS, we have 3 topics for SMS receipts. These are not currently functional, so senders won't know the status of messages.
|
||||
|
||||
Through Pinpoint, the API needs at least one number so that the application itself can send SMS for authentication codes.
|
||||
|
||||
The API also has access to AWS S3 buckets for storing CSVs of messages and contact lists. It does not access a third S3 bucket that stores agency logos.
|
||||
|
||||
SES and SNS for use by the cloud.gov-deployed apps is currently in the process of migrating to being provisioned through cloud.gov. Currently, SES, SNS, and S3 for local-development are still manually provisioned in AWS.
|
||||
|
||||
## New Relic
|
||||
|
||||
We are using [New Relic](https://one.newrelic.com/nr1-core?account=3389907) for application monitoring and error reporting. When requesting access to New Relic, ask to be added to the Benefits-Studio subaccount.
|
||||
@@ -62,32 +77,42 @@ We are using [New Relic](https://one.newrelic.com/nr1-core?account=3389907) for
|
||||
|
||||
- [ ] Join [the GSA GitHub org](https://github.com/GSA/GitHub-Administration#join-the-gsa-organization)
|
||||
- [ ] Get permissions for the repos
|
||||
- [ ] Get access to the cloud.gov org && space
|
||||
- [ ] Get access to the cloud.gov org && spaces
|
||||
- [ ] Get [access to AWS](https://handbook.tts.gsa.gov/launching-software/infrastructure/#cloud-service-provider-csp-sandbox-accounts), if necessary
|
||||
- [ ] Get [access to New Relic](https://handbook.tts.gsa.gov/tools/new-relic/#how-do-i-get-access-to-new-relic), if necessary
|
||||
- [ ] Pull down creds from cloud.gov and create the local .env file
|
||||
- [ ] Create the local `.env` file by copying `sample.env` and running `./run.sh` within the `terraform/development` folder
|
||||
- [ ] Do stuff!
|
||||
|
||||
## Setting up the infrastructure
|
||||
|
||||
These steps are required for new cloud.gov environments. Local development borrows SES & SNS infrastructure from the `notify-staging` cloud.gov space, so these steps are not required for new developers.
|
||||
|
||||
### Steps to prepare SES
|
||||
|
||||
1. After the first deploy of the application with the SSB-brokered SES service completes:
|
||||
1. Log into the SES console and navigate to the SNS subscription page.
|
||||
2. Select "Request confirmation" for any subscriptions still in "Pending Confirmation" state
|
||||
2. (For sandbox SES accounts) Go to SES console for \$AWS_REGION and create new origin and destination emails. AWS will send a verification via email which you'll need to complete.
|
||||
3. Find and replace instances in the repo of "testsender", "testreceiver" and "dispostable.com", with your origin and destination email addresses, which you verified in step 1 above.
|
||||
1. Select "Request confirmation" for any subscriptions still in "Pending Confirmation" state
|
||||
1. Find and replace instances in the repo of "testsender", "testreceiver" and "dispostable.com", with your origin and destination email addresses, which you verified in step 1 above.
|
||||
|
||||
TODO: create env vars for these origin and destination email addresses for the root service, and create new migrations to update postgres seed fixtures
|
||||
|
||||
### Steps to prepare SNS
|
||||
|
||||
1. Go to Pinpoints console for \$AWS_PINPOINT_REGION and choose "create new project", then "configure for sms"
|
||||
2. Tick the box at the top to enable SMS, choose "transactional" as the default type and save
|
||||
3. In the lefthand sidebar, go the "SMS and Voice" (bottom) and choose "Phone Numbers"
|
||||
4. Under "Number Settings" choose "Request Phone Number"
|
||||
5. Choose Toll-free number, tick SMS, untick Voice, choose "transactional", hit next and then "request"
|
||||
6. Go to SNS console for \$AWS_PINPOINT_REGION, look at lefthand sidebar under "Mobile" and go to "Text Messaging (SMS)"
|
||||
7. Scroll down to "Sandbox destination phone numbers" and tap "Add phone number" then follow the steps to verify (you'll need to be able to retrieve a code sent to each number)
|
||||
#### Move SNS out of sandbox.
|
||||
|
||||
At this point, you _should_ be able to complete both the email and phone verification steps of the Notify user sign up process! 🎉
|
||||
1. Visit the SNS console for the region you will be sending from. Notes:
|
||||
1. SNS settings are per-region, so each environment must have its own region
|
||||
1. Pinpoint and SNS have confusing regional availability, so ensure both are available before submitting any requests.
|
||||
1. Choose `Text messaging (SMS)` from the sidebar
|
||||
1. Click the `Exit SMS Sandbox` button and submit the support request. This request should take at most a day to complete. Be sure to request a higher sending limit at the same time.
|
||||
|
||||
#### Request new phone numbers
|
||||
|
||||
1. Go to Pinpoint console for the same region you are using SNS in.
|
||||
1. In the lefthand sidebar, go the `SMS and Voice` (bottom) and choose `Phone Numbers`
|
||||
1. Under `Number Settings` choose `Request Phone Number`
|
||||
1. Choose Toll-free number, tick SMS, untick Voice, choose `transactional`, hit next and then `request`
|
||||
1. Select `Toll-free registrations` and `Create registration`
|
||||
1. Select the number you just created and then `Register existing toll-free number`
|
||||
1. Complete and submit the form. Approval usually takes about 2 weeks.
|
||||
1. Set this phone number as the `AWS_US_TOLL_FREE_NUMBER` in the environment you are creating
|
||||
|
||||
Reference in New Issue
Block a user