You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Configuration for the application is at config/default.js and config/production.js. The following parameters can be set in config files or in env variables:
13
14
14
15
- LOG_LEVEL: the log level
15
16
- PORT: the server port
17
+
- CASCADE_PAUSE_MS: how many milliseconds to pause between deleting records during cascade delete (default to 1000)
16
18
- AUTH_SECRET: TC Authentication secret
17
19
- VALID_ISSUERS: valid issuers for TC authentication
18
20
- PAGE_SIZE: the default pagination limit
19
21
- MAX_PAGE_SIZE: the maximum pagination size
20
22
- API_VERSION: the API version
21
-
- AWS_ACCESS_KEY_ID: The AWS access key
22
-
- AWS_SECRET_ACCESS_KEY: The AWS secret key
23
-
- AWS_REGION: The Amazon region to use when connecting.
24
-
- DATABASE: The QLDB ledger name
23
+
- DB_NAME: the database name
24
+
- DB_USERNAME: the database username
25
+
- DB_PASSWORD: the database password
26
+
- DB_HOST: the database port
27
+
- DB_PORT: the database port
25
28
- AUTH0_URL: Auth0 URL, used to get TC M2M token
26
29
- AUTH0_AUDIENCE: Auth0 audience, used to get TC M2M token
27
30
- TOKEN_CACHE_TIME: Auth0 token cache time, used to get TC M2M token
@@ -57,26 +60,38 @@ For `ES.DOCUMENTS` configuration, you will find multiple other configurations be
57
60
58
61
Setup your Elasticsearch instance and ensure that it is up and running.
59
62
60
-
1.Visit [this link](https://console.aws.amazon.com/qldb/home?region=us-east-1#gettingStarted), login and create one **ledger** databases named `ubahn-db`
61
-
2.Visit [this link](https://console.aws.amazon.com/iam/home?region=us-east-1#/security_credentials) to download your "Access keys"
62
-
3.Follow *Configuration* section to update config values, like database, aws key/secret etc ..
63
-
4.Goto *UBahn-api*, run `npm i` and `npm run lint`
64
-
5.Import mock data, `node scripts/db/genData.js`, this will create tables and gen some data for test (if you need this)
63
+
1.Follow *Configuration* section to update config values, like database, etc ..
64
+
2.Goto *UBahn-api*, run `npm i` and `npm run lint`
65
+
3.Run the migrations - `npm run migrations up`. This will create the database, the tables.
66
+
4.Then run `npm run insert-data` and insert mock data into the database.
67
+
5.You will then run `npm run migrate-db-to-es` to migrate the data to elasticsearch from the database
65
68
6. Startup server `node app.js` or `npm run start`
66
69
67
-
## Working with mock data
70
+
## Migrations
68
71
69
-
You can use the scripts `npm run insert-data` (and `npm run delete-data`) to insert mock data (and delete mock data respectively). The data is inserted into QLDB and Elasticsearch. You need to setup the configurations beforehand and also start the elasticsearch instance before you run these scripts
72
+
Migrations are located under the `./scripts/db/` folder. Run `npm run migrations up` and `npm run migrations down` to execute the migrations or remove the earlier ones
73
+
74
+
## Import data from QLDB
75
+
76
+
Make sure `QLDB_NAME`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` are set in your environment
77
+
78
+
Run `npm run migrate-qldb-to-pg` to import data from qldb.
79
+
80
+
## Import data from S3 to QLDB
81
+
82
+
Make sure `BUCKET_NAME`, `QLDB_NAME`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` are set in your environment
83
+
84
+
Run `npm run import-s3-data` to import data from s3 to qldb.
70
85
71
86
## Local Deployment with Docker
72
87
73
-
Make sure all config values are right(aws key and secret), and you can run on local successful, then run below commands
88
+
Make sure all config values are right, and you can run on local successfully, then run below commands
74
89
75
90
1. Navigate to the directory `docker`
76
91
77
-
2. Rename the file `sample.api.env` to `api.env`
92
+
2. Rename the file `sample.env` to `.env`
78
93
79
-
3. Set the required AUTH0 configurations, AWS credentials and ElasticSearch host in the file `api.env`
94
+
3. Set the required AUTH0 configurations, DB configurations and ElasticSearch host in the file `.env`
80
95
81
96
4. Once that is done, run the following command
82
97
@@ -86,128 +101,4 @@ Make sure all config values are right(aws key and secret), and you can run on lo
86
101
87
102
5. When you are running the application for the first time, It will take some time initially to download the image and install the dependencies
88
103
89
-
## API endpoints verification
90
-
91
-
1. open postman
92
-
2. import *docs/UBahn_API.postman_collection.json* , *UBahn_ENV.postman_environment.json* and then check endpoints
93
-
94
-
## Test token
95
-
96
-
you can use below token to test role and permissions
0 commit comments