Skip to content

Latest commit

 

History

History
119 lines (82 loc) · 2.7 KB

README.md

File metadata and controls

119 lines (82 loc) · 2.7 KB

ALCS + Portal API

Main API built with NestJS + TypeOrm, requires a running Postgres Database + Redis

Installation

$ npm install

Running the app

# development
$ npm run alcs:start

# watch mode
$ npm run {env}:start:dev

# production mode
$ npm run {env}:start:prod

Test

Create test.json (you could copy values from default.json and tweak them as needed)

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

TypeOrm

# create empty migration file:
  npm run alcs:migration:create --name=<file_name>
# generate migrations:
  npm run alcs:migration:generate --name=<file_name>
# apply migration:
  npm run alcs:migration:run
# revert migration
  npm run alcs:typeorm migration:revert

Postgres tests

Postgres unit tests are implemented using pgTap.

# run tests
docker-compose up --build pgtap

Queues

nestjs Bull use this link for validating/generating cron expressions crontab.cronhub.io

Dependency Graph

npm run graph

Paste console output into https://mermaid-js.github.io/mermaid-live-editor and configure

DATES

NOTE: ALL DATES ON API MUST BE OF TYPE DATE IN UTC
NOTE: ALL DATES IN DB MUST BE TIMESTAMPTZ IN UTC

gRPC [DEPRECATED]

Server communication between ALCS server and Portal server is performed using gRPC. gRPC uses protocol buffers (*.proto) as both its Interface Definition Language (IDL) and as its underlying message interchange format.

ALCS and Portal support mutual TLS to ensure secure communication. TLS also enabled for local environment using the self-signed certificates included in the source code. If you need to generate new set of certificates or learn more about the process refer to certstrap

TS implementation of *.proto files can be provided manually or generated using ts-proto tool

Local Database Backup & Restore

Backup

  • Install & add open shift to path
  • Login to with token from silver cluster
  • Set preferred project oc project NAMESPACE
  • Forward port, usually 5432
  oc port-forward service/alcs-patroni 5432:5432
  • Add new connection to app with preferred DB tool (DBeaver, TablePlus)
  • Backup DB & save dump file. ensure postgresql 12.x is selected
  • Stop port forwarding

Restore

  • Connect to local DB
  • In DB tool select restore for app DB
  • Select file to restore from
  • Ensure postgresql 12.x being used
  • If databse does not exist, example app, select create option

Security Logs

Navigate to this README on how to access API Logs