Git Product home page Git Product logo

despo / apply-for-teacher-training Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dfe-digital/apply-for-teacher-training

0.0 1.0 0.0 145.81 MB

A service for applying to teacher training courses. In beta since November 2019.

Home Page: https://www.apply-for-teacher-training.service.gov.uk

License: MIT License

Ruby 84.26% JavaScript 0.49% HTML 14.31% Dockerfile 0.09% Makefile 0.05% Shell 0.02% SCSS 0.78%

apply-for-teacher-training's Introduction

View performance data on Skylight

Apply for teacher training

A service for candidates to apply for teacher training. We're currently in private beta.

Screenshot of the candidate-facing interface

Live environments

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

Table of Contents

Guides

We keep track of the things we learn:

How the application works

The application has a number of different interfaces for different types of users:

Diagram of the Apply interfaces

Architecture

Diagram of the technical architecture

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.

Domain Model

The domain model for this application

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.

Application states

All of the states and transitions in the app

Regenerate this diagram with bundle exec rake generate_state_diagram.

Dependencies

Production dependencies

Development dependencies

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.

Development environment

Running the application with local dependencies

The most common way to run a development version of the application is run with local dependencies.

Local development dependencies

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.

Local db setup

  1. Start the postgres service: sudo service postgresql start on Linux or brew services start postgresql on Mac
  2. Populate the DB_ relevant environment variables with the correct values (those are: DB_USERNAME, DB_PASSWORD, DB_HOSTNAME and DB_PORT)
  3. 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)

Running the app

To run the application locally:

  1. Run yarn to install dependencies for the web app to run
  2. Run foreman start to launch the app on http://localhost:3000

Running the application in Docker

As an alternative to that, it's also possible to run the application in Docker:

Docker dependencies

Running the app

Install the above dependencies, and then:

  1. Copy .env.example to .env and fill in the secrets
  2. Run make setup
  3. Run make serve to launch the app on https://localhost:3000

See Makefile for the steps involved in building and running the app.

Development data

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.

Background processing

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

Docker Workflow

Under docker-compose, the database uses a Docker volume to persist storage across docker-compose ups and docker-compose downs. 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.

DfE Sign-in

The Provider interface at /provider and Support interface at /support are both protected by DfE's SSO provider DfE Sign-in.

Environments

In development and QA we use the Test environment of DfE Sign-in:

Manage console (test)

# .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:

Manage console (production)

# .env
DFE_SIGN_IN_ISSUER=https://oidc.signin.education.gov.uk

Local development

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.

Provider permissions

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.

Support permissions

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.

Heroku review apps

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.

License

MIT Licence

apply-for-teacher-training's People

Contributors

adamsilver avatar agadufrat avatar aldavidson avatar alexdesi avatar benilovj avatar c-gyorfi avatar chubberlisk avatar dankmitchell avatar davidgisbey avatar dependabot-preview[bot] avatar despo avatar duncanjbrown avatar fofr avatar george-bit avatar himal-mandalia avatar jr-g avatar kjdchapman avatar malcolmbaig avatar mnacos avatar paulrobertlloyd avatar raamsoftwire avatar richardpattinson avatar robertm905 avatar stevehook avatar steventux avatar tijmenb avatar tobyret avatar tpinney avatar tvararu avatar vigneshmsft avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.