If it's your first time setting up for local development, you will need to have the following installed:
- brew (https://brew.sh/)
- git (https://git-scm.com/downloads)
- Docker (https://docs.docker.com/get-docker/)
-
In the root directory of this project, run the setup script:
$ ./bin/setup
-
Navigate to http://localhost:3000. You should see your app!
-
In the root directory of this project, run the dev script:
$ ./bin/dev
To run the linter locally, run the following command: bundle exec standardrb --fix. If you forget to do this, the linter will run when a pull request is opened. To ignore the linter, here is a guide.
To send a test email, you can deploy the application to the staging environment and send an email to a verified identity.
- Let the team know that you're going to use staging and that no one should merge into
main- This is because merging into
mainautomatically triggers a deployment to staging, and will overwrite your branch
- This is because merging into
- in GitHub, go to Actions > Deploy to AWS
- in the "Run workflow" menu:
- Use workflow from:
your branch - The environment to deploy to:
staging - The branch of the infrastructure repository to deploy:
main
- Use workflow from:
- when the deploy is finished, go to the newly deployed staging environment and trigger your email
- you can use the GBH eng team's google group email, it is verified
- Let the team know that you're going to use staging and that no one should merge into
main - In your branch, you can change when the recurring email will be sent by modifying
recurring.ymlunder theStaging:section- You can also, if necessary, tweak the query/queries being used to pull the correct data for testing purposes
- Deploy your branch, as above, to
staging - Test as above
- Confirm your (modified) scheduled email(s) send as expected
- Use this process to iterate, making sure you can get emails for all use cases, translations, etc without errors/alerts in Datadog and Slack
- Revert your changes in your branch and redeploy to
staging - Test again, leaving your branch on
staginguntil the job runs as originally scoped inrecurring.yml
Locally, you can use bin/rails console
On Heroku, you can use heroku run rails c -a <review-app-name>
On Staging and Production, use the bin/ecs_exec script.
-
You must have
awscliinstalled on your machine already (check withaws --version). If not,brew install awsclion your local machine (AWS instructions here). Please download the AWS Session Manager as well following AWS instructions -
You need an
AWS_PROFILEfor Work Requirements (for both Prod and Non-Prod AWS accounts). Follow AWS Identity Center: Configuring SSO instructions to configure your profile correctly.- For your Production profile use
wrsat-prod - For your Staging profile use
wrsat-nonprod
- For your Production profile use
wrsat-non-prod. You can rename your aws profile by editing your ~/.aws/config and ~/.aws/credentials.
- Make sure you're logged into aws:
aws sso login. This should open up an AWS console and have you sign in (if you aren't signed in already). After verification, it'll return you to the terminal - For staging, you can use
bin/ecs_exec - For production, you can pass in
bin/ecs_exec --env production - You can pass in other parameters like:
--desired-status:RUNNINGby default, but can specifySTOPPED. See documentation for list-tasks.--command: if you want to run something other thanbin/sh- There are other commands that the aws ecs can call. The options can be passed manually into the
list-tasks(doc) andexecute-command(doc) commands. See linked documentation.
- Type in
bin/rails c --sandbox(remove--sandboxif you must perform operations that will write/modify data in the db; please pair/try to be loud as possible when performing a write operation)- When you start rails console, it will say
Loading production environment (Rails <version>)for both staging AND production. This is because we don't explicitly set astagingenvironment for the RAILS_ENV in our app, to make sure that the environments are similar as possible (We useREVIEW_APPto specify heroku/staging environments against the production environment).
- When you start rails console, it will say