Infra/kong gateway (#5)
* infra: add deluge to kong-net * infra: gateway container * feat: kong invocations * docs: update
This commit is contained in:
parent
8286204a7d
commit
75e72191bd
7 changed files with 89 additions and 0 deletions
|
@ -5,3 +5,5 @@
|
||||||
|Service|Description|
|
|Service|Description|
|
||||||
|---|---|
|
|---|---|
|
||||||
|[Plex](./plex)|Plex media server|
|
|[Plex](./plex)|Plex media server|
|
||||||
|
|[Deluge](./deluge)|Deluge Web service|
|
||||||
|
|[Kong](./kong)|Kong API Gateway|
|
||||||
|
|
|
@ -13,3 +13,8 @@ services:
|
||||||
- 6881:6881
|
- 6881:6881
|
||||||
- 6881:6881/udp
|
- 6881:6881/udp
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: kong-net
|
||||||
|
external: true
|
||||||
|
|
5
kong/README.md
Normal file
5
kong/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Kong Service
|
||||||
|
|
||||||
|
API Gateway to Spadinaistan.
|
||||||
|
|
||||||
|
Hit `<host>:8000/<service>` to access services hosted on Spadinaistan!
|
25
kong/docker-compose.yml
Normal file
25
kong/docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
plex:
|
||||||
|
image: kong:3.0.0
|
||||||
|
restart: always
|
||||||
|
container_name: kong-service
|
||||||
|
environment:
|
||||||
|
- KONG_DATABASE=off
|
||||||
|
- KONG_DECLARATIVE_CONFIG=/kong/declarative/kong.yml
|
||||||
|
- KONG_PROXY_ACCESS_LOG=/dev/stdout
|
||||||
|
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
|
||||||
|
- KONG_PROXY_ERROR_LOG=/dev/stdout
|
||||||
|
- KONG_ADMIN_ERROR_LOG=/dev/stdout
|
||||||
|
- KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
|
||||||
|
volumes:
|
||||||
|
- $PWD:/kong/declarative
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
- 8443:8443
|
||||||
|
- 8001:8001
|
||||||
|
- 8444:8444
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: kong-net
|
21
kong/kong.yml
Normal file
21
kong/kong.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
_format_version: "3.0"
|
||||||
|
_transform: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
- host: 172.17.0.1
|
||||||
|
name: deluge
|
||||||
|
port: 8112
|
||||||
|
protocol: http
|
||||||
|
routes:
|
||||||
|
- name: deluge
|
||||||
|
paths:
|
||||||
|
- /deluge/
|
||||||
|
strip_path: true
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- name: request-transformer
|
||||||
|
route: deluge
|
||||||
|
config:
|
||||||
|
add:
|
||||||
|
headers:
|
||||||
|
- X-Deluge-Base:/deluge/
|
29
kong/tasks.py
Normal file
29
kong/tasks.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import invoke
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
PATH = pathlib.Path(__file__).parent
|
||||||
|
|
||||||
|
|
||||||
|
@invoke.task()
|
||||||
|
def start(ctx):
|
||||||
|
with ctx.cd(PATH):
|
||||||
|
ctx.run("docker-compose up -d")
|
||||||
|
|
||||||
|
|
||||||
|
@invoke.task()
|
||||||
|
def stop(ctx):
|
||||||
|
with ctx.cd(PATH):
|
||||||
|
ctx.run("docker-compose down")
|
||||||
|
|
||||||
|
|
||||||
|
@invoke.task()
|
||||||
|
def restart(ctx):
|
||||||
|
with ctx.cd(PATH):
|
||||||
|
ctx.run("docker-compose restart")
|
||||||
|
|
||||||
|
|
||||||
|
ns = invoke.Collection("kong")
|
||||||
|
|
||||||
|
ns.add_task(start)
|
||||||
|
ns.add_task(restart)
|
||||||
|
ns.add_task(stop)
|
2
tasks.py
2
tasks.py
|
@ -2,8 +2,10 @@ import invoke
|
||||||
|
|
||||||
import plex.tasks
|
import plex.tasks
|
||||||
import deluge.tasks
|
import deluge.tasks
|
||||||
|
import kong.tasks
|
||||||
|
|
||||||
ns = invoke.Collection()
|
ns = invoke.Collection()
|
||||||
|
|
||||||
ns.add_collection(plex.tasks.ns)
|
ns.add_collection(plex.tasks.ns)
|
||||||
ns.add_collection(deluge.tasks.ns)
|
ns.add_collection(deluge.tasks.ns)
|
||||||
|
ns.add_collection(kong.tasks.ns)
|
||||||
|
|
Reference in a new issue