petenorth / schools-experience

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DfE School Experience

Prerequisites

  • Ruby 2.5.3
  • PostgreSQL
  • PostGIS extension
  • Redis
  • NodeJS 8.11.x
  • Yarn 1.12.x

Setting up the app in development

  1. Run bundle install to install the gem dependencies
  2. Run yarn to install node dependencies
  3. Run bin/rails db:setup to set up the database development and test schemas, and seed with test data.
  4. If you don't wish to use the first Redis Database, set the REDIS_URL, eg in the .env file
  5. Run bundle exec rails s to launch the app on http://localhost:3000.
  6. If in production, DelayedJob is needed for background job processing - run bundle exec rake jobs:work

Whats included in this App?

  • Rails 5.2 with Webpacker
  • SassC (replacement for deprecated sass-rails)
  • GOV.UK Frontend
  • GOV.UK Lint
  • Autoprefixer rails
  • RSpec
  • Dotenv (managing environment variables)
  • Dockerfile to package app for deployment
  • Azure DevOps integration

Linting

It's best to lint just your app directories and not those belonging to the framework, e.g.

bundle exec govuk-lint-ruby app lib spec

Seems to be an issue with files already known to git being ignored. If so use

GIT_DIR=ignore bundle exec govuk-lint-ruby app lib spec

HTTP Basic Auth access control

If its required to password protect then entire application then you can set two environment variables when booting the app. This can either be part of the deployment configuration.

SECURE_USERNAME = <my-username>
SECURE_PASSWORD = <my-password>

Exception notification

If required Exceptions Notifications can be sent to a Slack channel. This is enabled and configured via environment variables.

SLACK_WEBHOOK (required) Webhook to use to post to Slack SLACK_CHANNEL (optional) Channel to post to, should be left blank if hook defaults to a specifi channel SLACK_ENV (optional) Identifier for deployment environment - eg Staging or Production

Monitoring health and deployment version

There is a /healthcheck.txt endpoint which will verify both Postgres and Redis connectivity.

There is a /deployment.txt endpoint which will reflect the contents of DEPLOYMENT_ID back to allow checking when the deployed version has changed.

This is protected by HTTPS Basic Auth, and is configured by the following 3 environment variables.

DEPLOYMENT_ID - identifier for the current deployment DEPLOYMENT_USERNAME - username to protect the endpoint DEPLOYMENT_PASSWORD - password to protect the endpoint

About

License:MIT License


Languages

Language:Ruby 75.5%Language:HTML 13.6%Language:Gherkin 9.3%Language:SCSS 0.9%Language:JavaScript 0.4%Language:Python 0.1%Language:Shell 0.1%Language:Roff 0.1%