diff options
author | clarkzjw <[email protected]> | 2023-02-23 23:42:50 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-23 23:42:50 -0800 |
commit | b097f3c13ddfa51551bce9ca9344c796e5cea9cb (patch) | |
tree | fd09f2c0b9ba1b548bce6c214b9eb0f109baa77b /contrib | |
parent | af610ab49194f12783fdfb2cc676c4877b22ed7c (diff) | |
download | swarm2fediverse-b097f3c13ddfa51551bce9ca9344c796e5cea9cb.tar.gz |
deploy: add krakend api gateway
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/docker-compose.yaml | 11 | ||||
-rw-r--r-- | contrib/krakend.json | 90 |
2 files changed, 100 insertions, 1 deletions
diff --git a/contrib/docker-compose.yaml b/contrib/docker-compose.yaml index 7ba8c2d..3ca7981 100644 --- a/contrib/docker-compose.yaml +++ b/contrib/docker-compose.yaml | |||
@@ -1,6 +1,6 @@ | |||
1 | version: '3' | 1 | version: '3' |
2 | services: | 2 | services: |
3 | checkin.bot: | 3 | checkinbot: |
4 | image: "clarkzjw/checkin.bot:latest" | 4 | image: "clarkzjw/checkin.bot:latest" |
5 | restart: always | 5 | restart: always |
6 | volumes: | 6 | volumes: |
@@ -9,5 +9,14 @@ services: | |||
9 | ports: | 9 | ports: |
10 | - "8080:8080" | 10 | - "8080:8080" |
11 | 11 | ||
12 | krakend: | ||
13 | image: "devopsfaith/krakend:latest" | ||
14 | restart: always | ||
15 | ports: | ||
16 | - "8081:8080" | ||
17 | - "9091:9091" | ||
18 | volumes: | ||
19 | - "./krakend.json:/etc/krakend/krakend.json" | ||
20 | |||
12 | volumes: | 21 | volumes: |
13 | sqlite3: | 22 | sqlite3: |
diff --git a/contrib/krakend.json b/contrib/krakend.json new file mode 100644 index 0000000..1f89340 --- /dev/null +++ b/contrib/krakend.json | |||
@@ -0,0 +1,90 @@ | |||
1 | { | ||
2 | "$schema": "https://www.krakend.io/schema/v3.json", | ||
3 | "version": 3, | ||
4 | "name": "Checkin.bot API", | ||
5 | "extra_config": { | ||
6 | "telemetry/opencensus": { | ||
7 | "sample_rate": 100, | ||
8 | "reporting_period": 0, | ||
9 | "exporters": { | ||
10 | "prometheus": { | ||
11 | "port": 9091, | ||
12 | "namespace": "krakend", | ||
13 | "tag_host": false, | ||
14 | "tag_path": true, | ||
15 | "tag_method": true, | ||
16 | "tag_statuscode": false | ||
17 | } | ||
18 | } | ||
19 | }, | ||
20 | "telemetry/metrics": { | ||
21 | "collection_time": "60s", | ||
22 | "proxy_disabled": false, | ||
23 | "router_disabled": false, | ||
24 | "backend_disabled": false, | ||
25 | "endpoint_disabled": false, | ||
26 | "listen_address": ":8090" | ||
27 | } | ||
28 | }, | ||
29 | "timeout": "3000ms", | ||
30 | "cache_ttl": "300s", | ||
31 | "output_encoding": "json", | ||
32 | "debug_endpoint": true, | ||
33 | "endpoints": [ | ||
34 | { | ||
35 | "endpoint": "/checkinbot/webhook", | ||
36 | "method": "POST", | ||
37 | "output_encoding": "json", | ||
38 | "backend": [ | ||
39 | { | ||
40 | "url_pattern": "/checkinbot/webhook", | ||
41 | "encoding": "json", | ||
42 | "sd": "static", | ||
43 | "method": "POST", | ||
44 | "host": [ | ||
45 | "http://checkinbot:8080" | ||
46 | ], | ||
47 | "disable_host_sanitize": false | ||
48 | } | ||
49 | ] | ||
50 | }, | ||
51 | { | ||
52 | "endpoint": "/checkinbot/healthcheck", | ||
53 | "method": "GET", | ||
54 | "output_encoding": "string", | ||
55 | "backend": [ | ||
56 | { | ||
57 | "url_pattern": "/checkinbot/healthcheck", | ||
58 | "encoding": "string", | ||
59 | "sd": "static", | ||
60 | "method": "GET", | ||
61 | "host": [ | ||
62 | "http://checkinbot:8080" | ||
63 | ], | ||
64 | "disable_host_sanitize": false | ||
65 | } | ||
66 | ] | ||
67 | }, | ||
68 | { | ||
69 | "endpoint": "/checkinbot/fedi_login_callback", | ||
70 | "method": "GET", | ||
71 | "output_encoding": "string", | ||
72 | "backend": [ | ||
73 | { | ||
74 | "url_pattern": "/checkinbot/fedi_login_callback", | ||
75 | "encoding": "string", | ||
76 | "sd": "static", | ||
77 | "method": "GET", | ||
78 | "disable_host_sanitize": false, | ||
79 | "host": [ | ||
80 | "http://checkinbot:8080" | ||
81 | ] | ||
82 | } | ||
83 | ], | ||
84 | "input_query_strings": [ | ||
85 | "code", | ||
86 | "state" | ||
87 | ] | ||
88 | } | ||
89 | ] | ||
90 | } \ No newline at end of file | ||