ministryofjustice / elsa-relevant-search

Enable citizens to find relevant early legal support and advice resources and websites.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Search information about legal problems

CI and CD

This is a Rails application to enable citizens to find, with the help of a Google custom search engine relevant information and websites about legal problems.

Getting Started

Clone the repository, and follow these steps:

  • Copy .env.example to .env and modify with suitable values
  • gem install bundler # if you don't have it already
  • bundle install
  • Pull the GOV.UK Frontend assets (instructions below)
  • bin/rails db:setup
  • bin/rails db:migrate
  • bin/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

Running the tests:

  • Copy .env.test.example to .env.test and modify with suitable values.
  • RAILS_ENV=test bin/rails db:setup
  • RAILS_ENV=test bin/rails db:migrate

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

  • rake

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

  • rake spec
  • rake brakeman
  • rake rubocop

Cucumber + Capybara features

ChromeDriver is needed for the integration tests. It can be installed on Mac using Homebrew:
brew install chromedriver and then xattr -d com.apple.quarantine /usr/local/bin/chromedriver

The features will run as part of the default rake task, but can also be run in any of these forms:

  • bundle exec cucumber
  • bundle exec cucumber features/homepage.feature

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

By default Capybara will start a local Puma 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/homepage.feature

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 the real production environment.

NOTE: never use docker-compose for a real production environment. This is only provided to test a local container.

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 is available in confluence.

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 analytics.

There is a deploy repo for this staging environment (as well as for production). 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 then trigger an automatic deploy to staging.

For more details, refer to the deploy repo.

About

Enable citizens to find relevant early legal support and advice resources and websites.

License:MIT License


Languages

Language:Ruby 55.4%Language:HTML 29.6%Language:JavaScript 6.7%Language:Gherkin 3.0%Language:SCSS 2.9%Language:Dockerfile 2.2%Language:Shell 0.2%