install
- install official distribution
git clone kong
# clone the Kong repo (inside the vagrant one) git clone https://github.com/Kong/kong # only if you want to develop a custom plugin, also clone the plugin template git clone https://github.com/Kong/kong-plugin
define env
export KONG_PLUGINS=bundled,myplugin
db schema
psql -U postgres <<EOF \x CREATE ROLE kong; ALTER ROLE kong WITH login; CREATE DATABASE kong OWNER kong; CREATE DATABASE kong_tests OWNER kong; EOF psql -d kong -U postgres <<EOF \x DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA IF NOT EXISTS public AUTHORIZATION kong; GRANT ALL ON SCHEMA public TO kong; EOF CREATE USER konga; CREATE DATABASE konga OWNER konga; ALTER USER konga WITH PASSWORD 'new_password';
start
bin/kong migrations bootstrap # if you are running Kong < 0.15.0, run this instead of bootstrap: # $ bin/kong migrations up bin/kong start
sample
$ curl -i -X POST \ --url http://localhost:8001/services/ \ --data 'name=mockbin' \ --data 'url=http://mockbin.org/request' $ curl -i -X POST \ --url http://localhost:8001/services/mockbin/routes \ --data 'paths=/' # add the custom plugin, to our new api $ curl -i -X POST \ --url http://localhost:8001/services/mockbin/plugins \ --data 'name=myplugin'