Skip to content

Instantly share code, notes, and snippets.

@italopinto
Last active April 26, 2022 14:45
Show Gist options
  • Save italopinto/e3b83c57c63cb9a7e7347fe8aae2335b to your computer and use it in GitHub Desktop.
Save italopinto/e3b83c57c63cb9a7e7347fe8aae2335b to your computer and use it in GitHub Desktop.
Kong declarative settings demo, with demo credentials in header.
version: '3.7'
services:
kong:
container_name: kong
image: kong:latest
volumes:
- ./kong.yml:/kong/declarative/kong.yml
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/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
ports:
- "8000:8000"
- "8443:8443"
- "127.0.0.1:8001:8001"
- "127.0.0.1:8444:8444"
_format_version: "2.1"
services:
- name: demo-service
# change port and path to the configured in your application
url: http://host.docker.internal:8080/<path_from_application>
routes:
- name: demo-route
paths:
- /<path_name_to_kong>
# authentication service
plugins:
- name: key-auth
service: demo-service
config:
key_names:
- apikey
key_in_body: false
key_in_header: true
key_in_query: false
hide_credentials: false
run_on_preflight: true
consumers:
- username: user123
keyauth_credentials:
- consumer: user123
key: "kingkong"
@italopinto
Copy link
Author

italopinto commented Apr 26, 2022

Dockerized Kong API Gateway

  • The docker-compose is in charged of create the kong container using the kong.yml which cares the kong settings.
  • This gist is just to save a demo kong to use in dev environments.
  • Only tested in Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment