Skip to content

Commit 232e4e4

Browse files
committed
fix dockerized krakends example
1 parent 2663df3 commit 232e4e4

File tree

16 files changed

+6588
-30
lines changed

16 files changed

+6588
-30
lines changed

example/Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ conf:
1111
cat ./docker_compose/conf.local/prometheus/prometheus.env_tmpl.yml | envsubst > ./docker_compose/conf.local/prometheus/prometheus.yml
1212

1313
docker_up:
14-
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml up -d
14+
cd ./docker_compose && docker-compose -p krakend_otel -f compose.yaml up -d
1515

1616
docker_down:
17+
cd ./docker_compose && docker-compose -p krakend_otel -f compose.yaml down --remove-orphans -v
18+
19+
docker_local_up:
20+
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml up -d
21+
22+
docker_local_down:
1723
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml down --remove-orphans -v
1824

19-
run: srv
25+
run_local_up: srv
2026
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml up -d
2127
./srv -c ./docker_compose/conf.local/krakend_front/configuration.json > log_frontend.log &
2228
./srv -c ./docker_compose/conf.local/krakend_middle/configuration.json > log_middle.log &
2329
./srv -c ./docker_compose/conf.local/krakend_back/configuration.json > log_back.log
2430

25-
run_srv: srv
31+
run_local: srv
2632
./srv -c ./docker_compose/conf.local/krakend_front/configuration.json > log_frontend.log &
2733
./srv -c ./docker_compose/conf.local/krakend_middle/configuration.json > log_middle.log &
2834
./srv -c ./docker_compose/conf.local/krakend_back/configuration.json > log_back.log

example/client/k6client/client.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const options = {
1414
// about authoring k6 scripts.
1515
//
1616
export default function() {
17-
let address = 'http://192.168.1.12:54444';
17+
// let address = 'http://192.168.1.12:54444';
18+
let address = 'http://192.168.1.12:44444';
1819
http.get(address + '/fake/fsf');
1920
http.get(address + '/combination/1');
2021
http.get(address + '/direct/slow');

example/docker_compose/compose.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ services:
6969
GF_AUT_ANONYMOUS_ENABLED: "true"
7070
volumes:
7171
- "vol_grafana:/var/lib/grafana"
72+
- "./conf/grafana/conf/provisioning/datasources:/etc/grafana/provisioning/datasources"
73+
- "./conf/grafana/conf/provisioning/dashboards:/etc/grafana/provisioning/dashboards"
74+
- "./conf/grafana/conf/data/dashboards:/var/lib/grafana/dashboards"
7275
depends_on:
7376
- prometheus
7477
- loki

example/docker_compose/conf.local/krakend_back/configuration.json

-15
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,6 @@
116116
"disable_metrics": true
117117
}
118118
]
119-
},
120-
"instance": {
121-
"metric_providers": [
122-
"local_prometheus"
123-
],
124-
"metric_reporting_period": 1,
125-
"trace_providers": [
126-
"local_tempo",
127-
"local_jaeger"
128-
],
129-
"trace_sample_rate": 1
130-
},
131-
"extra": {
132-
"custom": "extra",
133-
"future_expansion": true
134119
}
135120
}
136121
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
{
2+
"port": 9876,
3+
"host": "0.0.0.0",
4+
"endpoints": [
5+
{
6+
"method": "GET",
7+
"path_pattern": "/",
8+
"behaviour": [
9+
{
10+
"name": "slower",
11+
"config": {
12+
"max_bytes_per_second": 20,
13+
"flush_bytes": 2
14+
}
15+
},
16+
{
17+
"name": "status_distributor",
18+
"config": {
19+
"code_distribution": [
20+
{"key": 200, "val": 0.5},
21+
{"key": 201, "val": 0.3}
22+
],
23+
"seed": 1
24+
}
25+
},
26+
{
27+
"name": "delayer",
28+
"config": {
29+
"delay_millis_distribution": [
30+
{"key": 0, "val": 0.05},
31+
{"key": 10, "val": 0.2},
32+
{"key": 50, "val": 0.0},
33+
{"key": 100, "val": 0.75}
34+
],
35+
"seed": 1
36+
}
37+
}
38+
],
39+
"content": {
40+
"source": "directory",
41+
"config": {
42+
"dir": "/etc/reqstatsrv/data"
43+
}
44+
}
45+
},
46+
{
47+
"method": "GET",
48+
"path_pattern": "/drop/",
49+
"behaviour": [
50+
{
51+
"name": "connection_closer",
52+
"config": {
53+
"freq": 0.5,
54+
"seed": 3
55+
}
56+
}
57+
],
58+
"content" : {
59+
"source": "file",
60+
"config": {
61+
"path": "/etc/reqstatsrv/data/bar.json"
62+
}
63+
}
64+
},
65+
{
66+
"method": "GET",
67+
"path_pattern": "/delayed/",
68+
"behaviour": [
69+
{
70+
"name": "delayer",
71+
"config": {
72+
"delay_millis_distribution": [
73+
{"key": 0, "val": 0.0},
74+
{"key": 10, "val": 0.0},
75+
{"key": 50, "val": 0.0},
76+
{"key": 100, "val": 0.25},
77+
{"key": 200, "val": 0.25},
78+
{"key": 700, "val": 0.5}
79+
],
80+
"seed": 1
81+
}
82+
},
83+
{
84+
"name": "status_distributor",
85+
"config": {
86+
"code_distribution": [
87+
{"key": 200, "val": 0.7},
88+
{"key": 201, "val": 0.3}
89+
],
90+
"seed": 1
91+
}
92+
}
93+
],
94+
"content": {
95+
"source": "directory",
96+
"config": {
97+
"dir": "/etc/reqstatsrv/data"
98+
}
99+
}
100+
},
101+
{
102+
"method": "GET",
103+
"path_pattern": "/file",
104+
"behaviour": [],
105+
"content": {
106+
"source": "file",
107+
"config": {
108+
"path": "/etc/reqstatsrv/data/bar.json"
109+
}
110+
}
111+
},
112+
{
113+
"method": "GET",
114+
"path_pattern": "/stats",
115+
"behaviour": [
116+
117+
],
118+
"content": {
119+
"source": "stats",
120+
"config": {}
121+
}
122+
},
123+
{
124+
"method": "GET",
125+
"path_pattern": "/suslik",
126+
"behaviour": [
127+
{
128+
"name": "status_distributor",
129+
"config": {
130+
"code_distribution": [
131+
{"key": 200, "val": 0.6},
132+
{"key": 201, "val": 0.2},
133+
{"key": 202, "val": 0.2}
134+
],
135+
"seed": 1
136+
}
137+
}
138+
139+
],
140+
"content": {
141+
"source": "status_content_selector",
142+
"config": {
143+
"default_content": {
144+
"source": "stats",
145+
"config": {}
146+
},
147+
"status_contents": [
148+
{
149+
"from": 201,
150+
"to": 202,
151+
"content": {
152+
"source": "file",
153+
"config": {
154+
"path": "/etc/reqstatsrv/data/201_created.json"
155+
}
156+
}
157+
},
158+
{
159+
"from": 202,
160+
"to": 203,
161+
"content": {
162+
"source": "file",
163+
"config": {
164+
"path": "/etc/reqstatsrv/data/202_accepted.json"
165+
}
166+
}
167+
}
168+
]
169+
}
170+
}
171+
}
172+
]
173+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"result": 201,
3+
"desc": "something created"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"batch_process_id": "A629S99IAKSRtT"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"source": "bar.json",
3+
"dummy_string": "something here",
4+
"dummy_number": 42.0
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"foo": "bar"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"foo": "bar"
3+
}

0 commit comments

Comments
 (0)