radiantone/eoc-backend

By radiantone

Updated 3 days ago

Image
1

1M+

radiantone/eoc-backend repository overview

RadiantLogic CloudManager Backend

One-Time Setup of the Development Environment

Download and Install nvm

https://github.com/coreybutler/nvm-windows

Install node Version >= 16

nvm install 16.18.0

nvm use 16.18.0

Install Project Dependencies

npm install

npm install -g @nestjs/cli

Configure the Environment

Create a file named .env; use the .env.sample file as a template. For each of the following steps adjust the port numbers, database names, credentials etc. and fill them in the corresponding place in the .env file.

Run a Docker Container with Postgres

https://hub.docker.com/_/postgres

docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cloudmanager -p 5432:5432 --name "cloudmanager-postgres" -d postgres

Run a Docker Container with Redis

https://hub.docker.com/_/redis

docker run -p 6379:6379 --name "cloudmanager-redis" -d redis

Edit the hosts File

Add 127.0.0.1 radiantlogic-local.com at the end of the hosts file C:\Windows\System32\drivers\etc\hosts

Create a Google OAuth Application

Google OAuth Consent Screen 1

Google OAuth Consent Screen 3

Create a OAuth Application ( Web Application )

Google OAuth Application

Create a Github OAuth Application

Github OAuth Application

Note: For Google OAuth, the email address must be present in the Test users list on the OAuth Consent Screen configuration.

Setup authentication with microsoft

Note: The application needs to be multi-tenant.

  • client id Microsoft Azure App Client Id

  • create new client secret Microsoft Azure App Client Id

Install the Git Hooks

git config core.hooksPath .githooks

Provisioning an admin account upon first run of the application

Setup an environment variable (in the .env file) for provisioning an admin account [email protected]. See the .env.sample file for more details and additional admin configuration options.

Running the Application

Run either of the following commands:

  • npm run start
  • npm run start:dev
  • npm run start:debug

Open your browser pointing to http://radiantlogic-local.com:3000/ to see the Swagger UI.

Synchronizing the database schema

On every startup of the application the database schema will be updated by running the migrations, or you can manually execute them by running npm run typeorm:cli -- migration:run. https://orkhan.gitbook.io/typeorm/docs/migrations

You may find that synchronizing the schema is easier when developing npm run typeorm:cli -- schema:sync. https://orkhan.gitbook.io/typeorm/docs/faq#how-do-i-update-a-database-schema

Create a User in the Database

Use an SQL client to insert a user in the database, with the email address that you want to login with.

You can launch a terminal in your postgres container and run:

  • psql -U postgres
    • inside the psql shell run:
      • \c cloudmanager;
      • INSERT INTO "user" ("email", "admin") VALUES ('your-email-here', true);

Run grafana docker container

Grafana is required for the application to run correctly

Steps for setting up grafana:

  1. docker build -t grafana-eoc -f .\alertmanager\Grafana.dockerfile .\alertmanager\
  2. docker run -d --name grafana -p 3008:3000 grafana-eoc

NOTE: You can replace default url for grafana in .env file

Create new migration:

npx typeorm-ts-node-commonjs migration:create /backend-workspace/src/migrations/addIsWhitelistActive

Tag summary

Content type

Image

Digest

sha256:ce74d9734

Size

352.2 MB

Last updated

3 days ago

docker pull radiantone/eoc-backend:dev-opt