Skip to content

Latest commit

 

History

History
129 lines (77 loc) · 7.86 KB

README.md

File metadata and controls

129 lines (77 loc) · 7.86 KB


MoJ logo

Disclosure Checker

repo standards badge

This is a Rails application to enable citizens to check when their convictions are spent. It is based on software patterns developed for the C100 Application.

Documentation for calculations of convictions

This service follows several rules to calculate spent dates of multiple convictions, we have documented all of the scenarios known to us in our tests:

We have also added visual graphics to better aid understanding:

We have also gather together all the documents and information we have gone through in one ticket:

If for some reason the ticket is not available, please refer to the following:

It is important to understand how convictions work, as this is the main reason for the existence of this service.

Docker

The application can be run inside a docker container. This will take care of the ruby environment, postgres database, and any other dependency for you, without having to configure anything in your machine.

  • docker-compose up

The application will be run in "production" mode, so will be as accurate as possible to a real production environment.

Please note, in production environments this is done in a slightly different way as we don't use docker-compose in those environments (kubernetes cluster). But the general idea is the same.

Getting Started

You will need to install Homebrew, to enable the brew command.

  • Copy .env.example to .env and replace with suitable values.

  • bundle install

  • bundle exec rails db:setup

  • bundle exec rails db:migrate

  • bundle exec rails server

GOV.UK Frontend (styles, javascript and other assets)

  • brew install yarn # if you don't have it already
  • yarn # this will install the dependencies

For running the tests:

  • Copy .env.test.example to .env.test and replace with suitable values if you expect to run the tests
  • RAILS_ENV=test bundle exec rails db:setup
  • RAILS_ENV=test bundle exec rails db:migrate

You can then run all the code linters and tests with:

  • RAILS_ENV=test bundle exec rake or
  • RAILS_ENV=test bundle exec rake test:all_the_things

Or you can run specific tests as follows (refer to lib/tasks/all_tests.rake for the complete list):

  • RAILS_ENV=test bundle exec rake spec
  • RAILS_ENV=test bundle exec rake brakeman

Cucumber features

ChromeDriver is needed for the integration tests. It can be installed on Mac using Homebrew: brew cask install chromedriver

The features can be run manually (these are not part of the default rake task) in any of these forms:

  • bundle exec cucumber features
  • bundle exec cucumber features/caution.feature
  • bundle exec cucumber features/caution.feature -t @happy_path

Any of the files in the features directory can be run individually.

By default cucumber will start a local server on a random port, run features against that server, and kill the server once the features have finished.

If you want to show the browser (useful to debug issues) prefix the commands like this:

  • SHOW_BROWSER=1 bundle exec cucumber features/caution.feature

K8s cluster staging environment

There is a staging environment running on this url

The staging env uses http basic auth to restrict access. The username and password should be available from the MoJ Rattic server, in the Family Justice group.

This environment should be used for any test or demo purposes, user research, etc. Do not use production for tests as this will have an impact on metrics and will trigger real emails

There is a deploy repo for this staging environment. It contains the k8s configuration files and also the required ENV variables.

Continuous integration and deployment

GitHub actions are used for CI and CD and you can find the configuration in .github/workflows/test-build-deploy.yml

After a successful merge to main, a docker image will be created and pushed to an ECR repository. It will also trigger an automatic deploy to staging.

For more details, refer to the deploy repo.