Vagrant is used to create an isolated development environment for Kong including Cassandra.
Once you have Vagrant installed, follow those steps:
# clone the Kong repo
$ git clone https://github.com/Mashape/kong
# clone this repository
$ git clone https://github.com/Mashape/kong-vagrant
$ cd kong-vagrant/
# start a box with a folder synced to your local Kong clone
$ KONG_PATH=/path/to/kong/clone/ vagrant up
This will tell Vagrant to mount your local Kong repository under the guest's /kong
folder.
The startup process will install all the dependencies necessary for developing (including Cassandra). The Kong source code is mounted at /kong
. The host ports 8000
and 8001
will be forwarded to the Vagrant box.
You can alter the behavior of the provision step by setting the following environment variables:
name | description | default |
---|---|---|
KONG_PATH |
the path to mount your local Kong source under the guest's /kong folder |
../kong |
KONG_VERSION |
the Kong version number to download and install at the provision step | latest |
KONG_VB_MEM |
virtual machine memory (RAM) size (in MB) | 2048 |
To build Kong execute the following commands:
# SSH into the vagrant box
$ vagrant ssh
# switch to the mounted Kong repo
$ cd /kong
# install Kong
$ sudo make dev
# start Kong
$ kong start -c kong_DEVELOPMENT.yml
To verify Kong is running successfully, execute the following command from the host machine:
$ curl http://localhost:8001
You should receive a JSON response:
{
"tagline": "Welcome to Kong",
"version": "0.4.1",
"hostname": "precise64",
"lua_version": "LuaJIT 2.1.0-alpha",
"plugins": {
"enabled_in_cluster": {},
"available_on_server": [
...
]
}
}
The lua_package_path
directive in the configuration specifies that the Lua code in your local folder will be used in favor of the system installation. The lua_code_cache
directive being turned off, you can start Kong, edit your local files (on your host machine), and test your code without restarting Kong.
Eventually, familiarize yourself with the Makefile Operations.
Support, Demo, Training, API Certifications and Consulting available at http://getkong.org/enterprise.