|
| 1 | +# Identity - Data Processor |
| 2 | + |
| 3 | +## Dependencies |
| 4 | + |
| 5 | +- Nodejs(v12+) |
| 6 | +- Kafka |
| 7 | + |
| 8 | +## Configuration |
| 9 | + |
| 10 | +Configuration for the identity processor is at `config/default.js`. |
| 11 | +The following parameters can be set in config files or in env variables: |
| 12 | + |
| 13 | +- LOG_LEVEL: the log level; default value: 'debug' |
| 14 | +- KAFKA_URL: comma separated Kafka hosts; default value: 'localhost:9092' |
| 15 | +- KAFKA_CLIENT_CERT: Kafka connection certificate, optional; default value is undefined; |
| 16 | + if not provided, then SSL connection is not used, direct insecure connection is used; |
| 17 | + if provided, it can be either path to certificate file or certificate content |
| 18 | +- KAFKA_CLIENT_CERT_KEY: Kafka connection private key, optional; default value is undefined; |
| 19 | + if not provided, then SSL connection is not used, direct insecure connection is used; |
| 20 | + if provided, it can be either path to private key file or private key content |
| 21 | +- KAFKA_GROUP_ID: the Kafka group id, default value is 'identity-processor' |
| 22 | +- IDENTITY_NOTIFICATION_CREATE: the identity create entity Kafka message topic, default value is 'identity.notification.create' |
| 23 | +- AUTH0_URL: The auth0 url |
| 24 | +- AUTH0_UBAHN_AUDIENCE: The auth0 audience for accessing ubahn api(s) |
| 25 | +- AUTH0_TOPCODER_AUDIENCE: The auth0 audience for accessing topcoder api(s) |
| 26 | +- AUTH0_CLIENT_ID: The auth0 client id |
| 27 | +- AUTH0_CLIENT_SECRET: The auth0 client secret |
| 28 | +- AUTH0_PROXY_SERVER_URL: The auth0 proxy server url |
| 29 | +- TOKEN_CACHE_TIME: The token cache time |
| 30 | +- SLEEP_TIME: The pause time between two create operations, default value: 1000 ms |
| 31 | +- UBAHN_API_URL: The ubahn api url, default value: 'https://api.topcoder-dev.com/v5' |
| 32 | +- MEMBERS_API_URL: The topcoder member api url, default value: 'https://api.topcoder-dev.com/v5/members' |
| 33 | +- ATTRIBUTE_GROUP_NAME: The attribute group name |
| 34 | +- SKILL_PROVIDER_NAME: The skill provider name |
| 35 | +- ORGANIZATION_NAME: The organization name |
| 36 | + |
| 37 | +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 |
| 38 | + |
| 39 | +## Local Kafka setup |
| 40 | + |
| 41 | +1. Navigate to the directory `docker-kafka` |
| 42 | + |
| 43 | +2. Run the following command |
| 44 | + |
| 45 | + ```bash |
| 46 | + docker-compose up -d |
| 47 | + ``` |
| 48 | + |
| 49 | +## Local deployment |
| 50 | + |
| 51 | +1. Make sure that Kafka is running as per instructions above. |
| 52 | + |
| 53 | +2. From the project root directory, run the following command to install the dependencies |
| 54 | + |
| 55 | + ```bash |
| 56 | + npm install |
| 57 | + ``` |
| 58 | + |
| 59 | +3. To run linters if required |
| 60 | + |
| 61 | + ```bash |
| 62 | + npm run lint |
| 63 | + ``` |
| 64 | + |
| 65 | + To fix possible lint errors: |
| 66 | + |
| 67 | + ```bash |
| 68 | + npm run lint:fix |
| 69 | + ``` |
| 70 | + |
| 71 | +5. Start the processor and health check dropin |
| 72 | + |
| 73 | + ```bash |
| 74 | + npm start |
| 75 | + ``` |
| 76 | + |
| 77 | +## Local Deployment with Docker |
| 78 | + |
| 79 | +To run the Processor using docker, follow the below steps |
| 80 | + |
| 81 | +1. Navigate to the directory `docker` |
| 82 | + |
| 83 | +2. Rename the file `sample.api.env` to `api.env` |
| 84 | + |
| 85 | +3. Once that is done, run the following command |
| 86 | + |
| 87 | + ```bash |
| 88 | + docker-compose up |
| 89 | + ``` |
| 90 | + |
| 91 | +4. When you are running the application for the first time, It will take some time initially to download the image and install the dependencies |
| 92 | + |
| 93 | + |
| 94 | +## Verification |
| 95 | + |
| 96 | +see [VERIFICATION.md](VERIFICATION.md) |
0 commit comments