<
If you're new to Rails, see the Getting Started with Rails guide for an introduction to the framework.
brew bundle
xattr -d com.apple.quarantine $(which chromedriver)
(this is the only option if you are on Big Sur)bundle install
yarn install
bundle exec rake db:setup
bin/dev
Environment variables can be set in development using the dotenv gem.
Consistent but sensitive credentials should be added to config/credentials.yml.enc
by using $ rails credentials:edit
Production credentials should be added to config/credentials/production.yml.enc
by using $ rails credentials:edit --environment production
Any changes to variables in .env
that should not be checked into git should be set
in .env.local
.
If you wish to override a config globally for the test
Rails environment you can set it in .env.test.local
.
However, any config that should be set on other machines should either go into .env
or be explicitly set as part
of the test.
TBD
<script>
and <style>
securityThe system's Content-Security-Policy header prevents <script>
and <style>
tags from working without further
configuration. Use <%= javascript_tag nonce: true %>
for inline javascript.
See the CSP compliant script tag helpers ADR for more information on setting these up successfully.
We use the gem i18n-tasks
to manage locale files. Here are a few common tasks:
Add missing keys across locales:
$ i18n-tasks missing # shows missing keys
$ i18n-tasks add-missing # adds missing keys across locale files
Key sorting:
$ i18n-tasks normalize
Removing unused keys:
$ i18n-tasks unused # shows unused keys
$ i18n-tasks remove-unused # removes unused keys across locale files
For more information on usage and helpful rake tasks to manage locale files, see the documentation.
bundle exec rake spec
bundle exec rake standard
./bin/pa11y-scan
./bin/owasp-scan
bundle exec rake brakeman
bundle exec rake bundler:audit
bundle exec rake yarn:audit
Run everything: bundle exec rake
When new pages are added to the application, ensure they are added to ./pa11y.js
so that they can be scanned.
To enable automatic ruby linting and terraform formatting on every git commit
follow the instructions at the top of .githooks/pre-commit
GitHub actions are used to run all tests and scans as part of pull requests.
Security scans are also run on a scheduled basis. Weekly for static code scans, and daily for dependency scans.
Each environment has dependencies on a PostgreSQL RDS instance managed by cloud.gov. See cloud.gov docs for information on RDS.
Deploys to staging, including applying changes in terraform, happen
on every push to the main
branch in GitHub.
The following secrets must be set within the staging
environment secrets
to enable a deploy to work:
Secret Name | Description |
---|---|
CF_USERNAME |
cloud.gov SpaceDeployer username |
CF_PASSWORD |
cloud.gov SpaceDeployer password |
RAILS_MASTER_KEY |
config/master.key |
TERRAFORM_STATE_ACCESS_KEY |
Access key for terraform state bucket |
TERRAFORM_STATE_SECRET_ACCESS_KEY |
Secret key for terraform state bucket |
Deploys to production, including applying changes in terraform, happen
on every push to the production
branch in GitHub.
The following secrets must be set within the production
environment secrets
to enable a deploy to work:
Secret Name | Description |
---|---|
CF_USERNAME |
cloud.gov SpaceDeployer username |
CF_PASSWORD |
cloud.gov SpaceDeployer password |
RAILS_MASTER_KEY |
config/credentials/production.key |
TERRAFORM_STATE_ACCESS_KEY |
Access key for terraform state bucket |
TERRAFORM_STATE_SECRET_ACCESS_KEY |
Secret key for terraform state bucket |
All configuration that needs to be added to the deployed application's ENV should be added to
the env:
block in manifest.yml
Items that are both public and consistent across staging and production can be set directly there.
Otherwise, they are set as a ((variable))
within manifest.yml
and the variable is defined depending on sensitivity:
--var
addition to the cf_command
line on the deploy action like the existing rails_master_key
Configuration that changes from staging to production, but is public, should be added to config/deployment/staging.yml
and config/deployment/production.yml
The New Relic Ruby agent has been installed for monitoring this application.
The config lives at config/newrelic.yml
, and points to a FEDRAMP version of the New Relic service as its host. To access the metrics dashboard, you will need to be connected to VPN.
To get started sending metrics via New Relic APM:
new_relic_key
.app_name
entries in config/newrelic.yml
with what is registered for your application in New Relicagent_enabled: false
line in config/newrelic.yml
application.html.erb
. It is recommended to vary this based on environment (i.e. include one snippet for staging and another for production).
Digital Analytics Program (DAP) code has been included for the Production environment, associated with GSA.
If Rtci is for another agency, update the agency line in app/views/layouts/application.html.erb
Architectural Decision Records (ADR) are stored in doc/adr
To create a new ADR, first install ADR-tools if you don't
already have it installed.
brew bundle
or brew install adr-tools
Then create the ADR:
adr new Title Of Architectural Decision
This will create a new, numbered ADR in the doc/adr
directory.
Compliance diagrams are stored in doc/compliance
. See the README there for more information on
generating diagram updates.
This will continue to evolve as the project moves forward.
TBD