Skip to content

Commit

Permalink
fix dockerized krakends example
Browse files Browse the repository at this point in the history
  • Loading branch information
dhontecillas committed Feb 23, 2024
1 parent 2663df3 commit 232e4e4
Show file tree
Hide file tree
Showing 16 changed files with 6,588 additions and 30 deletions.
12 changes: 9 additions & 3 deletions example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ conf:
cat ./docker_compose/conf.local/prometheus/prometheus.env_tmpl.yml | envsubst > ./docker_compose/conf.local/prometheus/prometheus.yml

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

docker_down:
cd ./docker_compose && docker-compose -p krakend_otel -f compose.yaml down --remove-orphans -v

docker_local_up:
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml up -d

docker_local_down:
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml down --remove-orphans -v

run: srv
run_local_up: srv
cd ./docker_compose && docker-compose -p krakend_otel_local -f compose.local.yaml up -d
./srv -c ./docker_compose/conf.local/krakend_front/configuration.json > log_frontend.log &
./srv -c ./docker_compose/conf.local/krakend_middle/configuration.json > log_middle.log &
./srv -c ./docker_compose/conf.local/krakend_back/configuration.json > log_back.log

run_srv: srv
run_local: srv
./srv -c ./docker_compose/conf.local/krakend_front/configuration.json > log_frontend.log &
./srv -c ./docker_compose/conf.local/krakend_middle/configuration.json > log_middle.log &
./srv -c ./docker_compose/conf.local/krakend_back/configuration.json > log_back.log
Expand Down
3 changes: 2 additions & 1 deletion example/client/k6client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const options = {
// about authoring k6 scripts.
//
export default function() {
let address = 'http://192.168.1.12:54444';
// let address = 'http://192.168.1.12:54444';
let address = 'http://192.168.1.12:44444';
http.get(address + '/fake/fsf');
http.get(address + '/combination/1');
http.get(address + '/direct/slow');
Expand Down
3 changes: 3 additions & 0 deletions example/docker_compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ services:
GF_AUT_ANONYMOUS_ENABLED: "true"
volumes:
- "vol_grafana:/var/lib/grafana"
- "./conf/grafana/conf/provisioning/datasources:/etc/grafana/provisioning/datasources"
- "./conf/grafana/conf/provisioning/dashboards:/etc/grafana/provisioning/dashboards"
- "./conf/grafana/conf/data/dashboards:/var/lib/grafana/dashboards"
depends_on:
- prometheus
- loki
Expand Down
15 changes: 0 additions & 15 deletions example/docker_compose/conf.local/krakend_back/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,6 @@
"disable_metrics": true
}
]
},
"instance": {
"metric_providers": [
"local_prometheus"
],
"metric_reporting_period": 1,
"trace_providers": [
"local_tempo",
"local_jaeger"
],
"trace_sample_rate": 1
},
"extra": {
"custom": "extra",
"future_expansion": true
}
}
}
Expand Down
173 changes: 173 additions & 0 deletions example/docker_compose/conf/fakeapi/config/example.dockerized.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"port": 9876,
"host": "0.0.0.0",
"endpoints": [
{
"method": "GET",
"path_pattern": "/",
"behaviour": [
{
"name": "slower",
"config": {
"max_bytes_per_second": 20,
"flush_bytes": 2
}
},
{
"name": "status_distributor",
"config": {
"code_distribution": [
{"key": 200, "val": 0.5},
{"key": 201, "val": 0.3}
],
"seed": 1
}
},
{
"name": "delayer",
"config": {
"delay_millis_distribution": [
{"key": 0, "val": 0.05},
{"key": 10, "val": 0.2},
{"key": 50, "val": 0.0},
{"key": 100, "val": 0.75}
],
"seed": 1
}
}
],
"content": {
"source": "directory",
"config": {
"dir": "/etc/reqstatsrv/data"
}
}
},
{
"method": "GET",
"path_pattern": "/drop/",
"behaviour": [
{
"name": "connection_closer",
"config": {
"freq": 0.5,
"seed": 3
}
}
],
"content" : {
"source": "file",
"config": {
"path": "/etc/reqstatsrv/data/bar.json"
}
}
},
{
"method": "GET",
"path_pattern": "/delayed/",
"behaviour": [
{
"name": "delayer",
"config": {
"delay_millis_distribution": [
{"key": 0, "val": 0.0},
{"key": 10, "val": 0.0},
{"key": 50, "val": 0.0},
{"key": 100, "val": 0.25},
{"key": 200, "val": 0.25},
{"key": 700, "val": 0.5}
],
"seed": 1
}
},
{
"name": "status_distributor",
"config": {
"code_distribution": [
{"key": 200, "val": 0.7},
{"key": 201, "val": 0.3}
],
"seed": 1
}
}
],
"content": {
"source": "directory",
"config": {
"dir": "/etc/reqstatsrv/data"
}
}
},
{
"method": "GET",
"path_pattern": "/file",
"behaviour": [],
"content": {
"source": "file",
"config": {
"path": "/etc/reqstatsrv/data/bar.json"
}
}
},
{
"method": "GET",
"path_pattern": "/stats",
"behaviour": [

],
"content": {
"source": "stats",
"config": {}
}
},
{
"method": "GET",
"path_pattern": "/suslik",
"behaviour": [
{
"name": "status_distributor",
"config": {
"code_distribution": [
{"key": 200, "val": 0.6},
{"key": 201, "val": 0.2},
{"key": 202, "val": 0.2}
],
"seed": 1
}
}

],
"content": {
"source": "status_content_selector",
"config": {
"default_content": {
"source": "stats",
"config": {}
},
"status_contents": [
{
"from": 201,
"to": 202,
"content": {
"source": "file",
"config": {
"path": "/etc/reqstatsrv/data/201_created.json"
}
}
},
{
"from": 202,
"to": 203,
"content": {
"source": "file",
"config": {
"path": "/etc/reqstatsrv/data/202_accepted.json"
}
}
}
]
}
}
}
]
}
4 changes: 4 additions & 0 deletions example/docker_compose/conf/fakeapi/data/201_created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"result": 201,
"desc": "something created"
}
3 changes: 3 additions & 0 deletions example/docker_compose/conf/fakeapi/data/202_accepted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"batch_process_id": "A629S99IAKSRtT"
}
5 changes: 5 additions & 0 deletions example/docker_compose/conf/fakeapi/data/bar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"source": "bar.json",
"dummy_string": "something here",
"dummy_number": 42.0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"foo": "bar"
}
3 changes: 3 additions & 0 deletions example/docker_compose/conf/fakeapi/data/foo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"foo": "bar"
}
Loading

0 comments on commit 232e4e4

Please sign in to comment.