diff options
-rw-r--r-- | contrib/docker-compose.yaml | 27 | ||||
-rwxr-xr-x | contrib/influx/initdb.sh | 16 | ||||
-rw-r--r-- | contrib/krakend.json | 20 |
3 files changed, 49 insertions, 14 deletions
diff --git a/contrib/docker-compose.yaml b/contrib/docker-compose.yaml index 3ca7981..8aeaff8 100644 --- a/contrib/docker-compose.yaml +++ b/contrib/docker-compose.yaml | |||
@@ -10,7 +10,7 @@ services: | |||
10 | - "8080:8080" | 10 | - "8080:8080" |
11 | 11 | ||
12 | krakend: | 12 | krakend: |
13 | image: "devopsfaith/krakend:latest" | 13 | image: "devopsfaith/krakend:2.2" |
14 | restart: always | 14 | restart: always |
15 | ports: | 15 | ports: |
16 | - "8081:8080" | 16 | - "8081:8080" |
@@ -18,5 +18,30 @@ services: | |||
18 | volumes: | 18 | volumes: |
19 | - "./krakend.json:/etc/krakend/krakend.json" | 19 | - "./krakend.json:/etc/krakend/krakend.json" |
20 | 20 | ||
21 | influx: | ||
22 | image: influxdb:2.6.1 | ||
23 | environment: | ||
24 | - "DOCKER_INFLUXDB_INIT_MODE=setup" | ||
25 | - "DOCKER_INFLUXDB_INIT_USERNAME=krakend" | ||
26 | - "DOCKER_INFLUXDB_INIT_PASSWORD=password" | ||
27 | - "DOCKER_INFLUXDB_INIT_ORG=my-org" | ||
28 | - "DOCKER_INFLUXDB_INIT_BUCKET=krakend" | ||
29 | - "DOCKER_INFLUXDB_INIT_RETENTION=1w" | ||
30 | - "DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token" | ||
31 | ports: | ||
32 | - "8086:8086" | ||
33 | volumes: | ||
34 | - "./influx/initdb.sh:/docker-entrypoint-initdb.d/initdb.sh" | ||
35 | |||
36 | grafana: | ||
37 | image: "grafana/grafana:9.3.6" | ||
38 | restart: always | ||
39 | ports: | ||
40 | - "3000:3000" | ||
41 | volumes: | ||
42 | - grafana:/var/lib/grafana | ||
43 | |||
21 | volumes: | 44 | volumes: |
22 | sqlite3: | 45 | sqlite3: |
46 | grafana: | ||
47 | influxdb: | ||
diff --git a/contrib/influx/initdb.sh b/contrib/influx/initdb.sh new file mode 100755 index 0000000..b1d07af --- /dev/null +++ b/contrib/influx/initdb.sh | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/bash | ||
2 | # The following script creates the authentication for Grafana | ||
3 | # and is meant to be added to InfluxDB docker-compose.yml file. | ||
4 | # image: influxdb | ||
5 | # volumes: | ||
6 | # - "./config/influx:/docker-entrypoint-initdb.d" | ||
7 | set -e | ||
8 | |||
9 | # Retrieve the ID from the bucket created during setup | ||
10 | BUCKET_ID=$(influx bucket list | grep "$DOCKER_INFLUXDB_INIT_BUCKET" | awk '{print $1}') | ||
11 | |||
12 | influx v1 auth create \ | ||
13 | --username ${DOCKER_INFLUXDB_INIT_USERNAME} \ | ||
14 | --password ${DOCKER_INFLUXDB_INIT_PASSWORD} \ | ||
15 | --write-bucket ${BUCKET_ID} \ | ||
16 | --org ${DOCKER_INFLUXDB_INIT_ORG} | ||
diff --git a/contrib/krakend.json b/contrib/krakend.json index 1f89340..2ed23d8 100644 --- a/contrib/krakend.json +++ b/contrib/krakend.json | |||
@@ -3,19 +3,13 @@ | |||
3 | "version": 3, | 3 | "version": 3, |
4 | "name": "Checkin.bot API", | 4 | "name": "Checkin.bot API", |
5 | "extra_config": { | 5 | "extra_config": { |
6 | "telemetry/opencensus": { | 6 | "telemetry/influx": { |
7 | "sample_rate": 100, | 7 | "address": "http://influx:8086", |
8 | "reporting_period": 0, | 8 | "ttl": "25s", |
9 | "exporters": { | 9 | "buffer_size": 100, |
10 | "prometheus": { | 10 | "db": "krakend", |
11 | "port": 9091, | 11 | "username": "krakend", |
12 | "namespace": "krakend", | 12 | "password": "password" |
13 | "tag_host": false, | ||
14 | "tag_path": true, | ||
15 | "tag_method": true, | ||
16 | "tag_statuscode": false | ||
17 | } | ||
18 | } | ||
19 | }, | 13 | }, |
20 | "telemetry/metrics": { | 14 | "telemetry/metrics": { |
21 | "collection_time": "60s", | 15 | "collection_time": "60s", |