aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-24 00:51:04 -0800
committerclarkzjw <[email protected]>2023-02-24 00:51:04 -0800
commit4bb5cbdc16ecf5f6e5961373816d4c741d54ee51 (patch)
treeea85f216881bacb54f579cae9814e2f85aa1abe5 /contrib
parenta9fb6f252553ae49a2ba372434073824babe31e4 (diff)
parent391abe42adf3bf065d9543ada068b696b00efdcd (diff)
downloadswarm2fediverse-4bb5cbdc16ecf5f6e5961373816d4c741d54ee51.tar.gz
Merge branch 'deploy/cicd'
added Dockerfile and docker-compose.yaml with krakend api gateway and monitoring using influxdb and grafana dashboard
Diffstat (limited to 'contrib')
-rw-r--r--contrib/docker-compose.yaml47
-rwxr-xr-xcontrib/influx/initdb.sh16
-rw-r--r--contrib/krakend.json84
3 files changed, 147 insertions, 0 deletions
diff --git a/contrib/docker-compose.yaml b/contrib/docker-compose.yaml
new file mode 100644
index 0000000..8aeaff8
--- /dev/null
+++ b/contrib/docker-compose.yaml
@@ -0,0 +1,47 @@
1version: '3'
2services:
3 checkinbot:
4 image: "clarkzjw/checkin.bot:latest"
5 restart: always
6 volumes:
7 - "./config.ini:/usr/src/app/config.ini"
8 - sqlite3:/usr/src/app/database/
9 ports:
10 - "8080:8080"
11
12 krakend:
13 image: "devopsfaith/krakend:2.2"
14 restart: always
15 ports:
16 - "8081:8080"
17 - "9091:9091"
18 volumes:
19 - "./krakend.json:/etc/krakend/krakend.json"
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
44volumes:
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"
7set -e
8
9# Retrieve the ID from the bucket created during setup
10BUCKET_ID=$(influx bucket list | grep "$DOCKER_INFLUXDB_INIT_BUCKET" | awk '{print $1}')
11
12influx 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
new file mode 100644
index 0000000..2ed23d8
--- /dev/null
+++ b/contrib/krakend.json
@@ -0,0 +1,84 @@
1{
2 "$schema": "https://www.krakend.io/schema/v3.json",
3 "version": 3,
4 "name": "Checkin.bot API",
5 "extra_config": {
6 "telemetry/influx": {
7 "address": "http://influx:8086",
8 "ttl": "25s",
9 "buffer_size": 100,
10 "db": "krakend",
11 "username": "krakend",
12 "password": "password"
13 },
14 "telemetry/metrics": {
15 "collection_time": "60s",
16 "proxy_disabled": false,
17 "router_disabled": false,
18 "backend_disabled": false,
19 "endpoint_disabled": false,
20 "listen_address": ":8090"
21 }
22 },
23 "timeout": "3000ms",
24 "cache_ttl": "300s",
25 "output_encoding": "json",
26 "debug_endpoint": true,
27 "endpoints": [
28 {
29 "endpoint": "/checkinbot/webhook",
30 "method": "POST",
31 "output_encoding": "json",
32 "backend": [
33 {
34 "url_pattern": "/checkinbot/webhook",
35 "encoding": "json",
36 "sd": "static",
37 "method": "POST",
38 "host": [
39 "http://checkinbot:8080"
40 ],
41 "disable_host_sanitize": false
42 }
43 ]
44 },
45 {
46 "endpoint": "/checkinbot/healthcheck",
47 "method": "GET",
48 "output_encoding": "string",
49 "backend": [
50 {
51 "url_pattern": "/checkinbot/healthcheck",
52 "encoding": "string",
53 "sd": "static",
54 "method": "GET",
55 "host": [
56 "http://checkinbot:8080"
57 ],
58 "disable_host_sanitize": false
59 }
60 ]
61 },
62 {
63 "endpoint": "/checkinbot/fedi_login_callback",
64 "method": "GET",
65 "output_encoding": "string",
66 "backend": [
67 {
68 "url_pattern": "/checkinbot/fedi_login_callback",
69 "encoding": "string",
70 "sd": "static",
71 "method": "GET",
72 "disable_host_sanitize": false,
73 "host": [
74 "http://checkinbot:8080"
75 ]
76 }
77 ],
78 "input_query_strings": [
79 "code",
80 "state"
81 ]
82 }
83 ]
84} \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)