diff --git a/README.md b/README.md
index 8f7bd8f6..cdb30859 100644
--- a/README.md
+++ b/README.md
@@ -36,15 +36,39 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
npm install
```
+2. Local config
+
+ 1. In the `tc-project-service` root directory create `.env` file with the environment variables _(values should be shared with you on the forum)_:
+ ```
+ AUTH0_CLIENT_ID=...
+ AUTH0_CLIENT_SECRET=...
+ AUTH0_URL=...
+ AUTH0_AUDIENCE=...
+ AUTH0_PROXY_SERVER_URL=...
+ ```
+ Values from this file would be automatically used by `docker-compose` and command `npm run start:dev` below.
+
+ 2. Copy config file `config/m2m.local.js` into `config/local.js`:
+ ```bash
+ cp config/m2m.local.js config/local.js
+ ```
+
+ 3. Set `dockerhost` to point the IP address of Docker. Docker IP address depends on your system. For example if docker is run on IP `127.0.0.1` add a the next line to your `/etc/hosts` file:
+ ```
+ 127.0.0.1 dockerhost
+ ```
+
+ Alternatively, you may update `config/local.js` and replace `dockerhost` with your docker IP address.
+
3. Start **ONE** of the docker-compose files with dependant services which are required for Project Service to work
1. **Minimal** `./local/docker-compose.yml`:
*Use this docker-compose if you only want to test and modify code of Project Service and you don't need Elasticsearch (ES) to work.*
- Run, inside folder `./local`:
+ Run, in the project root folder:
```bash
- docker-compose up
+ docker-compose -f local/docker-compose.yml up
```
Click to see details
@@ -64,17 +88,16 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
*Use this docker-compose if you want to test and modify code of Project Service together with one of the next relative services: [tc-bus-api](https://github.com/topcoder-platform/tc-bus-api), [project-processor-es](https://github.com/topcoder-platform/project-processor-es), [tc-notifications](https://github.com/topcoder-platform/tc-notifications) or you need Elasticsearch (ES) to work.*
- 1. Set environment variables `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, `AUTH0_URL`, `AUTH0_AUDIENCE`, `AUTH0_PROXY_SERVER_URL`
- 2. Run, inside folder `./local/full`
+ 1. Run, in the project root folder:
```bash
- docker-compose up -d
+ docker-compose -f local/full/docker-compose.yml up -d
```
- 3. Wait until all containers are fully started. As a good indicator, wait until `project-processor-es` successfully started by viewing its logs:
+ 2. Wait until all containers are fully started. As a good indicator, wait until `project-processor-es` successfully started by viewing its logs:
```bash
- docker-compose logs -f project-processor-es
+ docker-compose -f local/full/docker-compose.yml logs -f project-processor-es
```
Click to see example logs
@@ -95,7 +118,7 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
```
- 4. If you want to modify the code of any of the services which are run inside this docker-compose file, you can stop such service inside docker-compose by command `docker-compose stop -f ` and run the service separately, following its README file.
+ 3. If you want to modify the code of any of the services which are run inside this docker-compose file, you can stop such service inside docker-compose by command `docker-compose -f local/full/docker-compose.yml stop -f ` and run the service separately, following its README file.
Click to see details
@@ -121,56 +144,37 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
- To view the logs from any container inside docker-compose use the following command, replacing `SERVICE_NAME` with the corresponding value under the **Name** column in the above table:
```bash
- cd local/full
- docker-compose logs -f SERVICE_NAME
+ docker-compose -f local/full/docker-compose.yml logs -f SERVICE_NAME
```
*NOTE: In production these dependencies / services are hosted & managed outside Project Service.*
-4. Local config
-
- 1. Copy config file `config/m2m.local.js` into `config/local.js`:
- ```bash
- cp config/m2m.local.js config/local.js
- ```
-
- 2. Set `dockerhost` to point the IP address of Docker. Docker IP address depends on your system. For example if docker is run on IP `127.0.0.1` add a the next line to your `/etc/hosts` file:
- ```
- 127.0.0.1 dockerhost
- ```
-
- Alternatively, you may update `config/local.js` and replace `dockerhost` with your docker IP address.
-
-5. Create tables in DB
+4. Create tables in DB
```bash
NODE_ENV=development npm run sync:db
```
*NOTE: this will drop tables if they already exist.*
-6. Create ES (Elasticsearch) indexes
+5. Create ES (Elasticsearch) indexes
```bash
NODE_ENV=development npm run sync:es
```
*NOTE: This will first clear all the indices and than recreate them. So use with caution.*
-7. Start Project Service
-
- 1. Set environment variables `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, `AUTH0_URL`, `AUTH0_AUDIENCE`, `AUTH0_PROXY_SERVER_URL`
+6. Start Project Service
- 2. Run
-
- ```bash
- npm run start:dev
- ```
+ ```bash
+ npm run start:dev
+ ```
- Runs the Project Service using nodemon, so it would be restarted after any of the files is updated.
- The project service will be served on `http://localhost:8001`.
+ Runs the Project Service using nodemon, so it would be restarted after any of the files is updated.
+ The project service will be served on `http://localhost:8001`.
-8. *(Optional)* Start Project Service Kafka Consumer
+7. *(Optional)* Start Project Service Kafka Consumer
*Run this only if you want to test or modify logic of `lastActivityAt` or `lastActivityBy`.*
@@ -275,5 +279,4 @@ docker exec -it tc-projects-kafka /opt/kafka/bin/kafka-console-producer.sh --bro
## References
-- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
-- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
+- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index f90da34c..3e1c15e0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2720,6 +2720,11 @@
"is-obj": "^1.0.0"
}
},
+ "dotenv": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
+ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
+ },
"dottie": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz",
diff --git a/package.json b/package.json
index ecc9551c..b92d120a 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
"migrate:bookmarks:revert": "./node_modules/.bin/babel-node migrations/bookmarks/migrateLinksToBookmarks.js",
"prestart": "npm run -s build",
"start": "node dist",
- "start:dev": "NODE_ENV=development PORT=8001 nodemon -w src --exec \"babel-node src --presets es2015\" | ./node_modules/.bin/bunyan",
+ "start:dev": "NODE_ENV=development PORT=8001 nodemon -w src --exec \"node --require dotenv/config --require babel-core/register src\" | ./node_modules/.bin/bunyan",
"startKafkaConsumers": "npm run -s build && node dist/index-kafka.js",
"startKafkaConsumers:dev": "NODE_ENV=development nodemon -w src --exec \"babel-node src/index-kafka.js --presets es2015\" | ./node_modules/.bin/bunyan",
"test": "NODE_ENV=test npm run lint && NODE_ENV=test npm run sync:es && NODE_ENV=test npm run sync:db && NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- --timeout 10000 --require babel-core/register $(find src -path '*spec.js*') --exit",
@@ -51,6 +51,7 @@
"config": "^1.20.1",
"continuation-local-storage": "^3.1.7",
"cors": "^2.8.4",
+ "dotenv": "^8.2.0",
"elasticsearch": "^16.1.1",
"express": "^4.13.4",
"express-list-routes": "^0.1.4",