Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2f14cc7

Browse files
Merge pull request #20 from topcoder-platform/develop
Sync master with develop
2 parents dd203f4 + 55c8582 commit 2f14cc7

File tree

15 files changed

+305
-111
lines changed

15 files changed

+305
-111
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ The following parameters can be set in config files or in env variables:
2727
- GROUPS_MEMBER_ADD_TOPIC: the add groups member Kafka message topic, default value is 'groups.notification.member.add'
2828
- GROUPS_MEMBER_DELETE_TOPIC: the delete groups member Kafka message topic, default value is 'groups.notification.member.delete'
2929
- GROUPS_MEMBERSHIP_TYPE: the groups membership type that should be processed, default value is 'user'
30-
- ES.HOST: Elasticsearch host, default value is 'localhost:9200'
30+
- ES_HOST: Elasticsearch host, default value is 'localhost:9200'
3131
- ES.AWS_REGION: The Amazon region to use when using AWS Elasticsearch service, default value is 'us-east-1'
32-
- ES.API_VERSION: Elasticsearch API version, default value is '7.4'
3332
- ES.ACHIEVEMENT_PROVIDER_INDEX: Elasticsearch index name for achievement provider, default value is 'achievement_provider'
3433
- ES.ACHIEVEMENT_PROVIDER_TYPE: Elasticsearch index type for achievement provider, default value is '_doc'
3534
- ES.ATTRIBUTE_INDEX: Elasticsearch index name for attribute, default value is 'attribute'
@@ -53,6 +52,18 @@ The following parameters can be set in config files or in env variables:
5352
- ES.USER_SKILL_PROPERTY_NAME: the user property name of skill, default value is 'skills'
5453
- ES.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: the org property name of org skill providers, default value is 'skillProviders'
5554
- ES.USER_GROUP_PROPERTY_NAME: the user property name of group, default value is 'groups'
55+
- ATTRIBUTE_GROUP_PIPELINE_ID: The pipeline id for enrichment with attribute group. Default is `attributegroup-pipeline`
56+
- SKILL_PROVIDER_PIPELINE_ID: The pipeline id for enrichment with skill provider. Default is `skillprovider-pipeline`
57+
- USER_PIPELINE_ID: The pipeline id for enrichment of user details. Default is `user-pipeline`
58+
- ATTRIBUTE_GROUP_ENRICH_POLICYNAME: The enrich policy for attribute group. Default is `attributegroup-policy`
59+
- SKILL_PROVIDER_ENRICH_POLICYNAME: The enrich policy for skill provider. Default is `skillprovider-policy`
60+
- ROLE_ENRICH_POLICYNAME: The enrich policy for role. Default is `role-policy`
61+
- ACHIEVEMENT_PROVIDER_ENRICH_POLICYNAME: The enrich policy for achievement provider. Default is `achievementprovider-policy`
62+
- SKILL_ENRICH_POLICYNAME: The enrich policy for skill. Default is `skill-policy`
63+
- ATTRIBUTE_ENRICH_POLICYNAME: The enrich policy for skill. Default is `attribute-policy`
64+
- ELASTICCLOUD_ID: The elastic cloud id, if your elasticsearch instance is hosted on elastic cloud. DO NOT provide a value for ES_HOST if you are using this
65+
- ELASTICCLOUD_USERNAME: The elastic cloud username for basic authentication. Provide this only if your elasticsearch instance is hosted on elastic cloud
66+
- ELASTICCLOUD_PASSWORD: The elastic cloud password for basic authentication. Provide this only if your elasticsearch instance is hosted on elastic cloud
5667

5768
There is a `/health` endpoint that checks for the health of the app. This sets up an expressjs server and listens on the environment variable `PORT`. It's not part of the configuration file and needs to be passed as an environment variable
5869

@@ -103,15 +114,10 @@ Configuration for the tests is at `config/test.js`, only add such new configurat
103114
```
104115

105116
4. Initialize Elasticsearch index
117+
For this, refer to the [Ubahn API](https://github.com/topcoder-platform/u-bahn-api) repository. In this repository, you need to execute the following script (after following their deployment guide):
106118

107119
```bash
108-
npm run init-es
109-
```
110-
111-
To delete and re-create the index:
112-
113-
```bash
114-
npm run init-es force
120+
npm run insert-data
115121
```
116122

117123
5. Start the processor and health check dropin

config/default.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ module.exports = {
2323
GROUPS_MEMBERSHIP_TYPE: process.env.GROUPS_MEMBERSHIP_TYPE || 'user',
2424

2525
ES: {
26-
HOST: process.env.ES_HOST || 'localhost:9200',
26+
HOST: process.env.ES_HOST || 'http://localhost:9200',
27+
28+
ELASTICCLOUD: {
29+
id: process.env.ELASTICCLOUD_ID,
30+
username: process.env.ELASTICCLOUD_USERNAME,
31+
password: process.env.ELASTICCLOUD_PASSWORD
32+
},
33+
2734
AWS_REGION: process.env.AWS_REGION || 'us-east-1', // AWS Region to be used if we use AWS ES
28-
API_VERSION: process.env.ES_API_VERSION || '7.4',
2935
ACHIEVEMENT_PROVIDER_INDEX: process.env.ACHIEVEMENT_PROVIDER_INDEX || 'achievement_provider',
3036
ACHIEVEMENT_PROVIDER_TYPE: process.env.ACHIEVEMENT_PROVIDER_TYPE || '_doc',
3137
ATTRIBUTE_INDEX: process.env.ATTRIBUTE_INDEX || 'attribute',
@@ -50,6 +56,35 @@ module.exports = {
5056
USER_SKILL_PROPERTY_NAME: process.env.USER_SKILL_PROPERTY_NAME || 'skills',
5157
USER_GROUP_PROPERTY_NAME: process.env.USER_GROUP_PROPERTY_NAME || 'groups',
5258

53-
ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: process.env.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME || 'skillProviders'
59+
ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: process.env.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME || 'skillProviders',
60+
61+
ENRICHMENT: {
62+
attributegroup: {
63+
enrichPolicyName: process.env.ATTRIBUTE_GROUP_ENRICH_POLICYNAME || 'attributegroup-policy',
64+
pipelineId: process.env.ATTRIBUTE_GROUP_PIPELINE_ID || 'attributegroup-pipeline'
65+
},
66+
skillprovider: {
67+
enrichPolicyName: process.env.SKILL_PROVIDER_ENRICH_POLICYNAME || 'skillprovider-policy',
68+
pipelineId: process.env.SKILL_PROVIDER_PIPELINE_ID || 'skillprovider-pipeline'
69+
},
70+
user: {
71+
pipelineId: process.env.USER_PIPELINE_ID || 'user-pipeline'
72+
},
73+
role: {
74+
enrichPolicyName: process.env.ROLE_ENRICH_POLICYNAME || 'role-policy'
75+
},
76+
achievementprovider: {
77+
enrichPolicyName: process.env.ACHIEVEMENT_PROVIDER_ENRICH_POLICYNAME || 'achievementprovider-policy'
78+
},
79+
skill: {
80+
enrichPolicyName: process.env.SKILL_ENRICH_POLICYNAME || 'skill-policy'
81+
},
82+
attribute: {
83+
enrichPolicyName: process.env.ATTRIBUTE_ENRICH_POLICYNAME || 'attribute-policy'
84+
},
85+
organization: {
86+
enrichPolicyName: process.env.ORGANIZATION_ENRICH_POLICYNAME || 'organization-policy'
87+
}
88+
}
5489
}
5590
}

docker-kafka-es/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
KAFKA_CREATE_TOPICS: "u-bahn.action.aggregate:1:1,groups.notification.member.add:1:1,groups.notification.member.delete:1:1"
1616
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
1717
esearch:
18-
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
18+
image: elasticsearch:7.7.1
1919
container_name: ubahn-data-processor-es_es
2020
ports:
2121
- "9200:9200"

package-lock.json

Lines changed: 52 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
"superagent": "^5.1.0"
2727
},
2828
"dependencies": {
29+
"@elastic/elasticsearch": "^7.9.1",
2930
"@hapi/joi": "^15.1.0",
3031
"async-mutex": "^0.2.4",
3132
"aws-sdk": "^2.476.0",
3233
"bluebird": "^3.5.5",
3334
"config": "^3.1.0",
34-
"elasticsearch": "^16.7.1",
3535
"get-parameter-names": "^0.3.0",
36-
"http-aws-es": "^6.0.0",
3736
"lodash": "^4.17.19",
3837
"no-kafka": "^3.4.3",
3938
"topcoder-healthcheck-dropin": "^1.0.3",

0 commit comments

Comments
 (0)