Prosty sequential proxy
This commit is contained in:
parent
5e23a97b1a
commit
6655736a69
4
api-mocks/projects/1.json
Normal file
4
api-mocks/projects/1.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"owner": 1,
|
||||
"name": "Simple project"
|
||||
}
|
4
api-mocks/users/1.json
Normal file
4
api-mocks/users/1.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"id": 1,
|
||||
"username": "test"
|
||||
}
|
4
api-mocks/users/2.json
Normal file
4
api-mocks/users/2.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"id": 2,
|
||||
"username": "test2"
|
||||
}
|
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
||||
version: "3.8"
|
||||
services:
|
||||
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:latest
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "14268:14268"
|
||||
|
||||
api:
|
||||
image: paramah/lwan
|
||||
volumes:
|
||||
- ./api-mocks:/opt/lwan/wwwroot
|
||||
ports:
|
||||
- "8000:8080"
|
||||
|
||||
kraken:
|
||||
image: devopsfaith/krakend:config-watcher
|
||||
volumes:
|
||||
- ./krakend:/etc/krakend
|
||||
ports:
|
||||
- "1234:1234"
|
||||
- "8080:8080"
|
||||
- "8091:8091"
|
||||
depends_on:
|
||||
- api
|
||||
- jaeger
|
||||
|
78
krakend/krakend.json
Normal file
78
krakend/krakend.json
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"version": 2,
|
||||
"timeout": "3000ms",
|
||||
"cache_ttl": "300s",
|
||||
"host": [
|
||||
"http://api:8080"
|
||||
],
|
||||
"extra_config": {
|
||||
"github_com/devopsfaith/krakend-metrics": {
|
||||
"listen_address": ":8091"
|
||||
},
|
||||
"github_com/devopsfaith/krakend-gologging": {
|
||||
"level": "DEBUG",
|
||||
"prefix": "[KRAKEND]",
|
||||
"syslog": false,
|
||||
"stdout": true
|
||||
},
|
||||
"github_com/devopsfaith/krakend-opencensus": {
|
||||
"sample_rate": 100,
|
||||
"reporting_period": 1,
|
||||
"exporters": {
|
||||
"jaeger": {
|
||||
"endpoint": "http://jaeger:14268",
|
||||
"service_name": "krakend"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com/devopsfaith/krakend-cors": {
|
||||
"allow_origins": [
|
||||
"http://localhost:8000"
|
||||
],
|
||||
"allow_methods": [
|
||||
"POST",
|
||||
"GET"
|
||||
],
|
||||
"allow_headers": [
|
||||
"Origin",
|
||||
"Authorization",
|
||||
"Content-Type"
|
||||
],
|
||||
"expose_headers": [
|
||||
"Content-Length"
|
||||
],
|
||||
"max_age": "12h"
|
||||
}
|
||||
},
|
||||
"endpoints":[
|
||||
{
|
||||
"endpoint": "/sequential/{id}",
|
||||
"backend": [
|
||||
{
|
||||
"url_pattern": "/users/{id}.json",
|
||||
"whitelist": [
|
||||
"id",
|
||||
"username"
|
||||
],
|
||||
"extra_config": {},
|
||||
"encoding": "json",
|
||||
"blacklist": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"url_pattern": "/projects/{resp0_id}.json",
|
||||
"whitelist": [
|
||||
"name"
|
||||
],
|
||||
"group": "projects"
|
||||
}
|
||||
],
|
||||
"extra_config": {
|
||||
"github.com/devopsfaith/krakend/proxy": {
|
||||
"sequential": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user