To begin using this project in a local development environment please follow the steps below. This project heavily uses nx.dev to manage dependencies and as a general task runner. You can watch this comprehensive video to get acquinted with nx. Here are some general guidelines using nx:
This api utilizes node-config for configuration variables. Take a look at config/default.js for
an example of configuration variables. You can overwrite any variable inside config/local.ts file. Or by supplying the NODE_CONFIG variable as a JSON object.
Install Docker and Docker Compose from the the here. Currently, the Platform depends on the following services to run:
The Platform comes with a docker-compose.yaml which allows you to spin up the necessary required containers to run.
To spin up the stack, run:
docker-compose up # add -d flag to run detached
To tear down the stack, run:
docker-compose down
Install the latest version of NodeJS 12.x from the Node website or by using your platform's Node version manager.
In order to build an application or a library, do the following:
# To build the the identity application
npm run build platform-identity --prod
# To build the the platform/common library
npm run build platform-common
To run any application, do the following:
# To run the identity platform
npm run start platform-identity
# or
nx serve platform-identity
This project uses eslint and prettier for linting and code quality checks. A successful lint is required for any pull request to get merged.
# To run linting on affected files
npm run affected:lint
To format:
npm run format:write
To build the image of a microservice, you can pass the PLATFORM_APP as a build arg. For example, to build the
identity image, run:
docker build --build-arg PLATFORM_APP=identity -t identity:local .
To spin up the container:
docker run -it --rm \
--env PLATFORM_APP=identity \
--env NODE_ENV=development \
--env NODE_CONFIG='{"authentication":{"cookie":"X-Kloudio-Authentication","crypto":{"algorithm":"sha256","key":"defaultKey"},"jwt":{"secret":"defaultKey","signOptions":{"expiresIn":"86400s"}},"sso":{"clientRedirect":"http://localhost:4200/dashboards","serverCallback":"http://localhost:3000/v1/users/login","okta":{"serverUrl":"https://dev-642472.okta.com/oauth2/default"}}},"database":{"type":"postgres","host":"localhost","port":5432,"username":"kloud","password":"password","database":"kloudio"},"port":3000,"redis":{"database":"platform","host":"localhost","port":6379,"cacheConfig":{"session:default":{"expiresIn":86400},"state:okta":{"expiresIn":60}}}}' \
--name identity -p 8089:80 identity:local
Content type
Image
Digest
Size
175.2 MB
Last updated
over 5 years ago
docker pull kloudio/public-api