Git Product home page Git Product logo

laa-apply-for-legal-aid's Introduction

LAA Apply for legal aid

This is the service api for persisting application related information to the back end database and may well be used to fire requests to other services.

CircleCI

  • Ruby version

    • Ruby version 2.5.3
    • Rails 5
  • System dependencies

    • postgres 10.5
    • redis
    • npm

Install dependencies with homebrew:

brew bundle

Initial setup

# From the root of the project execute the following command:
bin/setup

NOTE: Ensure the .env.development settings are correctly configured.

Malware check of uploaded files

ClamAV is used to make sure uploaded files do not contain any malware. If you are on Mac, ClamAV would have been installed by running bin/setup

On Ubuntu you can install it with:

sudo apt-get install clamav clamav-daemon -y
sudo freshclam
sudo /etc/init.d/clamav-daemon start

You may also need to run:

sudo apt install clamdscan

Run the application server

bin/rails s

NOTE: You also need to start sidekiq in another terminal window:

bundle exec sidekiq

You can also use foreman to start the application server and sidekiq with one command

gem install foreman
foreman start -f Procfile

Running tests

Runs Rubocop, RSpec specs and Cucumber features

bin/rake

NOTE: To ensure the recorded VCRs used in the specs are up to date, run the tests as such:

VCR_RECORD_MODE=all bin/rake

There is an (deprecated) alternative setup procedure (not recommended), using the makefile, which can be found here

Deployment

The deployment is triggered on all builds in CircleCI but requires approval to the desired environment.

NOTE: git-crypt is required to store secrets required for uat, staging and production environments. To be able to modify those secrets, git-crypt needs to be set up according to the following guide.

  • For more information on howto setup Helm in your local environment refer to the following guide.
  • For more deployment information refer to the specific README

UAT Deployments

NOTE: Until an automated process is put in place to deal with this issue, once a branch has been merged into master or deleted, for which there's an associated release, the following commands should be executed to ensure those releases are deleted, as they're no longer necessary:

# list the availables releases:
helm list --tiller-namespace=laa-apply-for-legalaid-uat --namespace=laa-apply-for-legalaid-uat --debug --all

# delete a specific release
helm delete <name-of-the-release> --tiller-namespace=laa-apply-for-legalaid-uat --purge

LAA Portal Authentication dev setup

Add the following to .env.development

LAA_PORTAL_IDP_SSO_TARGET_URL=https://portal.tst.legalservices.gov.uk/oamfed/idp/samlv20
LAA_PORTAL_IDP_CERT=< LAA_PORTAL_IDP_CERT (dev)>
LAA_PORTAL_CERTIFICATE=< LAA_PORTAL_CERTIFICATE (dev)>
LAA_PORTAL_SECRET_KEY=< LAA_PORTAL_SECRET_KEY(dev)>
LAA_PORTAL_MOCK_SAML=false

** Note the above keys can be found in rattic

Mock Saml request on dev add the the following settings

LAA_PORTAL_IDP_SSO_TARGET_URL=http://localhost:3002/saml/auth
LAA_PORTAL_MOCK_SAML=true

Admin Portal

The admin portal is at /admin. To access it, there must be an AdminUser defined.

If ENV['ADMIN_PASSWORD'] returns a password, running rake db:seed will create an admin user with username apply_maintenance, and that password.

To allow reset mode within the admin portal, ENV['ADMIN_ALLOW_RESET'] must return "true"

Databases

Staging and Production

Staging and production databases are RDS instances on the MOJ Cloud Platform. Connection details are held in Rattic.

These databases are within the AWS VPC and are not publicly available. In order to connect to an RDS database from a local client, first run:

kubectl -n laa-apply-for-legalaid-staging port-forward port-forward-rds 5433:80

This will then allow you to connect to the database, eg:

psql --host=localhost --port=5433 --username=<username> --password --dbname=apply_for_legal_aid_staging

  • Change staging to production in the above commands to access production.
  • Port 5433 is used in the above examples instead of the usual 5432 for postgres, as 5432 will not work if postgres is running locally.

3rd party integrations

True Layer

To connect the True Layer API, a client ID and client SECRET must be supplied. They can be set via the environment variables TRUE_LAYER_CLIENT_ID and TRUE_LAYER_CLIENT_SECRET respectively. Visit https://console.truelayer.com to get a client ID and client SECRET.

True Layer offer a Mock Bank option (see https://docs.truelayer.com/#mock-users). To enable this functionality, set the environment variable TRUE_LAYER_ENABLE_MOCK to "true".

Troubleshooting

Refer to the specific README

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.