A service for candidates to apply for teacher training. We're currently in private beta.
Name | URL | Description | Azure ID |
---|---|---|---|
Production | www | Public site | s106p01 |
Staging | staging | For internal use by DfE to test deploys | s106t01 |
Sandbox | sandbox | Demo environment for software vendors who integrate with our API | s106t02 |
QA | qa | For internal use by DfE for testing. Automatically deployed from master | s106d01 |
DevOps | dev | For testing infrastructure changes | s106d02 |
- Developer on-boarding
- Connect to a production database
- Deploy the application
- Environment variables
- Frontend development
- Pipeline Variables
- Restore a database
- Set up a new environment
- Testing style guide
- Rails components
- Docker for DevOps
- Swapping App Service Slots
- Performance monitoring
We keep track of the things we learn:
The application has a number of different interfaces for different types of users:
We keep track of architecture decisions in Architecture Decision Records (ADRs).
An overview of the Azure hosted infrastructure architecture can be found in the Azure Infrastructure document.
For simplicity the auditing table is not displayed in the diagram, as it is connected to most tables in the database.
Regenerate this diagram with bundle exec rake erd
.
Regenerate this diagram with bundle exec rake generate_state_diagram
.
- Ruby
- Node.js – see package.json for version
- Yarn – see package.json for version
- PostgreSQL 9.6
- Redis 5.0.x
There are two ways to run the application in development. Running a local development environment is the most common approach but it is also possible to run in local Docker containers.
The most common way to run a development version of the application is run with local dependencies.
postgresql
redis
- Graphviz 2.22+ (
brew install graphviz
) to generate the domain model diagram ruby
bundle 2.1.4+
You'll also need to copy .env.example
to .env
and fill in the secrets.
This will populate required environment variables
Once those dependencies are installed, run bundle install
to install required gems.
- Start the postgres service:
sudo service postgresql start
on Linux orbrew services start postgresql
on Mac - Populate the
DB_
relevant environment variables with the correct values (those are:DB_USERNAME
,DB_PASSWORD
,DB_HOSTNAME
andDB_PORT
) - Then local development databases and data can be set up:
bundle exec rake db:setup
(You may wish to set up development data at this point)
To run the application locally:
- Run
yarn
to install dependencies for the web app to run - Run
foreman start
to launch the app on http://localhost:3000
As an alternative to that, it's also possible to run the application in Docker:
docker
docker-compose
- Graphviz 2.22+ (
brew install graphviz
) to generate the domain model diagram
Install the above dependencies, and then:
- Copy
.env.example
to.env
and fill in the secrets - Run
make setup
- Run
make serve
to launch the app on https://localhost:3000
See Makefile
for the steps involved in building and running the app.
The course and training provider data in the Apply service comes from its
sister service Publish
. To populate your local database with course data from
Publish
, first start the redis service (redis-server
) and then run bundle exec rake setup_local_dev_data
.
We’re in the process of moving to Publish’s new public Teacher training
API. At
the moment the public API complements the old API but does not replace it —
some data is only available in the public API. To receive public-api-only data
such as program_type
and qualifications
turn on the
sync_from_public_teacher_training_api
feature flag.
Among other things, this task also creates a support user with DfE Sign-in UID
dev-support
that you can use to sign in to the Support interface in your
development environment, and a provider user with the UID dev-provider
.
Certain features depend on Sidekiq running. e.g. Mailers and some of the
business rules that set time-dependent state on applications. In order
to run a local version of Sidekiq you need to make sure Redis is installed and
running and then run Sidekiq. The simplest way to do that is with
docker-compose
(see below) or foreman
. e.g.
$ foreman start
Under docker-compose
, the database uses a Docker volume to persist
storage across docker-compose up
s and docker-compose down
s. For
want of cross-platform compatibility between JavaScript libraries, the
app's node_modules
folder is also stored in a persistent Docker
volume.
Running make setup
will blow away and recreate those volumes,
destroying any data you have created in development. It is necessary
to run it at least once before the app will boot in Docker.
The Provider interface at /provider
and Support interface at
/support
are both protected by DfE's SSO provider DfE Sign-in.
In development and QA we use the Test environment of DfE Sign-in:
# .env
DFE_SIGN_IN_ISSUER=https://test-oidc.signin.education.gov.uk
In staging, production and sandbox we use the Production environment of DfE Sign-in:
# .env
DFE_SIGN_IN_ISSUER=https://oidc.signin.education.gov.uk
Logging in to the Provider interface requires a network connection and a user
account on DfE Sign-in. In development you can eliminate this dependency by
setting BYPASS_DFE_SIGN_IN=true
in your .env
file. This replaces the login
flow with a dialog allowing you to specify a DfE Sign-in UID and Email address
for your current session.
We decide what to show providers based on their DfE Sign-in UID.
To grant a user permission to view a provider’s applications, visit /support/users/providers and create a user, specifying their DfE Sign-in UID and the relevant provider.
There is a support_users
database table that lists all the DfE Sign-in
accounts that have access to the Support interface based on their DfE
Sign-in UID. There is only one privilege level, either you have access
to everything or nothing.
You can add a new support user using the create_support_user
rake
task. You need to supply a DfE Sign-in UID and an email address, e.g.
$ bundle exec rails "create_support_user[alice, [email protected]]"
Note that only the UID is used for lookup. The email address serves only as a label.
When a new PR is opened, a review app is deployed via Heroku. This has a HOSTING_ENVIRONMENT=development
, an empty database which gets seeded with local dev data, and a URL which is similar to https://apply-for-teacher-training.herokuapp.com
. The Heroku configuration is in app.json
.