6.2 KiB
Infrastructure overview
A diagram of the system is available in our compliance repo.
Notify is a Flask application running on cloud.gov, which also brokers access to a PostgreSQL database and Redis store.
In addition to the Flask app, Notify uses Celery to manage the task queue. Celery stores tasks in Redis.
GitHub Repositories
Application, infrastructure, and compliance work is spread across several repositories:
Application
- notifications-api for the API app
- notifications-admin for the Admin UI app
- notifications-utils for common library functions
Infrastructure
In addition to terraform directories in the api and admin apps above:
We maintain:
- usnotify-ssb A supplemental service broker that provisions SES and SNS for us
- ttsnotify-brokerpak-sms The brokerpak defining SNS (SMS sending)
We use:
- datagov-brokerpak-smtp The brokerpak defining SES
- cg-egress-proxy The caddy proxy that allows external API calls
Compliance
- us-notify-compliance for OSCAL control documentation and diagrams
Terraform
Development
There are several remote services required for local development:
- s3
- ses
- sns
Credentials for these services are created by running:
cd terraform/development./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 to learn about that.
AWS
In addition to services provisioned through cloud.gov, we have several services provisioned via supplemental service brokers in AWS. Our AWS services are currently located in several regions 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 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.
New Relic
We are using New Relic for application monitoring and error reporting. When requesting access to New Relic, ask to be added to the Benefits-Studio subaccount.
Onboarding
- Join the GSA GitHub org
- Get permissions for the repos
- Get access to the cloud.gov org && spaces
- Get access to AWS, if necessary
- Get access to New Relic, if necessary
- Create the local
.envfile by copyingsample.envand running./run.shwithin theterraform/developmentfolder - 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
- After the first deploy of the application with the SSB-brokered SES service completes:
- Log into the SES console and navigate to the SNS subscription page.
- Select "Request confirmation" for any subscriptions still in "Pending Confirmation" state
- 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
Move SNS out of sandbox.
- Visit the SNS console for the region you will be sending from. Notes:
- SNS settings are per-region, so each environment must have its own region
- Pinpoint and SNS have confusing regional availability, so ensure both are available before submitting any requests.
- Choose
Text messaging (SMS)from the sidebar - Click the
Exit SMS Sandboxbutton 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
- Go to Pinpoint console for the same region you are using SNS in.
- In the lefthand sidebar, go the
SMS and Voice(bottom) and choosePhone Numbers - Under
Number SettingschooseRequest Phone Number - Choose Toll-free number, tick SMS, untick Voice, choose
transactional, hit next and thenrequest - Select
Toll-free registrationsandCreate registration - Select the number you just created and then
Register existing toll-free number - Complete and submit the form. Approval usually takes about 2 weeks.
- Set this phone number as the
AWS_US_TOLL_FREE_NUMBERin the environment you are creating
Current Production Phone Numbers
- +18447952263 - in use as default number. Notify's OTP messages and trial service messages are sent from this number
- +18447891134 - to be used by Pilot Partner 1
- +18888402596 - to be used by Pilot Partner 2