Skip to content

Commit 4b908e0

Browse files
committed
routing nginx 💎
1 parent 69ff030 commit 4b908e0

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $ docker-compose up -d
2828

2929
The Swagger UI is an open source project to visually render documentation for an API defined with the OpenAPI (Swagger) Specification
3030

31-
- http://localhost:8081
31+
- http://localhost:8080/swagger
3232

3333
### Grafana:
3434

@@ -50,11 +50,11 @@ Rpc failed with status code 5, error message: verification not found
5050

5151
It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC
5252

53-
- http://localhost:8080
53+
- http://localhost:8080/api'
5454

5555
```sh
5656
[I] ➜ curl -s -X 'POST' \
57-
'http://localhost:8080/v1/verifications' \
57+
'http://localhost:8080/api/v1/verifications'' \
5858
-H 'accept: application/json' \
5959
-H 'Content-Type: application/json' \
6060
-d '{

docker-compose.yaml

+17-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ services:
2020
- postgres
2121
- kafka
2222
ports:
23-
- 8080:8080 # REST
2423
- 8082:8082 # gRPC
2524
- 9100:9100 # Metrics prometheus
2625
- 8000:8000 # Status prometheus
@@ -119,13 +118,12 @@ services:
119118

120119
swagger-ui:
121120
image: swaggerapi/swagger-ui
122-
ports:
123-
- 8081:8080
124121
restart: always
125122
volumes:
126123
- ./swagger:/swagger
127124
environment:
128125
SWAGGER_JSON: /swagger/ozonmp/srv_verification_api/v1/srv_verification_api.swagger.json
126+
BASE_URL: /swagger
129127
depends_on:
130128
- srv-verification-api
131129
networks:
@@ -235,6 +233,22 @@ services:
235233
- 12201:12201/udp
236234
restart: always
237235

236+
nginx:
237+
image: nginx:latest
238+
depends_on:
239+
- srv-verification-api
240+
- swagger-ui
241+
links:
242+
- srv-verification-api
243+
- swagger-ui
244+
restart: always
245+
networks:
246+
- srvnw
247+
ports:
248+
- 8080:80
249+
volumes:
250+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
251+
238252
volumes:
239253
pgdata:
240254
driver: local

nginx.conf

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
server {
2+
server_name localhost;
3+
listen 80;
4+
listen [::]:80;
5+
6+
location /swagger {
7+
proxy_pass http://swagger-ui:8080;
8+
}
9+
10+
location /api {
11+
proxy_pass http://srv-verification-api:8080;
12+
}
13+
}

0 commit comments

Comments
 (0)