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.
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 alreadybundle install
- Pull the GOV.UK Frontend assets (instructions below)
bin/rails db:setup
bin/rails db:migrate
bin/rails server
brew install yarn
# if you don't have it alreadyyarn
# this will install the dependencies
- 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
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
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.
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.
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.