Skip to content

Commit 03acbca

Browse files
author
Maksym Mykhailenko
committed
Merge branch 'develop' into feature/export-import
2 parents bfec5ad + f50e54f commit 03acbca

File tree

4 files changed

+112
-95
lines changed

4 files changed

+112
-95
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.16.1
1+
12

README.md

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
2828
### Requirements
2929

3030
* [docker-compose](https://docs.docker.com/compose/install/) - We use docker-compose for running dependencies locally.
31-
* Nodejs 12.16.1 - consider using [nvm](https://github.com/creationix/nvm) or equivalent to manage your node version
31+
* [Node.js](https://nodejs.org/) version 12 - consider using [nvm](https://github.com/creationix/nvm) or equivalent to manage your node version
3232
* Install [libpg](https://www.npmjs.com/package/pg-native)
3333

3434
### Steps to run locally
@@ -38,15 +38,39 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
3838
npm install
3939
```
4040

41+
2. Local config
42+
43+
1. In the `tc-project-service` root directory create `.env` file with the environment variables _(values should be shared with you on the forum)_:<br>
44+
```
45+
AUTH0_CLIENT_ID=...
46+
AUTH0_CLIENT_SECRET=...
47+
AUTH0_URL=...
48+
AUTH0_AUDIENCE=...
49+
AUTH0_PROXY_SERVER_URL=...
50+
```
51+
Values from this file would be automatically used by `docker-compose` and command `npm run start:dev` below.
52+
53+
2. Copy config file `config/m2m.local.js` into `config/local.js`:
54+
```bash
55+
cp config/m2m.local.js config/local.js
56+
```
57+
58+
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:
59+
```
60+
127.0.0.1 dockerhost
61+
```
62+
63+
Alternatively, you may update `config/local.js` and replace `dockerhost` with your docker IP address.
64+
4165
3. Start **ONE** of the docker-compose files with dependant services which are required for Project Service to work
4266
4367
1. **Minimal** `./local/docker-compose.yml`:
4468
4569
*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.*
4670
47-
Run, inside folder `./local`:
71+
Run, in the project root folder:
4872
```bash
49-
docker-compose up
73+
docker-compose -f local/docker-compose.yml up
5074
```
5175
5276
<details><summary>Click to see details</summary>
@@ -66,17 +90,16 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
6690
6791
*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.*
6892
69-
1. Set environment variables `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, `AUTH0_URL`, `AUTH0_AUDIENCE`, `AUTH0_PROXY_SERVER_URL`
70-
2. Run, inside folder `./local/full`
93+
1. Run, in the project root folder:
7194
7295
```bash
73-
docker-compose up -d
96+
docker-compose -f local/full/docker-compose.yml up -d
7497
```
7598
76-
3. Wait until all containers are fully started. As a good indicator, wait until `project-processor-es` successfully started by viewing its logs:
99+
2. Wait until all containers are fully started. As a good indicator, wait until `project-processor-es` successfully started by viewing its logs:
77100
78101
```bash
79-
docker-compose logs -f project-processor-es
102+
docker-compose -f local/full/docker-compose.yml logs -f project-processor-es
80103
```
81104
82105
<details><summary>Click to see example logs</summary>
@@ -97,7 +120,7 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
97120
```
98121
</details>
99122
100-
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 <SERVICE_NAME>` and run the service separately, following its README file.
123+
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 <SERVICE_NAME>` and run the service separately, following its README file.
101124
102125
<details><summary>Click to see details</summary>
103126
<br>
@@ -123,56 +146,37 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
123146
- 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:
124147
125148
```bash
126-
cd local/full
127-
docker-compose logs -f SERVICE_NAME
149+
docker-compose -f local/full/docker-compose.yml logs -f SERVICE_NAME
128150
```
129151
130152
</details>
131153
132154
*NOTE: In production these dependencies / services are hosted & managed outside Project Service.*
133155
134-
4. Local config
135-
136-
1. Copy config file `config/m2m.local.js` into `config/local.js`:
137-
```bash
138-
cp config/m2m.local.js config/local.js
139-
```
140-
141-
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:
142-
```
143-
127.0.0.1 dockerhost
144-
```
145-
146-
Alternatively, you may update `config/local.js` and replace `dockerhost` with your docker IP address.
147-
148-
5. Create tables in DB
156+
4. Create tables in DB
149157
```bash
150158
NODE_ENV=development npm run sync:db
151159
```
152160
153161
*NOTE: this will drop tables if they already exist.*
154162
155-
6. Create ES (Elasticsearch) indexes
163+
5. Create ES (Elasticsearch) indexes
156164
```bash
157165
NODE_ENV=development npm run sync:es
158166
```
159167
160168
*NOTE: This will first clear all the indices and than recreate them. So use with caution.*
161169
162-
7. Start Project Service
163-
164-
1. Set environment variables `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`, `AUTH0_URL`, `AUTH0_AUDIENCE`, `AUTH0_PROXY_SERVER_URL`
170+
6. Start Project Service
165171
166-
2. Run
167-
168-
```bash
169-
npm run start:dev
170-
```
172+
```bash
173+
npm run start:dev
174+
```
171175

172-
Runs the Project Service using nodemon, so it would be restarted after any of the files is updated.
173-
The project service will be served on `http://localhost:8001`.
176+
Runs the Project Service using nodemon, so it would be restarted after any of the files is updated.
177+
The project service will be served on `http://localhost:8001`.
174178

175-
8. *(Optional)* Start Project Service Kafka Consumer
179+
7. *(Optional)* Start Project Service Kafka Consumer
176180

177181
*Run this only if you want to test or modify logic of `lastActivityAt` or `lastActivityBy`.*
178182

@@ -304,5 +308,4 @@ docker exec -it tc-projects-kafka /opt/kafka/bin/kafka-console-producer.sh --bro
304308

305309
## References
306310

307-
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
308-
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
311+
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)

package-lock.json

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

0 commit comments

Comments
 (0)