Skip to content

Commit 512c848

Browse files
author
Dushyant Bhalgami
authored
Merge pull request #130 from appirio-tech/dev
Support added for Specification Review for Design Challenges
2 parents 8ab62df + a528211 commit 512c848

File tree

9 files changed

+567
-261
lines changed

9 files changed

+567
-261
lines changed

README.md

Lines changed: 18 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ Microservice for supporting Topcoder Online Review platform.
88

99
# Local Deployment
1010

11-
### Start Informix instance via Docker
12-
13-
- Set an IP for Docker by setting the environment variable `DOCKER_IP`. Recommended to set to `0.0.0.0`
14-
15-
- Command to set the environment variable `DOCKER_IP`
11+
### Configure the local/run.sh
1612

13+
- configure the docker ip
1714
```
18-
export DOCKER_IP=0.0.0.0
15+
export IP=192.168.99.100
1916
```
2017

21-
- To run Informix locally, go to the `local` folder and execute the following command:
18+
- To run Informix and kafka locally, go to the `local` folder and execute the following command:
2219

2320
```
2421
docker-compose up
@@ -61,98 +58,36 @@ docker exec -it local_informix dbaccess tcs_catalog test_data.sql
6158
- Docker environment is ready to be used in our service.
6259

6360
### Configuration Variables
64-
The configuration file `service/src/main/resources/review-service.yaml` contain the necessary configuration to run the microservice locally. Below configuration variables need to be set using environment variables.
65-
66-
|Name | Description |
67-
|--------------------|:-----------------------------------------:|
68-
|AUTH_DOMAIN | Authentication domain of JWT, Dont set unless you have valid tokens with given AUTH_DOMAIN, Defaulted to 'topcoder-dev.com' |
69-
|IP | The IP of your docker container |
70-
|OLTP_USER | The Informix OLTP user |
71-
|OLTP_PW | The Informix OLTP user password |
72-
|OLTP_URL | The JDBC URL of Informix OLTP database |
73-
|DW_USER | The Informix DW user |
74-
|DW_PW | The Informix DW user password |
75-
|DW_URL | The JDBC URL of Informix DW database |
76-
|TC_JWT_KEY | Secret used in JWT Service, Used for signature verification as well |
77-
78-
In Linux, Set the environment variables as
61+
The configuration file `service/src/main/resources/review-service.yaml` contain the necessary configuration to get the M2M token. The dummy values should be replaced with real ones
7962

8063
```
81-
export AUTH_DOMAIN=...
82-
export IP=...
83-
export OLTP_USER=...
84-
export OLTP_PW=...
85-
export OLTP_URL=...
86-
export DW_USER=...
87-
export DW_PW=...
88-
export DW_URL=...
89-
```
90-
91-
### Working credentials for local deployment
92-
93-
```
94-
export IP=0.0.0.0
95-
export OLTP_USER=informix
96-
export OLTP_PW=1nf0rm1x
97-
export OLTP_URL=jdbc:informix-sqli://$IP:2021/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1
98-
export DW_USER=informix
99-
export DW_PW=1nf0rm1x
100-
export DW_URL=jdbc:informix-sqli://$IP:2021/common_dw:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1
101-
export TC_JWT_KEY=secret
102-
```
103-
104-
### Set up Local Maven repository for Appirio Maven
105-
106-
- Since maven.appirio.net is not accessible, We need to set up a local maven repository with the zip file `temp-maven-repo-master.zip`
107-
108-
- Unzip the contents to any of the directory in your System. **In Linux, the directory should not be a mounted directory like pen drive, hard disk, etc..**
109-
110-
- Open `pom.xml` in `service` directory and replace the `<url>` of Local repository with `absolute path of the unzipped file`. E.g. If you have unzipped the files to `/home/user/temp-maven-repo-master`, then POM entry will look like
111-
112-
```
113-
<repository>
114-
<id>1_temp_appirio_maven_repo</id>
115-
<name>Appirio Maven Local Repository</name>
116-
<url>file:///home/user/temp-maven-repo-master</url>
117-
</repository>
64+
m2mAuthConfig:
65+
clientId: "${M2M_AUTH_CLIENT_ID:-dummy}"
66+
clientSecret: "${M2M_AUTH_CLIENT_SECRET:-dummy}"
67+
audience: "${M2M_AUTH_AUDIENCE:-dummy}"
68+
m2mAuthDomain: "${M2M_AUTH_DOMAIN:-topcoder-dev.auth0.com}"
69+
tokenExpireTimeInMinutes: "${M2M_AUTH_TOKEN_EXPIRE_TIME_IN_MINS:-60}"
70+
auth0ProxyServerUrl: "${M2M_AUTH_PROXY_SEREVR_URL:-dummy}"
11871
```
11972

12073
### Build Microservice
12174

12275
In the `service` folder of this project, run the following command to build the service.
12376

12477
```
125-
mvn clean package
78+
mvn clean package -DskipTests
12679
```
12780

12881
### Start Microservice
129-
130-
- Before starting please ensure that all environment variables listed above is set properly and docker is up and running.
131-
132-
- Then start the service using the following command in the 'service' folder:
133-
82+
Enter the local directory and run run.sh
13483
```
135-
java -jar ./target/review-microservice-*.jar server ./src/main/resources/review-service.yaml
84+
cd local
85+
./run.sh
13686
```
13787

13888
### Verification
13989

140-
Though there are many endpoints, For starters, it's sufficient to verify two end points.
141-
142-
- Endpoint `/v3/scorecards` doesn't require Authentication
143-
144-
- Endpoint `/v3/reviews` require Authentication
145-
146-
Use the postman collection in `Postman` directory to verify the end points.
147-
148-
- **Ensure to import the postman environment before testing the endpoints**
149-
150-
- Request `Get list of all Scorecards` returns all scorecard templates present in the database
151-
152-
**Loaded test data has details for 3 submissions for a single competition reviewed by 2 reviewers**
153-
154-
- Request `Get list of all reviews Reviewer1` return the reviews done by Reviewer 1.
90+
Import postman/review-microservice.postman_collection.json and postman/review-microservice.postman_environment.json, verify each endpoint.
15591

156-
- Request `Get list of all reviews Reviewer2` return the reviews done by Reviewer 2.
92+
- **Ensure to select the postman environment before testing the endpoints**
15793

158-
**Note: Some of the fields in returned output will be NULL, It's expected. That's how the internal controllers and services are written**

local/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ export DW_URL=jdbc:informix-sqli://$IP:2021/common_dw:INFORMIXSERVER=informixolt
88
export TC_JWT_KEY=secret
99
export GROUP_SERVICE_ENDPOINT="http://$IP:8080/v3/groups?memberId=%s&membershipType=User-Group"
1010
export PARENT_GROUP_SERVICE_ENDPOINT="http://$IP:8080/v3/groups/%s/getParentGroup?oneLevel=false"
11+
export ZOOKEEPER_HOSTS_LIST=$IP
1112

1213
java -jar ../service/target/review-microservice-*.jar server ../service/src/main/resources/review-service.yaml

0 commit comments

Comments
 (0)