Facilitates online Zero-Emission Vehicle (ZEV) sales reporting by regulated parties (automakers), plus issuance and transfer of ZEV credits. This is to support compliance with the ZEV Act regulations that require increasing sales of ZEVs to reduce GHG emissions from vehicles in the province.
The project is a typical we application, it has frontend, backend and database.
- Frontend: Nodejs and React
- Backend: Python and Django
- Database: Postgresql 10 and Patroni
- Object Storage: Minio
- Application Monitoring: Nagios
- Database Backup: BackupContainer
- Cloud Platform: Openshift
- Database Documentation: SchemaSpy
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.
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 zeva
Add this entry to your /etc/hosts
file:
127.0.0.1 minio
to view the database use: docker-compose exec db psql -U postgres postgres
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
You can view Django Restframework's browseable api here: http://localhost:8000/api/
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.
We are using a shared realm Keycloak client. Shared realm clients can be accessed and configured via Common Hosted Single Sign-on (CSS)
to access keycloak console on local, go to localhost:8888 when developing locally, you may want to assign different users to different profiles, for example, have a 'government' profile as well as a 'supplier' profile. To update keycloak profiles, go to the keycloak console (8888), then click users, then view all users. select one, then click attributes. Look at the database user_profiles table, find one that has an organization that matches what you want, or update one, then use that username as the 'Value' on keycloak. Different users have different permissions to view pages and complete actions.
We are using CHES to send email. Documentation is available here
We use Openshift to deploy our applications. Access the console here
There's training on Openshift offered by BCDevExchange. Check the schedule here
We use git for version control. Each developer has their own fork of the repo and works off of branches from there
backend tests will be recognized and run with other tests if they have follow this naming convention: test_[name].py eg. test_credit_transfers.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_credit_transfers.py
The project uses pull request based pipeline is supported by BCDK and follow the instructions at here to setup the pipeline.
- All templates are located under openshift/templates folder.
- Follow the instructions here to setup The application on Openshift.
Once Jenkins is up and running, it automatically builds pull requests and promote to dev, test and prod with confirmation. The Jenkins url can be found in Openshift under project's Networking->Routers.
- Cd to .pipeline folder and run the following command line to build pull requests and deploy to environment.
- $ npm run build -- --pr=pull-request-number --env=build
- $ npm run deploy -- --pr=pull-request-number --env=dev/test/prod
- When a pull request is closed or merged, all resources created for the pull request is removed by Jenkins automatically. They also can be remove the the following command.
- $ npm run clean -- --pr=pull-request-number --env=build/dev/test/prod
Code released under the Apache License, Version 2.0.