Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker compose config for kong #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
AUTH_MYSQL_PASSWORD=password
AUTH_KEYCLOAK_PASSWORD=password
AUTH_LDAP_PASSWORD=password

# kong
AUTH_POSTGRES_PASSWORD=password
KONG_ADMIN_PASSWORD=password
90 changes: 90 additions & 0 deletions kong.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
version: "3"

services:
# Kong can use cassandra or postgres. Cassandra was taking a little too
# much RAM.
kong-db:
image: postgres:9.4
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
POSTGRES_PASSWORD: ${AUTH_POSTGRES_PASSWORD}
# Do not expose the ports unless you actually need to use the databse
# from other networks.
# ports:
# - "5432:5432"
deploy:
restart_policy:
condition: any
resources:
limits:
cpus: "0.25"
memory: 100M

# This container quits after initializing the database. So, make sure
# restart condition is always set to 'on-failure'.
kong-migration:
image: felicityiiith/kong
depends_on:
- kong-db
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-db
KONG_PG_DATABSE: kong
KONG_PG_PASSWORD: ${AUTH_POSTGRES_PASSWORD}
command: kong migrations up
deploy:
restart_policy:
condition: on-failure
resources:
limits:
cpus: "1"
memory: 1G

# Master kong container.
kong:
image: felicityiiith/kong
depends_on:
- kong-db
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-db
KONG_PG_PASSWORD: ${AUTH_POSTGRES_PASSWORD}
KONG_PG_DATABASE: kong
# Custom plugins should be added here. Default ones can be set using
# admin API or admin dashboard.
KONG_CUSTOM_PLUGINS: oidc
# Kong will be receiving requests from Yui's HAproxy. So, this
# should be set to X-Forwarded-For for rate limiting plugin to work.
KONG_REAL_IP_HEADER: X-Forwarded-For
ports:
- "8000:8000"
- "8001:8001"
- "8443:8443"
- "8444:8444"
deploy:
restart_policy:
condition: any
resources:
limits:
cpus: "1"
memory: 500M

# Kong Admin Dashboard.
kong-dashboard:
image: pgbi/kong-dashboard
depends_on:
- kong
ports:
- 9000:8080
# Add more users by appending user=password
# You might also want to try kong:8444. But who will monitor packets
# inside docker network? :P
command: start --kong-url http://kong:8001 --basic-auth admin=${KONG_ADMIN_PASSWORD}
deploy:
restart_policy:
condition: any
resources:
limits:
cpus: "0.25"
memory: 200M