GithubHelp home page GithubHelp logo

bcgov / internationally-educated-nurses Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 5.29 MB

Internationally Educated Nurses

License: Apache License 2.0

JavaScript 1.26% Shell 0.15% Dockerfile 0.02% Makefile 1.16% TypeScript 94.13% Handlebars 0.11% CSS 0.07% HCL 3.10%
hlth ien

internationally-educated-nurses's Introduction

Internationally Educated Nurses hiring portal project.

Lifecycle:Maturing The codebase is being roughed out, but finer details are likely to change.

Project structure

Tech stack

  • Runtime environment - NodeJS
  • Programming language - Typescript
  • Database - PostgreSQL
  • Authentication - Keycloak
  • Backend API server - NestJS
    • Express
    • TypeORM
    • Swagger
  • Frontend React framework - NextJS
    • Formik
    • Tailwind CSS
    • class-validator
    • Cypress
  • Deployment
    • GitHub Actions
    • Terraform
    • AWS CloudFront/S3/Lambda/RDS

Yarn workspaces

Workspace or Package Description README
apps/api Backend NestJS API server README
apps/web Frontend NextJS React app README
packages/common Shared library README
packages/accessibility Accessibility Test README

PR Checks

When you create a pull request, be aware that GitHub actions for each project will be executed to check its validity.

How to run the apps

Preparation

  • Install NodeJS 16+ as a runtime environment by nvm

  • Install yarn as a package manager

  • Install and run Docker Desktop

  • Check out the repository

    $ git clone https://github.com/bcgov/internationally-educated-nurses ien
    $ cd ien
  • Install dependencies

    $ yarn
  • Define environment variables in .env

    Copy .env.example to .env

    $ cp .config/.env.example .env

    Define variables for database connection.

    PROJECT=ien
    RUNTIME_ENV=local
    POSTGRES_HOST=db
    POSTGRES_USERNAME=
    POSTGRES_PASSWORD=
    POSTGRES_DATABASE=
    

    Database Initialization

    The local .pgdata folder is mapped to a volume in db container, and it is initialized at the initial launch. If you change env variables to authenticate a db connection, delete .pgdata so that database could be reinitialized.

    Teams Integration

    TEAMS_ALERTS_WEBHOOK_URL=

    If TEAMS_ALERTS_WEBHOOK_URL is defined and an exception occurs, the error message will be sent to the Teams channel.

Run as docker containers

The Make command docker-run to build and launch containers is defined in Makefile.

  • create containers

    $ make docker-run
  • stop containers

    $ docker-compose stop
  • start containers

    $ docker-compose start
  • destroy containers

    $ make docker-down

Containers:

  • ien_db
  • ien_common
  • ien_web
  • ien_api

Containers are configured by Dockerfile and docker-compose.yml

If you get a DockerException, make sure Docker Desktop is running.

docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
[80774] Failed to execute script docker-compose

Run as local NodeJS instances

It is recommended to run database as a container in any case. On the other hand, you can run common, api, and web as NodeJS instances.

$ make start-local

or run in watch mode

$ make watch

Make apps connect to each other.

Database Hostname Resolution

POSTGRES_HOST env is defined as db, which is used as a service name in docker-compose.yml. As api uses it to connect to the database and a service name is resolved as an address only in Docker environment, you need to redefine it to resolve it on your local machine. You can set it to localhost if you persistently run the app in this way. Otherwise, add 127.0.0.1 db to /etc/hosts.

API Calls

NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1

To make successful requests from web to api, you need to set NEXT_PUBLIC_API_URL environment variable. It is set by default when using Docker or run by make command, but if you run the application by next start command in apps/web folder, you should supply this value by creating a file named .env.local placed in apps/web.

In order to make breakpoints work in watch mode, set sourceMap to true in tsconfig.json and restart the apps.

Tests

Unit and integration tests run against the API in the CI pipeline on pull request.

Manual API Tests

Requests to all endpoints are defined in FreshWorks's Postman IEN workspace. Except version endpoint, all require authentication. IEN collection's pre-request script authenticates and saves token as an environment variable before each call.

Note that it only works for the local and dev environments because they use different Keycloak servers. See deployments section. To query for the test and prod, unset username and password environment variables and set token with the one retrieved from the response of login request in the browser.

Unit Tests

Run API and web unit tests with make api-unit-test and make web-unit-test.

Integration test

Ephemeral test data

api and web integration tests start test database with clean data before running tests and destroy it after.

  @make start-test-db
  @yarn build
  @NODE_ENV=test yarn test:e2e
  @make stop-test-db

The test database container has no mapped volume. Therefore, all data will be deleted when the container is removed by make stop-test-db command.

API Integration Tests

Run API integration tests with make api-integration-test

Cypress e2e Tests

Run Cypress integration tests with make test-e2e or make test-web. test-web runs pa11y if cypress tests succeed.

If you want to open Cypress UI while developing new test cases, run make run-test-apps to prepare applications and then run make open:cypress

Seed data

Login test case should be run to seed a test account and applicants before running any other cases requiring logging in.

Cypress session

Authentication with Keycloak is a little expensive and time-consuming. To reduce interaction with it, call cy.login() before each test case. It creates and stores a session. Subsequent calls restore the session so that it could save time to log in again. When logging in with a user of different role, pass its id as a parameter, then it creates its isolated new session.

cy.login('ien_hmbc')

All test users should have the same password.

Accessibility Tests

See accessibility README

Deployments

Workflow and environments

We have four environments where we run the application: local, development, test, and production.

  • local is normally each developer's laptop or workstation. How to run the app section is meant for it.
  • dev, test, and prod are on OCIO Cloud Platform - AWS LZ2 with project code of uux0vy. They are provisioned by the same IaC but with a little different variables.

The standard process of deployment goes through the following steps.

  1. Run and test the app on local environment while implementing a new feature. Once the task is done,
  2. Create, review, and merge a pull request,
  3. Deploy to dev. Developers verify the app,
  4. Deploy to test. QA team verify the app; Clients might use test to confirm that the app is ready to be released.
  5. Deploy to prod with approval.

To trigger deployment, run make tag-{env}. ex) make tag-dev

dev, test and prod deployments to AWS are managed through Terraform configurations and GitHub actions. They do not require access to LZ2. However, in order to access LZ2 for updating parameters, troubleshooting, or diagnosing the app, your IDIRs would have to be onboarded on to LZ2 for the project code uux0vy - IEN.

Authentication

local and dev use FreshWorks's Keycloak server at https://keycloak.freshworks.club.

test and prod use Ministry of Health's Keycloak server at https://common-logon-test.hlth.gov.bc.ca and https://common-logon.hlth.gov.bc.ca

The notable difference is that MoH Keycloak doesn't allow direct access grants. Therefore, you can't use pre-request to authenticate on Postman.

Infrastructure and Deployments:

The AWS infrastructure is created and updated using Terraform and Terraform Cloud as the backend.

The TFC keys required to run terraform can be found in SSM store in AWS.

Make commands are listed under terraform commands in Makefile for initialization, plan and deployment of resources.

Service accounts are created with IAM permissions to deploy cloud resources such as - S3 static file uploads, update lambda function, cloudfront invalidation etc.

Production Release:

All changes in main branch are released to production by tagging make tag-prod along with the version number of the release.

This creates a release tag and also a production tag, deploying to production, once approved by the Leads / DevOps team members.

As a part of the production release approval:

  1. Validate the latest ZAP scan results to ensure no new vulnerabilities are introduced.
  2. Review the latest code quality analysis results in Sonar Cloud to ensure no new vulnerabilities are introduced.

Database Backup restore

Database backups occur on every deployment and also during the scheduled backup window.

To restore the database from a backup, the following steps need to be performed in the specified order

  • Find the snapshot to restore from the AWS console
  • snapshots created during a build are tagged with the commit sha
  • Uncomment everything from the file terraform/db_backup.tf
  • Comment everything from the file terraform/db.tf. This deletes the existing RDS cluster. If any debugging needs to be done on the bad rds cluster do not do this step
  • Update local var snapshot_name to the snapshot name from the console
  • Uncomment the line POSTGRES_HOST = aws_rds_cluster.pgsql_backup.endpoint from terraform/api.tf
  • Comment out the line POSTGRES_HOST = aws_rds_cluster.pgsql.endpoint from terraform/api.tf
  • Run ENV_NAME=prod make plan and ENV_NAME=prod make apply. Change ENV_NAME based on the needs
  • This should create a new rds cluster from the snapshot provided and update api to point to the new backup cluster

Security Requirements:

All BC gov projects must pass the STRA (Security Threat and Risk Assessment Standard) and maintain the approved SoAR

More details on STRA here

Regular review of ZAP Scan and Sonar Qube results must be performed. Especially before release to production.

Current STRA and SoAR here

Portal should be SSL, process for certificate renewal - Refer

internationally-educated-nurses's People

Contributors

amar-fw avatar bhumin-fw avatar coryatwater-fw avatar dbayly-freshworks avatar fwkendall avatar jgh-ey avatar repo-mountie[bot] avatar sunghwan-park-fw avatar v-y-a-s avatar vyasworks avatar will-freshworks avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

internationally-educated-nurses's Issues

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2920560424

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2382280157

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2295275469

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3108801400

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2904956455

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2594234225

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2619213987

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2664019941

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2734774866

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2848932079

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3153152815

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2966827756

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3085314105

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3070739761

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3130014362

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2489267595

Add missing topics

TL;DR

Topics greatly improve the discoverability of repos; please add the short code from the table below to the topics of your repo so that ministries can use GitHub's search to find out what repos belong to them and other visitors can find useful content (and reuse it!).

Why Topic

In short order we'll add our 800th repo. This large number clearly demonstrates the success of using GitHub and our Open Source initiative. This huge success means it's critical that we work to make our content as discoverable as possible. Through discoverability, we promote code reuse across a large decentralized organization like the Government of British Columbia as well as allow ministries to find the repos they own.

What to do

Below is a table of abbreviation a.k.a short codes for each ministry; they're the ones used in all @gov.bc.ca email addresses. Please add the short codes of the ministry or organization that "owns" this repo as a topic.

add a topic

That's it, you're done!!!

How to use

Once topics are added, you can use them in GitHub's search. For example, enter something like org:bcgov topic:citz to find all the repos that belong to Citizens' Services. You can refine this search by adding key words specific to a subject you're interested in. To learn more about searching through repos check out GitHub's doc on searching.

Pro Tip ๐Ÿค“

  • If your org is not in the list below, or the table contains errors, please create an issue here.

  • While you're doing this, add additional topics that would help someone searching for "something". These can be the language used javascript or R; something like opendata or data for data only repos; or any other key words that are useful.

  • Add a meaningful description to your repo. This is hugely valuable to people looking through our repositories.

  • If your application is live, add the production URL.

Ministry Short Codes

Short Code Organization Name
AEST Advanced Education, Skills & Training
AGRI Agriculture
ALC Agriculture Land Commission
AG Attorney General
MCF Children & Family Development
CITZ Citizens' Services
DBC Destination BC
EMBC Emergency Management BC
EAO Environmental Assessment Office
EDUC Education
EMPR Energy, Mines & Petroleum Resources
ENV Environment & Climate Change Strategy
FIN Finance
FLNR Forests, Lands, Natural Resource Operations & Rural Development
HLTH Health
IRR Indigenous Relations & Reconciliation
JEDC Jobs, Economic Development & Competitiveness
LBR Labour Policy & Legislation
LDB BC Liquor Distribution Branch
MMHA Mental Health & Addictions
MAH Municipal Affairs & Housing
BCPC Pension Corporation
PSA Public Service Agency
PSSG Public Safety and Solicitor General
SDPR Social Development & Poverty Reduction
TCA Tourism, Arts & Culture
TRAN Transportation & Infrastructure

NOTE See an error or omission? Please create an issue here to get it remedied.

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2862245509

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2353702085

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2950999367

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2550302749

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2796281665

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2671506964

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2428269046

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2883695712

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3024284103

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3062203841

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2526821519

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2742976262

Add project lifecycle badge

No Project Lifecycle Badge found in your readme!

Hello! I scanned your readme and could not find a project lifecycle badge. A project lifecycle badge will provide contributors to your project as well as other stakeholders (platform services, executive) insight into the lifecycle of your repository.

What is a Project Lifecycle Badge?

It is a simple image that neatly describes your project's stage in its lifecycle. More information can be found in the project lifecycle badges documentation.

What do I need to do?

I suggest you make a PR into your README.md and add a project lifecycle badge near the top where it is easy for your users to pick it up :). Once it is merged feel free to close this issue. I will not open up a new one :)

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2713708713

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2334237360

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2314611436

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2755428207

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2276681778

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2819442345

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2258568485

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2783375491

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2448160926

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2629343102

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3046533367

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2103138823

Lets use common phrasing

TL;DR ๐ŸŽ๏ธ

Teams are encouraged to favour modern inclusive phrasing both in their communication as well as in any source checked into their repositories. You'll find a table at the end of this text with preferred phrasing to socialize with your team.

Words Matter

We're aligning our development community to favour inclusive phrasing for common technical expressions. There is a table below that outlines the phrases that are being retired along with the preferred alternatives.

During your team scrum, technical meetings, documentation, the code you write, etc. use the inclusive phrasing from the table below. That's it - it really is that easy.

For the curious mind, the Public Service Agency (PSA) has published a guide describing how Words Matter in our daily communication. Its an insightful read and a good reminder to be curious and open minded.

What about the master branch?

The word "master" is not inherently bad or non-inclusive. For example people get a masters degree; become a master of their craft; or master a skill. It's generally when the word "master" is used along side the word "slave" that it becomes non-inclusive.

Some teams choose to use the word main for the default branch of a repo as opposed to the more commonly used master branch. While it's not required or recommended, your team is empowered to do what works for them. If you do rename the master branch consider using main so that we have consistency among the repos within our organization.

Preferred Phrasing

Non-Inclusive Inclusive
Whitelist => Allowlist
Blacklist => Denylist
Master / Slave => Leader / Follower; Primary / Standby; etc
Grandfathered => Legacy status
Sanity check => Quick check; Confidence check; etc
Dummy value => Placeholder value; Sample value; etc

Pro Tip ๐Ÿค“

This list is not comprehensive. If you're aware of other outdated nomenclature please create an issue (PR preferred) with your suggestion.

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2891346860

ZAP Full Scan Report

View the following link to download the report.
RunnerID:3001931480

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2699439678

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2876618442

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2570843737

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2406756042

ZAP Full Scan Report

View the following link to download the report.
RunnerID:2805161790

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.