Skip to content

Commit 42e5272

Browse files
resolving conflict manually.
2 parents 2aa8019 + 8e367d2 commit 42e5272

36 files changed

+6946
-2210
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
node_modules/
2-
dist

.swagger-codegen-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.swagger-codegen/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.3.1

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: node index.js
1+
web: node index.js

README.md

Lines changed: 21 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
# TopCoder Notifications - Bus API Server
2-
------------------------------------------------------------
1+
# Topcoder Bus API Server
2+
3+
## Overview
4+
5+
A meta service, Topcoder Bus API server provides information about other services offered by Topcoder.
6+
7+
This server was generated initially by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. We then copied over changes that existed in the older version over to version 5
38

49
## Requirements
510

6-
- node.js 8.7.0 (the latest)
7-
- Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli#download-and-install
11+
Nodejs: ~8
812

913
## Configuration
1014

11-
### Kafka Configurations
1215
The following Kafka configurations must be set in the environment variables:
16+
1317
- `KAFKA_URL` the Kafka url
1418
- `KAFKA_CLIENT_CERT` the SSL client cert, can be string or file path
1519
- `KAFKA_CLIENT_CERT_KEY` the SSL client cert key, can be string or file path
@@ -69,7 +73,7 @@ Jp8xItVz3sqz5aCg+EvcewSGZ18AC+9cbxrbI2I83jQDHw+DQmVUyR6rl5+r+S6O
6973
-----END RSA PRIVATE KEY-----"
7074
```
7175

72-
### Other Configurations
76+
## Other Configurations
7377

7478
The other configurations can be changed in `config/default.js` or by setting environment variables.
7579

@@ -83,123 +87,23 @@ The other configurations can be changed in `config/default.js` or by setting env
8387
- `TC_EMAIL_TOKEN` the email service authentication token (see tc-email README for details **link should be added later**)
8488
- `TC_EMAIL_CACHE_PERIOD` the period to cache template placeholders from email service (60 min default)
8589

86-
## Code Standard
87-
The code follows StandardJS:
88-
89-
```bash
90-
npm install
91-
npm run lint
92-
```
93-
94-
## Generate JWT Tokens:
95-
To generate JWT Tokens for allowed services, run:
96-
97-
```bash
98-
npm run generate-tokens
99-
```
100-
101-
## Local Deployment and Verification
102-
103-
- Start
104-
105-
```
106-
npm run start
107-
```
108-
109-
- Import `docs/tc-bus-api-server.postman_collection.json` and `docs/tc-bus-api-server.postman_environment.json` to Postman
110-
- Change `URL` environment variable in Postman according to your deployment. If you deploy locally, it should be `http://localhost:3000/api/v1` by default
111-
- Change `VALID_TOKEN` if you want to test with another JWT token
112-
- Change `VALID_MESSAGE_TYPE` if you want to test with another message type
113-
- Change `EMAIL` to a valid e-mail address
114-
- Execute calls to verify the endpoints
115-
116-
117-
### Verify the messsages end up in Kafka queue
118-
Check `bus-api-test/README.md` to run a consumer that consumes and prints all messages in Kafka queue.
119-
120-
## Heroku Deployment and Verification
121-
122-
- Login and create a new app
123-
```bash
124-
heroku login
125-
heroku create
126-
```
90+
## Deploying the server
12791

128-
- Set Kafka configurations (and other configurations if necessary)
129-
```bash
130-
heroku config:set KAFKA_URL=<your Kafka url> --app <your app name>
131-
heroku config:set KAFKA_CLIENT_CERT=<your Kafka client cert string or file> --app <your app name>
132-
heroku config:set KAFKA_CLIENT_CERT_KEY=<your Kafka client cert key string or file> --app <your app name>
133-
```
92+
To deploy the server locally, run:
13493

135-
Example (please change your app name):
13694
```bash
137-
heroku config:set KAFKA_URL="kafka+ssl://ec2-34-205-227-216.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-75-247.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-198-118-170.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-231-150-104.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-209-20.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-131-252.compute-1.amazonaws.com:9096,kafka+ssl://ec2-52-205-198-73.compute-1.amazonaws.com:9096,kafka+ssl://ec2-52-4-109-80.compute-1.amazonaws.com:9096" --app <your app name>
138-
139-
heroku config:set KAFKA_CLIENT_CERT="-----BEGIN CERTIFICATE-----
140-
MIIDQzCCAiugAwIBAgIBADANBgkqhkiG9w0BAQsFADAyMTAwLgYDVQQDDCdjYS1j
141-
YmJiNGVkZi1mNDFhLTRjNzMtYTg5OC01NDYyMjhkNmQyNDIwHhcNMTcwOTI3MDUw
142-
MTIyWhcNMjcwOTI3MDUwMTIyWjAZMRcwFQYDVQQDDA51ODFvcjFsdTl2dTB1bzCC
143-
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKjkcV/BXD13Q09bRKohN/sK
144-
iDMGFA2QZ57TGd7svX7iZQIk9HmXEPd5zCTHZ6nZBbcGDQ9P+zGlJIGZQuRVKLOn
145-
ZPilaeUHRGrvCWGJZ6lVPNqInC1STHTfFJhcUNMG6qaD2ayBAw16f13vD1wGEWCm
146-
/DRfvrjIp3JIetGdKctmdiGLYH7CQecRW88Czx9e3Vpl1nxGcNAPDDCj0nRwuPse
147-
fVrg5onPX355om+Ct/teSeSONhio4dFL3fwl47CXFCReZFYOrBoLexfHXHumJ/Kp
148-
TQW+k056hhoagykcpTf8uNjxNRalDPkw7ngt+1IzatbhOacea1/WUE1444eEak8C
149-
AwEAAaN9MHswHQYDVR0OBBYEFJJzd6OZVLthBkhVZEW42CR8NJbtMFoGA1UdIwRT
150-
MFGAFORcypfrQ0tfS5tyBdv89jfpZEMaoTakNDAyMTAwLgYDVQQDDCdjYS1jYmJi
151-
NGVkZi1mNDFhLTRjNzMtYTg5OC01NDYyMjhkNmQyNDKCAQAwDQYJKoZIhvcNAQEL
152-
BQADggEBALVAdOWXdnSqhucXHjpIf0lxlH6WhzhhlctLCreSf+/7y6pPVpWSVIEl
153-
seVxOE5tsO2OzdtGgN2t7rr6bHuakL5rk9rH06r1jYAVQBR+T6SSLFbSVzl4Q5TO
154-
b+T9/sHx5QtXSYgMh4FhZcBjrmDmWvpd42Y4MPfjLTqTP8RWHHib8E4/FYS9txk6
155-
WoxrKcgnm/RmOcFWrjNjgm6JJprO1BSnbc2i/Rs5rxG2tRTTmXp6d7QCRa0bdhKz
156-
yETgcStnaVvyh64zhls3xXBm06rvpu2wwo6QHcPeekvQwxQvb63oovD8b+pFJri+
157-
6MBSQE4TtQenlVx7Ksy9UdNmU21xCYU=
158-
-----END CERTIFICATE-----" --app <your app name>
159-
160-
heroku config:set KAFKA_CLIENT_CERT_KEY="-----BEGIN RSA PRIVATE KEY-----
161-
MIIEogIBAAKCAQEAqORxX8FcPXdDT1tEqiE3+wqIMwYUDZBnntMZ3uy9fuJlAiT0
162-
eZcQ93nMJMdnqdkFtwYND0/7MaUkgZlC5FUos6dk+KVp5QdEau8JYYlnqVU82oic
163-
LVJMdN8UmFxQ0wbqpoPZrIEDDXp/Xe8PXAYRYKb8NF++uMinckh60Z0py2Z2IYtg
164-
fsJB5xFbz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C
180-
szlRKhtyKW6JM1tMQHT7uQKBgEOP+Hirzh5kJOj/5gKvi2r9FLUVzGzOessDFnSR
181-
YbMjOfSSc+y21UAFQSKkR+f+KtOSqP/wSSB6jrnThtclwJHny7PGRc+9GxWHPBRu
182-
T/qQhRLsPokHBp/+8SZ8MYSe0vnvL6Xw3+XxC8SzpMytOri+lijlx8CEtBGUz/iM
183-
bZpxAoGAEnJFUEGCB1ta3RQpI5L4nH2Rex0Avv8rkXGK2T/t5z2h8Ujg4WW3J7DD
184-
Jp8xItVz3sqz5aCg+EvcewSGZ18AC+9cbxrbI2I83jQDHw+DQmVUyR6rl5+r+S6O
185-
69wdZ08Y/jYkltb5PbhPqs0Kfr86cUqBuKEptRtto6Wto3k/Za4=
186-
-----END RSA PRIVATE KEY-----" --app <your app name>
95+
npm install
96+
npm start
18797
```
18898

189-
- Push to Heroku
190-
```bash
191-
git init
192-
git add .
193-
git commit -m "init"
194-
heroku git:remote -a <your app name>
195-
git push heroku master
196-
```
99+
## Generate JWT Tokens:
197100

198-
- The app will be available at `https://<your app name>.herokuapps.com/api/v1`
101+
To generate JWT Tokens for allowed services, run:
199102

200-
- Verification is similar to local verification, but you need to change `URL` in Postman to the Heroku app url `https://<your app name>.herokuapps.com/api/v1`
103+
```bash
104+
npm run generate-tokens
105+
```
201106

202-
## Others
107+
To view the Swagger UI interface visit `http://localhost:3000/docs`
203108

204-
- Swagger definition: `docs/swagger.yaml`
205-
- Demo Heroku app: `https://morning-mesa-65797.herokuapp.com/api/v1`
109+
This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work.

0 commit comments

Comments
 (0)