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.
-
Ruby version
- Ruby version 2.5.3
- Rails 5
-
System dependencies
- postgres 10.5
- redis
- npm
Install dependencies with homebrew:
brew bundle
# From the root of the project execute the following command:
bin/setup
NOTE: Ensure the .env.development
settings are correctly configured.
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
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
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
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
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
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
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"
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
toproduction
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.
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"
.
Refer to the specific README