A work in progress. Use at your own discretion. A basic understanding of Docker, Compose, and Kong is required.
An unofficial Docker image (tooling) for Kong testing, and development.
Kong is a scalable, open source API Layer (also known as an API Gateway, or API Middleware)... Backed by the battle-tested NGINX with a focus on high performance.
This repository provides lightweight tooling for testing, and developing Kong.
It is intended to serve as an unofficial, easy-to-use, alternative to kong-vagrant for developing on Kong or on custom plugins.
Some manual labour however, is still required (e.g. Mounting directories, setting environment variables / flags, etc).
mrsaints/kong-dev image contains all the necessary dependencies to run, test, and develop Kong (e.g. OpenResty, luarocks, Serf, and Kong). It runs on the latest (at the time of build) Kong source code.
It is a fork of
To get started, clone this repository, and modify the
docker-compose.yml file if you would like to mount your local Kong repository or your custom plugin source code.
Alternatively, you can clone the
Mashape/kong-plugin boilerplate into this directory to begin working on your custom plugin. The
Mashape/kong repository can also be cloned into this directory.
Once ready, run
docker-compose run --rm --service-ports kong bash, and you can begin running commands like
kong start --vv.
There is an entrypoint for Kong to wait for the database. To bypass it, pass a
-W flag before your command, e.g.
docker-compose run --rm --service-ports kong -W bash. You can even pass a
--no-deps flag after
run to launch Kong without the database
No restarts should be needed for local changes to be reflected (assuming the code is mounted). The default log level has also been set to
Once you have mounted your plugin source code, you can install it manually by including it in the
LUA_ PATH (change
Then, load it:
These environment variables are already included in the
docker-compose.yml file. You can uncomment, and modify the lines before executing Compose commands.
Tests must execute Kong in daemon mode otherwise they will hang (i.e.
KONG_NGINX_DAEMON=on, note the
To run tests for your custom plugin (assuming it is in
export LUA_PATH="/kong-plugin/?.lua;/kong-plugin/?/init.lua;;" bin/busted -o gtest -v --exclude-tags=ci /kong-plugin/spec/
Due to an unknown problem, possibly related to Serf / clustering, you may have to clear the cache manually when making changes (e.g. enabling or updating plugins), otherwise they may not be reflected:
curl -i -XDELETE http://localhost:8001/cache
https://github.com/MrSaints/kong-plugin-aws/ was built using these tooling.