Legacy documentation is available on Confluence; whilst some of this is still relevant its largely only useful as a historical reference.
We also have markdown pages within the doc
folder of this git repo
- Ruby 3.1.4 - easiest with rbenv and ruby-build
brew install rbenv
brew install ruby-build
rbenv install 3.1.4
- Bundler 2.3.10 -
gem install bundler --version 2.3.10
- PostgreSQL with PostGIS extension
brew install postgis
brew services start postgresql
- Redis
brew install redis
brew services start redis
- NodeJS 18.x
- Yarn
- Chrome (for javascript tests in Cucumber)
- Clone this repo
- Check your dependencies
- ruby -v
- node -v
- bundler -v
- yarn -v
- Run
bundle install
to install ruby dependencies - Run
npx yarn
to install node dependencies - Run
bin/rails db:setup
to set up the database development and test schemas, and seed with test data. - If you don't wish to use the first available Redis Database, set the
REDIS_URL
, eg in the.env
file - Create SSL certificates -
bundle exec rake dev:ssl:generate
- Get a copy of
.env.local
from another team member - Run
rspec
to run the spec tests. - Run
cucumber
to run the cucumber tests. - Run
yarn spec
to run the Javascript tests. - Run
rails s
to launch the app on https://localhost:3000. - If running with
RAILS_ENV=production
, Sidekiq is needed for background job processing a. runningbundle exec sidekiq --config config/sidekiq.yml
will start a Sidekiq Worker
-
Add the Root Certificate to macOS Keychain
Via the CLI
Run
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain config/ssl/localhost.crt
Via the UI
- Double click on
./config/ssl/localhost.crt
- Right click and select "Get Info"
- Open "Trust" Panel
- Change "When using this certificate" to "Always Trust"
- Double click on
-
Reload the webpage
-
Open the "Advanced" pane at the bottom
-
Click "Proceed to website"
- Rails 7 app with Shakapacker
- SassC (replacement for deprecated sass-rails)
- GOV.UK Frontend
- GOV.UK Lint
- Autoprefixer rails
- RSpec
- Cucumber
- Dotenv (managing environment variables)
- Dockerfile to package app for deployment
- GOV.UK terraform files
- The Get school experience service (the candidate facing part), is publicly
available but you'll need to setup School profiles to search for school.
- That can be done from the Manage school experience service
- The Manage school experience service requires a DfE Sign In account attached to a School. You can sign up for an account from the login page, but you'll need to get the DfE Sign-in team to approve you for a school.
It's best to lint just your app directories and not those belonging to the framework, e.g.
bundle exec rubocop app config lib features spec
You can copy the script/pre-commit
to .git/hooks/pre-commit
and git
will
then lint check your commits prior to committing.
This can be controlled from various environment variables, see Env Vars for more information.
There is a JSON /healthcheck
endpoint which will verify connectivity to each of the service dependencies to confirm whether the service is healthy.
The endpoint also includes the git commit SHA of the codebase deployed as well
as a copy of the DEPLOYMENT_ID
to allow checking when the deployed version has
changed. This is retrieved from the following environment variable.
DEPLOYMENT_ID
- identifier for the current deployment.
We store feature flags in a JSON config (./feature-flags.json
), so that flags are visible across all environments.
To add a feature flag, add an object to the features
array in the following format. The name
key is used to enable the feature (e.g., Feature.enabled? :sms
)
{
"features": [
{
"name": "sms",
"description": "Sends reminder text messages",
"enabled_for": {
"environments": ["production", "staging"]
}
}
]
}
This config is read into a dashboard available at /feature_flags
in any of the non-production environments.
If you have plenty of cpu cores, it is faster to run tests with parallel_tests
- Create the databases -
bundle exec rake parallel:create
- Copy the schema over from the main database -
bundle exec rake parallel:prepare
- Run RSpecs -
bundle exec rake parallel:spec
- Run Cucumber features -
bundle exec rake parallel:features
To run feature tests in a headed configuration for easier troubleshooting, add an .env.test.local
file to the root of the project with the following environment variable:
SELENIUM_CHROME_DRIVER=true
- If you find your tests are failing with a notice about
application.css
not being declared to be precompiled in production, run the following command
rake tmp:clear
- IF you find your tests are failing with a notice about
Failure/Error: require File.expand_path('../config/environment', __dir__)
you will need to make sure you have an instance of Redis running a simple way to do this in a separate terminal is to run the following command
brew services start redis
or
redis-server