the demo backend
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
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'
All commands below should be executed in the root directory of this repository
- Download and install PostgreSQL
- Create poetgres data base:
createdb [YOUR_DB_NAME]
(Potenially add-U [POSTGRS_USER]
option if using a different Postgres user) - Run the database initialization script
psql -d [YOUR_DB_NAME] -f .\databaseScripts.sql
(If needed add user; see above) - 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 - Install typescript
npm install -g typescript
- Install all dependencies
npm i
- Run typescript compiler
tsc
- Run application
node ./out/index.js
{
"$schema": "./postgres.schema.json",
"username": "[POSTGRS_USER]",
"password": "[POSTRES_PASSWIORD]",
"database": "[YOUR_DB_NAME]"
}
- Goto https://github.com/settings/apps
- Create a new Github app
- Check
Identifying and authorizing users -> Request user authorization (OAuth) during installation
- Set
Identifying and authorizing users -> User authorization callback URL
tohttp://localhost:8080/tokenResponse/github
(Or the address where the ccims backend is reachable) - Set
Repository permissions -> Issues
toRead & Write
- Click
Install app
or access the "public link" of your GitHub App - Chose on which account/organization you want to grant the app access
- Select the repository/repositories which the app should be able to access
- 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) - Enter the client id and client secret in the file
defaultUser.sql
(and the redirectUri in case it differs from the one given above) - Execute the
defaultUser.sql
script - Start the backend
- Navigate to http://localhost:8080/tokenRequest/github (Or the url where the backend is reachable)
- Enter
admin
and pressStart authorization
- Authorize the github app
- Install your
- Once authorized you should be redirected back to the backend and see the message
Token will be added