Skip to content

Commit a910217

Browse files
committed
refactor: stop tracking db data volumne
1 parent b5c66ac commit a910217

File tree

8 files changed

+754
-0
lines changed

8 files changed

+754
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,6 @@ web_modules/
157157
.yarn/build-state.yml
158158
.yarn/install-state.gz
159159
.pnp.*
160+
161+
# ignore data volume
162+
gateways/apps/*/data

gateways/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Microservices Suite
2+
3+
## API-GATEWAY Package. Remember to provide redundancy to eliminate the `single point of failure`
4+
5+
The API-GATEWAY serves as the front-facing layer of our Microservices Suite, designed to efficiently route client requests to the appropriate internal service. By abstracting the internal services network from the client, it exposes a singular endpoint that consolidates and manages access to your suite of APIs.
6+
7+
### Key Features
8+
9+
- **Unified Endpoint**: Offers a single endpoint for all client-side applications to interact with, simplifying API consumption and integration.
10+
- **Request Routing**: Dynamically routes client requests to the appropriate microservice based on the request path, method, and other criteria.
11+
- **Response Aggregation**: Collects responses from various microservices and consolidates them into a single response for the client, facilitating smoother interaction patterns.
12+
- **Security and Abstraction**: Enhances security by hiding the internal structure of the microservices network from the clients.
13+
14+
## Getting Started
15+
16+
### Prerequisites
17+
18+
Before setting up the API-GATEWAY, ensure that you have the following:
19+
- A current version of Node.js installed (preferably version 12.x or newer).
20+
- Basic knowledge of how microservices architecture operates.
21+
- Access to the microservices that the gateway will route requests to.
22+
23+
### Installation
24+
25+
To install the API-GATEWAY, follow these steps:
26+
27+
<!-- TODO: document usage here -->
28+
29+
### Configuration
30+
31+
<!-- TODO: build on this -->
32+
Configure the gateway by setting up environment variables or editing a `.env` file in the root directory of the API-GATEWAY project. Key configurations include the gateway's port, microservices endpoints, and any security credentials like API keys.
33+
34+
### Running the Gateway
35+
36+
<!-- TODO: build on this but ideally is supposed to be run just like any other service in our ms-suite -->
37+
38+
39+
<!-- Handling client requests -->
40+
41+
<!-- Microfrontend client request -->
42+
43+
<!-- Monolithic client request -->
44+
45+
### Handling client requests
46+
47+
#### Microfrontend client
48+
- Microservices
49+
50+
#### Monolithic client
51+
- Monolith client apps which are the traditional frontend applications
52+
- They make requests to the server by making a http request to one `base_url/<endpoint>`
53+
- In microservices architecture they will make a call to this service(`the gateway`) which sits in front of all her services
54+
- On getting the request the `API-Gateway` then `decomposes` the request into different `api calls` that are routed internally to different services.
55+
- On completion the gateway aggregates/consolidates the response into one and returns back to the monolithic application
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
2+
version: '3.8'
3+
services:
4+
5+
cart:
6+
build:
7+
dockerfile: Dockerfile.dev
8+
context: ../../../microservices/cart
9+
ports:
10+
- "9010:9010"
11+
volumes:
12+
- /app/node_modules
13+
- ../../../microservices/cart:/app
14+
depends_on:
15+
rabbitmq:
16+
condition: service_healthy
17+
18+
user:
19+
build:
20+
dockerfile: Dockerfile.dev
21+
context: ../../../microservices/user
22+
ports:
23+
- "9011:9011"
24+
volumes:
25+
- /app/node_modules
26+
- ../../../microservices/user:/app
27+
depends_on:
28+
rabbitmq:
29+
condition: service_healthy
30+
31+
customer:
32+
build:
33+
dockerfile: Dockerfile.dev
34+
context: ../../../microservices/customer
35+
ports:
36+
- "9012:9012"
37+
volumes:
38+
- /app/node_modules
39+
- ../../../microservices/customer:/app
40+
depends_on:
41+
rabbitmq:
42+
condition: service_healthy
43+
44+
email:
45+
build:
46+
dockerfile: Dockerfile.dev
47+
context: ../../../microservices/email
48+
ports:
49+
- "9013:9013"
50+
volumes:
51+
- /app/node_modules
52+
- ../../../microservices/email:/app
53+
depends_on:
54+
rabbitmq:
55+
condition: service_healthy
56+
57+
notification:
58+
build:
59+
dockerfile: Dockerfile.dev
60+
context: ../../../microservices/notification
61+
ports:
62+
- "9014:9014"
63+
volumes:
64+
- /app/node_modules
65+
- ../../../microservices/notification:/app
66+
depends_on:
67+
rabbitmq:
68+
condition: service_healthy
69+
70+
payment:
71+
build:
72+
dockerfile: Dockerfile.dev
73+
context: ../../../microservices/payment
74+
ports:
75+
- "9015:9015"
76+
volumes:
77+
- /app/node_modules
78+
- ../../../microservices/payment:/app
79+
depends_on:
80+
rabbitmq:
81+
condition: service_healthy
82+
83+
product:
84+
build:
85+
dockerfile: Dockerfile.dev
86+
context: ../../../microservices/product
87+
ports:
88+
- "9016:9016"
89+
volumes:
90+
- /app/node_modules
91+
- ../../../microservices/product:/app
92+
depends_on:
93+
rabbitmq:
94+
condition: service_healthy
95+
96+
rbac:
97+
build:
98+
dockerfile: Dockerfile.dev
99+
context: ../../../microservices/rbac
100+
ports:
101+
- "9017:9017"
102+
volumes:
103+
- /app/node_modules
104+
- ../../../microservices/rbac:/app
105+
depends_on:
106+
rabbitmq:
107+
condition: service_healthy
108+
109+
supplier:
110+
build:
111+
dockerfile: Dockerfile.dev
112+
context: ../../../microservices/supplier
113+
ports:
114+
- "9018:9018"
115+
volumes:
116+
- /app/node_modules
117+
- ../../../microservices/supplier:/app
118+
depends_on:
119+
rabbitmq:
120+
condition: service_healthy
121+
122+
upload:
123+
build:
124+
dockerfile: Dockerfile.dev
125+
context: ../../../microservices/upload
126+
ports:
127+
- "9019:9019"
128+
volumes:
129+
- /app/node_modules
130+
- ../../../microservices/upload:/app
131+
depends_on:
132+
rabbitmq:
133+
condition: service_healthy
134+
135+
nginx:
136+
depends_on:
137+
- cart
138+
- user
139+
- customer
140+
- email
141+
- notification
142+
- payment
143+
- product
144+
- rbac
145+
- supplier
146+
- upload
147+
restart: always
148+
build:
149+
context: ./nginx
150+
dockerfile: Dockerfile.dev
151+
ports:
152+
- '4000:80'
153+
healthcheck:
154+
test: ["CMD-SHELL", "curl -f http://localhost:80/health || exit 1"]
155+
interval: 30s
156+
timeout: 10s
157+
retries: 3
158+
start_period: 40s
159+
rabbitmq:
160+
image: rabbitmq:3.13-management
161+
container_name: rabbitmq
162+
ports:
163+
- '5672:5672'
164+
- '15672:15672'
165+
healthcheck:
166+
test: ["CMD", "rabbitmq-diagnostics", "ping"]
167+
interval: 30s
168+
retries: 5
169+
mongodb:
170+
image: mongo
171+
ports:
172+
- '27017:27017'
173+
restart: always
174+
volumes:
175+
- type: bind
176+
source: ./data
177+
target: /data/db
178+
krakend:
179+
image: devopsfaith/krakend:2.7-watch
180+
ports:
181+
- '8080:8080'
182+
- '8090:8090'
183+
volumes:
184+
- ./krakend/:/etc/krakend/
185+
command: ['run','-d','-c','/etc/krakend/krakend.json']

0 commit comments

Comments
 (0)