title | description |
---|---|
EMBC Suppliers Portal |
EMBC's suppliers' portal |
A web based portal for EMBC suppliers to submit their invoices and receipts for supports provided to evacuees
The portal is accessible from EMBC-ESS landing page, follow the training materials and link provided at ess.gov.bc.ca
- VS2019
- VSCode
- Docker-Desktop (optional for Docker build and run)
API
- fork the main repository and checkout the fork to your local machine
- open
suppliers/src/API/EMBC.Suppliers.sln
in Visual Studio - right click on
EMBC.Suppliers.API
project and selectManage User Secrets
- add the following configuration values:
"Dynamics:ADFS:OAuth2TokenEndpoint": "<BC Gov ADFS OIDC token endpoint url>",
"Dynamics:ADFS:ResourceName": "<Dynamics resource name>",
"Dynamics:ADFS:ClientId": "<client id>",
"Dynamics:ADFS:ClientSecret": "<client secret>",
"Dynamics:ADFS:serviceAccountDomain": "<service account domain>",
"Dynamics:ADFS:serviceAccountName": "<service account name",
"Dynamics:ADFS:serviceAccountPassword": "<service account password>",
"Dynamics:DynamicsApiEndpoint": "https://<Dynamics host url>/api/data/v9.0/"
- The following envirnment variables can be set in `properties/launchSettings.json, these are the default, checked in to github:
"Submission_Storage_Path": "%TEMP%",
"Dynamics__Cache__CachePath": "%TEMP%",
"Dynamics__Cache__UpdateFrequency": "1",
"ASPNETCORE_ENVIRONMENT": "Development"
- build and run
- to test the API, use swagger from
http://localhost:5000/api/swagger
or Postman - to run the integration tests, make sure the solution is set to Debug, and that you're connected to the BC GOV VPN service
- To run the API in hot loading from the command line, execute the following command from the root folder of the repository
dotnet watch --project .\suppliers\src\API\EMBC.Suppliers.API\ run
UI
- cd to
suppliers/src/UI/embc-supplier
- run
npm install
- run the API
- to start the portal with hot loading, run
ng serve
- use
npm run test
andnpm run lint
to test and lint
Docker
- create .env file with the following env vars:
Dynamics__DynamicsApiEndpoint=https://<Dynamics host url>/api/data/v9.0/
Dynamics__ADFS__OAuth2TokenEndpoint=<BC Gov ADFS OIDC token endpoint url>
Dynamics__ADFS__ResourceName=<Dynamics resource name>
Dynamics__ADFS__ClientId=<client id>
Dynamics__ADFS__ClientSecret=<client secret>
Dynamics__ADFS__serviceAccountDomain=<service account domain>
Dynamics__ADFS__serviceAccountName=<service account name>
Dynamics__ADFS__serviceAccountPassword=<service account password>
Dynamics__Cache__CachePath=/dynamics_cache
Submission_Storage_Path=/submissions
- from the root repository folder, run
docker-compose up --build
- the API will be available at
http://localhost:8080/api
and the UI will be available athttp://localhost:2015
Every pull request to the main repository will trigger a the CI github workflow. There are 2 workflows, one for the API and one for the UI, and they are triggered only when the respective source changed. For example, a change to the UI will only trigger CI for the UI CI workflow.
the CI pipeline is included in the dockerfile of each deployable unit. The pipeline itself only triggers docker build
command, if an image can be built, the result is 'pass'.
Once the PR is reviewed and merged to master, the CD workflows will start. The exact same build process is invoked as the CI, resulting in the built image being pushed to Openshift and tagged 'latest'. The image tag change will trigger the dev environment deployment and will deploy the latest build.
commit to fork -> create PR -> CI build -> merge -> CD build -> automatic deployment in dev
The CD workflow depends on the availability of Openshift docker registry, the credentials to access the registry are stored in Github secrets of the repository:
key | value |
---|---|
OKD_DOCKERREGISTRY | url of the remote registry, for Pathfinder it is docker-registry.pathfinder.gov.bc.ca |
OKD_DOCKERREPOSITORY | name of the repository, usually the tools namespace/project |
OKD_USERNAME | user which allows to push and pull images |
OKD_PASSWORD | the openshift token of the above user |
Follow Thor's instructions how to set up a docker service account in Openshift. The token will be available in the tools namespace secrets
Higher environment deployments are triggered within Openshift tools project pipelines:
- test - tag
latest
astest
and trigger test environment deployment - training - tag
test
astraining
and trigger training environment deployment - prod - tag
test
asproduction
and trigger production environment deployment
dev -> test --> training
\-> production
See openshift readme for more details