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
This docker-compose run all the dependencies which are necessary for `project-processor-es` to work.
28
+
29
+
| Service | Name | Port |
30
+
|----------|:-----:|:----:|
31
+
| Elasticsearch | esearch | 9200 |
32
+
| Zookeeper | zookeeper | 2181 |
33
+
| Kafka | kafka | 9092 |
34
+
35
+
`docker-compose` automatically creates Kafka topics which are used by `project-processor-es` listed in `local/kafka-client/topics.txt`.
36
+
37
+
</details>
38
+
39
+
40
+
3. Set environment variables for M2M authentication: `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, `AUTH0_URL`, `AUTH0_AUDIENCE`, `AUTH0_PROXY_SERVER_URL`:
41
+
42
+
```bash
43
+
export AUTH0_CLIENT_ID=<insert required value here>
44
+
export AUTH0_CLIENT_SECRET=<insert required value here>
45
+
export AUTH0_URL=<insert required value here>
46
+
export AUTH0_AUDIENCE=<insert required value here>
47
+
export AUTH0_PROXY_SERVER_URL=<insert required value here>
48
+
```
49
+
50
+
4. Initialize Elasticsearch indexes:
51
+
52
+
```bash
53
+
npm run sync:es
54
+
```
55
+
56
+
5. Start processor app:
57
+
58
+
```bash
59
+
npm start
60
+
```
61
+
62
+
## Commands
63
+
64
+
### Lint & Tests commands
65
+
66
+
| Command | Description |
67
+
|----------|--------------|
68
+
|`npm run lint`| Run lint check. |
69
+
|`npm run lin:fix`| Run lint check with automatic fixing of errors and warnings where possible. |
70
+
|`npm run test`| Run integration tests. |
71
+
|`npm run test:cov`| Run integration tests with coverage report. |
72
+
73
+
### View data in Elasticsearch indexes
74
+
75
+
You may run the next command to output documents in the Elasticsearch indexes for debugging purposes.
76
+
77
+
```bash
78
+
npm run view-data <INDEX_NAME><DOCUMENT_ID>
79
+
```
80
+
81
+
##### Examples
82
+
83
+
-`npm run view-data projects 1` view document with id `1` in `projects` index
84
+
-`npm run view-data timelines 1` view document with id `1` in `timelines` index
85
+
-`npm run view-data metadata 1` view document with id `1` in `timelines` index *(this index has only one document and all the data is stored inside one document which might be very big)*.
86
+
87
+
### Kafka commands
88
+
89
+
If you've used `docker-compose` with the file `local/docker-compose.yml` during local setup to spawn kafka & zookeeper, you can use the following commands to manipulate kafka topics and messages:
90
+
(Replace `TOPIC_NAME` with the name of the desired topic)
Configuration for the processor is at `config/default.js`.
@@ -40,40 +156,6 @@ Also note that there is a `/health` endpoint that checks for the health of the a
40
156
41
157
Config for tests are at `config/test.js`, it overrides some default config.
42
158
43
-
44
-
### Local Deployment for Kafka
45
-
46
-
* There exists an alternate `docker-compose.yml` file that can be used to spawn containers for the following services:
47
-
48
-
| Service | Name | Port |
49
-
|----------|:-----:|:----:|
50
-
| ElasticSearch | esearch | 9200 |
51
-
| Zookeeper | zookeeper | 2181 |
52
-
| Kafka | kafka | 9092 |
53
-
54
-
* To have kafka create a list of desired topics on startup, there exists a file with the path `local/kafka-client/topics.txt`. Each line from the file will be added as a topic.
55
-
* To run these services simply run the following commands:
56
-
57
-
```bash
58
-
cdlocal
59
-
docker-compose up -d
60
-
```
61
-
62
-
## Local deployment
63
-
- Install dependencies `npm i`
64
-
- Run code lint check `npm run lint`, running `npm run lint:fix` can fix some lint errors if any
65
-
- Initialize Elasticsearch, create configured Elasticsearch index if not present: `npm run sync:es`
66
-
- Start processor app `npm start`
67
-
68
-
Note that you need to set AUTH0 related environment variables belows before you can start the processor.
69
-
70
-
- AUTH0_URL
71
-
- AUTH0_AUDIENCE
72
-
- TOKEN_CACHE_TIME
73
-
- AUTH0_CLIENT_ID
74
-
- AUTH0_CLIENT_SECRET
75
-
- AUTH0_PROXY_SERVER_URL
76
-
77
159
## Local Deployment with Docker
78
160
79
161
To run the Challenge ES Processor using docker, follow the below steps
- To test the health check API, run `export PORT=5000`, start the processor, then browse `http://localhost:5000/health` in a browser,
256
338
and you will see result `{"checksRun":1}`
257
-
258
-
259
-
260
-
### Kafka Commands
261
-
262
-
If you've used `docker-compose` with the file `local/docker-compose.yml` to spawn kafka & zookeeper, you can use the following commands to manipulate kafka topics and messages:
263
-
(Replace TOPIC_NAME with the name of the desired topic)
0 commit comments