Skip to content
This repository has been archived by the owner on Dec 19, 2020. It is now read-only.

Latest commit

 

History

History
80 lines (67 loc) · 2.98 KB

README.md

File metadata and controls

80 lines (67 loc) · 2.98 KB

ccims-backend-demo

the demo backend

IMPORTAND

This is a demo/mockup It was created as fast as possible witout a lot of care in good programming practice.

The final system will be completly rewritten

Usage

With Docker

Before starting the docker containers first run npm install in this folder!

# for a clean build run this before docker compose:
rm tsconfig.tsbuildinfo
# start the containers
docker-compose -f stack.yml up

postgres.json for docker:

{
    "$schema": "./postgres.schema.json",
    "username": "demo-user",
    "password": "demo-password",
    "database": "CCIMS",
    "server": "db"
}

Access the db with psql:

psql --username demo-user --dbname CCIMS --host localhost --port 5433
# password is 'demo-password'

Without docker

All commands below should be executed in the root directory of this repository

  1. Download and install PostgreSQL
  2. Create poetgres data base: createdb [YOUR_DB_NAME] (Potenially add -U [POSTGRS_USER] option if using a different Postgres user)
  3. Run the database initialization script psql -d [YOUR_DB_NAME] -f .\databaseScripts.sql (If needed add user; see above)
  4. Create file postgres.json in Directory ./src/config with the content below these instructions. For more Infos on the config options see the liked json-Schema
  5. Install typescript npm install -g typescript
  6. Install all dependencies npm i
  7. Run typescript compiler tsc
  8. Run application node ./out/index.js

postgres.json

{
    "$schema": "./postgres.schema.json",
    "username": "[POSTGRS_USER]",
    "password": "[POSTRES_PASSWIORD]",
    "database": "[YOUR_DB_NAME]"
}

Adding github api key

  1. Goto https://github.com/settings/apps
  2. Create a new Github app
  3. Check Identifying and authorizing users -> Request user authorization (OAuth) during installation
  4. Set Identifying and authorizing users -> User authorization callback URL to http://localhost:8080/tokenResponse/github (Or the address where the ccims backend is reachable)
  5. Set Repository permissions -> Issues to Read & Write
  6. Click Install app or access the "public link" of your GitHub App
  7. Chose on which account/organization you want to grant the app access
  8. Select the repository/repositories which the app should be able to access
  9. Press Authorize & Request. The app has now access to those repositories. (The link you are redirected to is irrelevant; you will request a user-specific token in the next steps)
  10. Enter the client id and client secret in the file defaultUser.sql (and the redirectUri in case it differs from the one given above)
  11. Execute the defaultUser.sql script
  12. Start the backend
  13. Navigate to http://localhost:8080/tokenRequest/github (Or the url where the backend is reachable)
  14. Enter admin and press Start authorization
  15. Authorize the github app
  16. Install your
  17. Once authorized you should be redirected back to the backend and see the message Token will be added