4
4
5
5
- nodejs https://nodejs.org/en/ (v10)
6
6
- DynamoDB
7
+ - AWS S3
7
8
- Docker, Docker Compose
8
9
9
10
## Configuration
@@ -15,14 +16,38 @@ The following parameters can be set in config files or in env variables:
15
16
- PORT: the server port, default is 3000
16
17
- AUTH_SECRET: The authorization secret used during token verification.
17
18
- VALID_ISSUERS: The valid issuer of tokens.
18
- - DYNAMODB.AWS_ACCESS_KEY_ID: The Amazon certificate key to use when connecting. Use local dynamodb you can set fake value
19
- - DYNAMODB.AWS_SECRET_ACCESS_KEY: The Amazon certificate access key to use when connecting. Use local dynamodb you can set fake value
20
- - DYNAMODB.AWS_REGION: The Amazon certificate region to use when connecting. Use local dynamodb you can set fake value
21
- - DYNAMODB.IS_LOCAL: Use Amazon DynamoDB Local or server.
22
- - DYNAMODB.URL: The local url if using Amazon DynamoDB Local
19
+ - AUTH0_URL: AUTH0 URL, used to get M2M token
20
+ - AUTH0_PROXY_SERVER_URL: AUTH0 proxy server URL, used to get M2M token
21
+ - AUTH0_AUDIENCE: AUTH0 audience, used to get M2M token
22
+ - TOKEN_CACHE_TIME: AUTH0 token cache time, used to get M2M token
23
+ - AUTH0_CLIENT_ID: AUTH0 client id, used to get M2M token
24
+ - AUTH0_CLIENT_SECRET: AUTH0 client secret, used to get M2M token
25
+ - AMAZON.AWS_ACCESS_KEY_ID: The Amazon certificate key to use when connecting. Use local dynamodb you can set fake value
26
+ - AMAZON.AWS_SECRET_ACCESS_KEY: The Amazon certificate access key to use when connecting. Use local dynamodb you can set fake value
27
+ - AMAZON.AWS_REGION: The Amazon certificate region to use when connecting. Use local dynamodb you can set fake value
28
+ - AMAZON.IS_LOCAL_DB: Use Amazon DynamoDB Local or server.
29
+ - AMAZON.DYNAMODB_URL: The local url if using Amazon DynamoDB Local
30
+ - AMAZON.ATTACHMENT_S3_BUCKET: the AWS S3 bucket to store attachments
31
+ - FILE_UPLOAD_SIZE_LIMIT: the file upload size limit in bytes
32
+ - CHALLENGES_API_URL: TC challenges API base URL
33
+ - GROUPS_API_URL: TC groups API base URL
34
+ - COPILOT_RESOURCE_ROLE_IDS: copilot resource role ids allowed to upload attachment
35
+
36
+
37
+ Set the following environment variables so that the app can get TC M2M token (use 'set' insted of 'export' for Windows OS):
38
+
39
+ - export AUTH0_CLIENT_ID=8QovDh27SrDu1XSs68m21A1NBP8isvOt
40
+ - export AUTH0_CLIENT_SECRET=3QVxxu20QnagdH-McWhVz0WfsQzA1F8taDdGDI4XphgpEYZPcMTF4lX3aeOIeCzh
41
+ - export AUTH0_URL=https://topcoder-dev.auth0.com/oauth/token
42
+ - export AUTH0_AUDIENCE=https://m2m.topcoder-dev.com/
43
+
44
+
45
+ Also properly configure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, ATTACHMENT_S3_BUCKET config parameters.
46
+
23
47
24
48
## DynamoDB Setup with Docker
25
49
We will use DynamoDB setup on Docker.
50
+ Note that you may need to modify regions in ` local/init-dynamodb.sh ` and ` local/config ` .
26
51
27
52
Just run ` docker-compose up ` in local folder
28
53
@@ -49,16 +74,27 @@ aws dynamodb scan --table-name ChallengeSetting --endpoint-url http://localhost:
49
74
aws dynamodb scan --table-name AuditLog --endpoint-url http://localhost:7777
50
75
aws dynamodb scan --table-name Phase --endpoint-url http://localhost:7777
51
76
aws dynamodb scan --table-name TimelineTemplate --endpoint-url http://localhost:7777
77
+ aws dynamodb scan --table-name Attachment --endpoint-url http://localhost:7777
52
78
```
53
79
54
80
## Local Deployment
55
81
56
82
- Install dependencies ` npm install `
57
83
- Run lint ` npm run lint `
58
84
- Run lint fix ` npm run lint:fix `
85
+ - Clear and init db ` npm run init-db `
59
86
- Start app ` npm start `
60
87
- App is running at ` http://localhost:3000 `
61
- - Clear and init db ` npm run init-db `
62
88
63
89
## Verification
64
90
Refer to the verification document ` Verification.md `
91
+
92
+ ## Notes
93
+
94
+ - after uploading attachments, the returned attachment ids should be used to update challenge;
95
+ finally, attachments have challengeId field linking to their challenge,
96
+ challenge also have attachments field linking to its attachments,
97
+ this will speed up challenge CRUDS operations.
98
+
99
+ - updated swagger may be viewed and validated at ` http://editor.swagger.io/ `
100
+
0 commit comments