This is an internal project for Knowit. The project aims to create a tool to gauge the employees' skills and motivations through a web form, and to make the analyses based on the form available for the individual employees and managers.
This project requires npm. It also requires that AWS CLI and AWS CDK are installed. All custom scripts are written in bash script.
To use an AWS CLI sso profile, you need to run the sync_sso.py script before running our npm commands for deploying the backend. This script requires you to have boto3 installed on the python environment you use.
python sync_sso.py awscliprofilename is the full command you need to run. This creates temporary credentials for the SSO profile, allowing npm run deploy to use those to perform calls to AWS.
To run the project locally:
- Clone the GitHub repo.
- Run
$ cd kompetansekartlegging-app(or whatever you've chosen to name the project in the cloning process) - Run
$ ./install.sh - Run
cd cdk - Configure AWS CLI credentials:
- If you are using AWS SSO profiles you need to run
python sync_sso.py aws-cli-profile - If not, run
aws configurefollowed by eitherexport AWS_PROFILE={aws cli profilename}on Linux/macOS orset AWS_PROFILE={aws cli profilename}on Windows, where{aws cli profilename}=defaultif you have not configured additional profiles
- If you are using AWS SSO profiles you need to run
- Run
cdk bootstrap - Create a cdk.context.json file with an
ENVkey:- Deploy to sandbox? Give
ENVany value you want, but it has to be unique, so you might get a conflict if it already exists on AWS - Deploy to dev or prod? The
ENVvalue must bedevorprod. You also need to add anAZUREkey (Azure AD metadata url)
{ "ENV": "exampleenv" } - Deploy to sandbox? Give
- Run
npm run deployfollowed bynpm run codegen(Alternatively, go to root directory and run./deploybackend.sh full) - Run
cd ../frontendfollowed bynpm start
- Run
./deploybackend.shto deploy changes to the backend - Run
npm startin frontend folder to run frontend locally - For testing purposes, you can add data to your sandbox by running custom scripts such as
scripts/create_test_data.py
Production deployment instructions can be found here
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testsnpm run lintrun ESLint and Prettier checknpm run lint-fixfix auto-fixable lint and formatting errorscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation template./test.shinstalls test dependencies and runs tests
- Appsync Transformer for CDK: https://github.com/kcwinner/cdk-appsync-transformer
- Codegen inspiration: https://github.com/kcwinner/advocacy/tree/master/cdk-amplify-appsync-helpers
GitHub Actions is configured to deploy the app to the AWS dev environment on every PR merge. This will be skipped if there are only changes to certain files like readmes, and are specified in .github/workflows/deploy.yml.
Additionally, deployment can be triggered through the dispatchable workflow "Deploy to AWS", where you specify which environment to deploy to, and whether to deploy the entire app or the backend only.
ESLint and Prettier is configured for the frontend code using recommended rules. GitHub Actions analyzes the code when PRs towards the main branch are opened.
Tests run on every pull request towards the main branch.
When deploying to both the dev and production environments, a bot will post to a channel using Slack Apps and the Slack Notify action.
Documentation for the external API can be found at this projects Github Pages (kompetansekartlegging-app/docs) or at this URL: https://apidocs.kompetanse.knowit.no