Skip to content

Instantly share code, notes, and snippets.

@laughingbiscuit
Created August 24, 2021 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laughingbiscuit/90ca227c7a98a7fdf201b49377d011f1 to your computer and use it in GitHub Desktop.
Save laughingbiscuit/90ca227c7a98a7fdf201b49377d011f1 to your computer and use it in GitHub Desktop.
Kong Hybrid (OSS) in 5 Commands!
docker network create kong-net
docker run -d --name kong-db \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
docker run --rm --network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-db" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_PASSWORD=password" \
kong kong migrations bootstrap
docker run -d --name kong-cp --network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-db" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001" \
-e "KONG_ROLE=control_plane" \
-e "KONG_CLUSTER_CERT=/tmp/cluster.crt" \
-e "KONG_CLUSTER_CERT_KEY=/tmp/cluster.key" \
-v "$PWD/certs/cluster.crt:/tmp/cluster.crt" \
-v "$PWD/certs/cluster.key:/tmp/cluster.key" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong
docker run -d --name kong-dp --network=kong-net \
-e "KONG_ROLE=data_plane" \
-e "KONG_DATABASE=off" \
-e "KONG_PROXY_LISTEN=0.0.0.0:8000" \
-e "KONG_CLUSTER_CONTROL_PLANE=kong-cp:8005" \
-e "KONG_CLUSTER_CERT=/tmp/cluster.crt" \
-e "KONG_CLUSTER_CERT_KEY=/tmp/cluster.key" \
-v "$PWD/certs/cluster.crt:/tmp/cluster.crt" \
-v "$PWD/certs/cluster.key:/tmp/cluster.key" \
-p 8002:8000 \
kong
@laughingbiscuit
Copy link
Author

laughingbiscuit commented Aug 24, 2021

remember to create certs with kong hybrid gen_cert as a prerequisite!

docker run --rm -it --user root -v $(pwd)/certs:/tmp/ssl/hybrid kong sh
$ cd /tmp/ssl/hybrid
$ kong hybrid gen_cert
$ chmod 644 cluster.key

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