Skip to content

AlexZorkin/itvr

 
 

Repository files navigation

SonarCloud

itvr

System

ITVR system statuses and workflow can be found documented in the flowchart

Development

Unfortunately we do not have a licence to use Docker Desktop at BC Gov. If you are on a mac here is a blogpost about how to setup Lima as an alternative solution for development purposes.

Backend

The backend and all services are setup to run via docker. To start everything up you can run in the project folder:

docker-compose up --build

This will start up a postgres database, a Django web app, and a MinIO service with a private bucket itvr

Add this entry to your /etc/hosts file:

127.0.0.1 minio

Django

Django offers many helpful mangement commands out of the box. To be able to use these with docker you can access the python environment with bash:

docker-compose exec api bash

To create a Django admin user try running this command in the shell:

python manage.py createsuperuser

The admin panel is available here: http://localhost:8000/admin/

You can view Django Restframework's browseable api here: http://localhost:8000/api/

Use a created superuser to login and view the api.

MinIO

You can view the contents of the bucket in MinIO by visiting http://localhost:9001/login. Use env variables MINIO_ROOT_USER and MINIO_ROOT_PASSWORD to login to the console. Default values are found in minio.env

We take advantage that MinIO is S3 compatible and use django-storages S3 backend for media files.

Auth

We are using a shared realm Keycloak client. Shared realm clients can be accessed and configured via Common Hosted Single Sign-on (CSS)

Once added as a team member to existing projects (this project is called itvr), you can configure the redirect urls for each environment (dev, test, prod). Installation json is available as well as some helpful documentation about integrating the client.

Email

We are using CHES to send email. Documentation is available here

To get access to the created client, go request account with application acronym ITVR. This will allow you to reset client secrets for environments (dev, test, prod) as needed.

CRA

Submitting wage requests can be done manually by logging into ftp://ftp-ot.cra-arc.gc.ca/pub/BC/iv/bcvr/ anonymously and dropping any encrypted files in the uaclient2cra folder. Within a short time the encrypted response will be available within the uacra2client folder. All security is trusted within the encryption algorithm. Anybody can download a file from here. Only the target user/computer can decrypt the file.

For the next valid sequence number:

If you ever are not sure, Susan can verify with ITB or send a request with the last sequence you are aware of and it will will fail but you will get an email notification indicating the error and what the next available sequence is.

Example of the contents of the error email for wrong sequence number:

THE FOLLOWING FILENAME IS EXCLUDED FROM PROCESSING PLEASE INVESTIGATE THE FILE LISTED BELOW: INPUT FILENAME: DEMO.A00154 REASON : INVALID SEQUENCE NUMBER ON INPUT FILENAME

    THE NEXT VALID SEQUENCE NUMBER TO USE IS :   00155

Frontend

We've decided to run the frontend outside of docker at this time mostly because of mounted Lima volumes causing issues with npm permissions. Track the open issue

To run the frontend you will need node.js installed. A good way to manage node these days is with asdf. File .tool-versions contains current versions of tools used in this application. After setting up asdf run this at the project root:

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install

The frontend is built using Create React App. To run the frontend:

cd frontend
npm i
npm start

The app is available by default at http://localhost:3000/

Storybook

To use Storybook for developing a component:

cd frontend
npm run storybook

The storybook is available by default at http://localhost:6006/

Deployment

We use Openshift to deploy our applications. Access the console here

There's training on Openshift offered by BCDevExchange. Check the schedule here

Git Process/ Rebasing

We use git for version control. Each developer has their own fork of the repo and works off of branches from there If another branch is merged in (eg from another developer) then the branch in progress will need to be rebased before it gets merged in.

Steps: git checkout release-branch git fetch upstream git pull --rebase upstream release-branch git checkout featurebranch git rebase release-branch

If there are any conflicts, you will have to step through each commit and fix them. After conflicts are fixed and added (git add) then:

git rebase --continue

until all of the conflicts are fixed.

If you already have a branch at origin you'll have to force push, otherwise doing a regular push will just give errors: git push -f origin

Testing

backend tests will be recognized and run with other tests if they have follow this naming convention: test_[name].py eg. test_calculate_rebate.py

to run tests use a terminal in the api container and type python manage.py test

or to run specific test files, point to the folder or file python manage.py test api.services.tests.test_calculate_rebate

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 41.2%
  • Python 40.3%
  • HTML 5.8%
  • Shell 4.7%
  • Smarty 3.8%
  • SCSS 2.8%
  • Other 1.4%