Skip to content

Instantly share code, notes, and snippets.

@syedrakib
Last active December 23, 2022 09:19
Show Gist options
  • Save syedrakib/f2651ab13dd4208e5dc628213c557f58 to your computer and use it in GitHub Desktop.
Save syedrakib/f2651ab13dd4208e5dc628213c557f58 to your computer and use it in GitHub Desktop.
Hello Kong. Embedded in my medium article about "Spinning up an API Gateway with DBLess Kong Gateway". Draft link here https://medium.com/airasia-com-tech-blog/spinning-up-an-api-gateway-with-dbless-kong-gateway-2100be03619b
_format_version: "2.1"
_transform: true
services:
- name: mock # any meaningful name to identify our API
url: https://mockbin.org/bin/dd5b993d-c69b-48db-9036-829fb7955f58 # a remote backend that we will proxy to - clients will not know about this
routes:
- paths:
- /mock # an API path that we will call
methods:
- GET # we will allow only the GET HTTP method for this route
hosts:
- example.hello-kong-test.com # we will serve only over a specific host for this route
protocols:
# - http # we will purposefully disallow plaintext HTTP traffic for this route
- https # we will allow only HTTPS traffic (self-signed certificates will be provided out-of-the-box)
version: '3'
services:
kong_test:
image: kong:3.0.1-alpine
container_name: kong_test
volumes: [ "./declarative.yaml:/etc/kong/declarative.yaml" ]
# https://docs.konghq.com/gateway/2.6.x/reference/configuration/#environment-variables
environment:
KONG_DATABASE: "off" # turns on DBLess mode
KONG_DECLARATIVE_CONFIG: "/etc/kong/declarative.yaml"
KONG_PROXY_LISTEN: "0.0.0.0:8080, 0.0.0.0:8443 ssl"
KONG_ADMIN_LISTEN: "0.0.0.0:8001, 0.0.0.0:8002 ssl"
KONG_STATUS_LISTEN: "0.0.0.0:8101, 0.0.0.0:8102 ssl"
ports:
# Expose proxy ports in localhost
# Opening standard http(80) and https(443) ports may require `sudo` privileges
- 127.0.0.1:80:8080
- 127.0.0.1:443:8443
# expose Admin API ports in localhost
- 127.0.0.1:8901:8001
- 127.0.0.1:8902:8002
# expose Status API ports in localhost
- 127.0.0.1:8903:8101
- 127.0.0.1:8904:8102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment