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 docs/documents folder of this git repo
- Environment Variables
- Release process
- DfE Sign-in
- Candidate notifications
- Inviting users to Manage School Experience
- DevOps processes and procedures
- Ruby 4.0.10 (see
.ruby-version) - easiest with asdf, which reads the versions pinned in.tool-versionsbrew install asdf- Add the plugins:
asdf plugin add ruby,asdf plugin add nodejs,asdf plugin add terraformandasdf plugin add caddy asdf install(installs the Ruby, Node, Terraform and Caddy versions pinned in.tool-versions)
- Bundler 4.0.20 (the version pinned in
Gemfile.lock) -gem install bundler --version 4.0.20 - Docker (for PostgreSQL 17 with PostGIS, matching production)
bin/setupstarts it for you withdocker compose -f docker-compose-dev.yml up -d --wait- It listens on port 5433, so it can run alongside a Homebrew Postgres on 5432
- Redis
brew install redisbrew services start redis
- NodeJS 24.13.0
- Yarn 4.x
- Chrome (for javascript tests in Cucumber)
- Install the prerequisites above —
asdfand its plugins (asdf install), plus Docker and Redis (both running). - Clone this repo.
- Run
bin/setup.
bin/setup installs the Ruby and JavaScript dependencies, creates .env.local from .env.template, starts the Postgres container, prepares the database, imports sample school data, and launches the app with bin/dev at https://school-experience.localhost.
Fill in the blank secret values in .env.local (ask another team member, or retrieve them from the Azure key vault). The candidate-facing journey works without them; DfE Sign-in (the schools/admin area) needs them.
Handy flags:
bin/setup --skip-dev-data— skip importing the sample school databin/setup --skip-server— set everything up without launchingbin/devbin/setup --skip-docker-db— don't start the Postgres container (use your own server instead)
To use your own Postgres instead of the container, set DB_HOST, DB_PORT, DB_USERNAME and DB_PASSWORD (e.g. in .env.local). It needs PostgreSQL 17 with PostGIS, including the address_standardizer extension.
If you'd prefer to install things yourself, or differently:
- Install the Ruby and JavaScript dependencies:
bundle installthenyarn install. - Copy
.env.templateto.env.localand fill in the secret values. - Start Postgres with
docker compose -f docker-compose-dev.yml up -d --wait, then set up the database and seed test data:bin/rails db:setup. - Make sure Caddy is installed (via
asdfper the prerequisites, orbrew install caddy) — it provides local HTTPS; see "Local HTTPS with Caddy" below. - Launch the app with
bin/dev(served at https://school-experience.localhost).
If you don't wish to use the first available Redis database, set REDIS_URL (e.g. in the .env file).
rspec— Ruby specscucumber— Cucumber featuresyarn spec— JavaScript tests
When running with RAILS_ENV=production, Sidekiq is needed for background job processing:
bundle exec sidekiq --config config/sidekiq.ymlDfE Sign-in only redirects back to a pre-registered HTTPS URL, so local development is served over HTTPS. Rather than binding Puma to a self-signed certificate, Caddy sits in front and terminates TLS using its own locally-trusted CA (no browser certificate warnings), then reverse-proxies requests to Rails over plain HTTP. JavaScript and CSS are built by the esbuild and Sass watchers into app/assets/builds and served by Propshaft. See Caddyfile.dev.
bin/devstarts Rails, the esbuild JavaScript watcher, the Sass CSS watcher, and Caddy together viaProcfile.dev.- The app is served at https://school-experience.localhost. The
.localhostTLD resolves to127.0.0.1automatically, so no/etc/hostsentry is needed. - The first run will ask for your password once so Caddy can install its local CA into the system trust store.
To override the host (e.g. to fall back to https://localhost:3000), set DFE_SIGNIN_BASE_URL and adjust Caddyfile.dev accordingly.
For the schools/admin login flow to complete locally, the pre-production DfE Sign-in service must have these registered for this client:
- redirect URI:
https://school-experience.localhost/auth/callback - post-logout redirect URI:
https://school-experience.localhost/schools
- Rails 8 app with the Propshaft asset pipeline
- JavaScript bundling with esbuild (jsbundling-rails) and CSS bundling with Dart Sass (cssbundling-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 specYou 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.cssnot 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 redisor
redis-server