Skip to content

Commit

Permalink
Rename project to Kong.
Browse files Browse the repository at this point in the history
This requires:
$ luarocks remove apenode
$ rm -rf tmp/
$ make global
$ make build
$ make migrate
  • Loading branch information
thibaultcha committed Feb 10, 2015
1 parent 79703da commit 5c40a99
Show file tree
Hide file tree
Showing 50 changed files with 188 additions and 215 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ PWD = `pwd`
export DAEMON ?= off
export LUA_LIB ?= lua_package_path \"$(PWD)/src/?.lua\;\;\"\;
export LUA_CODE_CACHE ?= off
export APENODE_PORT ?= 8000
export APENODE_WEB_PORT ?= 8001
export KONG_PORT ?= 8000
export KONG_WEB_PORT ?= 8001
export DIR ?= $(PWD)/tmp
export APENODE_CONF ?= $(DIR)/apenode.conf
export KONG_CONF ?= $(DIR)/kong.conf
export SILENT ?=

.PHONY: build global test test-web test-all run migrate populate drop

global:
@luarocks make apenode-*.rockspec
@luarocks make kong-*.rockspec

test:
@busted spec/unit
Expand Down Expand Up @@ -47,16 +47,16 @@ test-all:
@$(MAKE) drop SILENT=-s

migrate:
@scripts/migrate migrate $(SILENT) --conf=$(APENODE_CONF)
@scripts/migrate migrate $(SILENT) --conf=$(KONG_CONF)

reset:
@scripts/migrate reset $(SILENT) --conf=$(APENODE_CONF)
@scripts/migrate reset $(SILENT) --conf=$(KONG_CONF)

seed:
@scripts/seed seed $(SILENT) --conf=$(APENODE_CONF)
@scripts/seed seed $(SILENT) --conf=$(KONG_CONF)

drop:
@scripts/seed drop $(SILENT) --conf=$(APENODE_CONF)
@scripts/seed drop $(SILENT) --conf=$(KONG_CONF)

run:
@nginx -p $(DIR)/nginx -c nginx.conf
Expand All @@ -66,17 +66,17 @@ stop:

build:
@mkdir -p $(DIR)/nginx/logs
@cp templates/apenode.conf $(APENODE_CONF)
@cp templates/kong.conf $(KONG_CONF)
@echo "" > $(DIR)/nginx/logs/error.log
@echo "" > $(DIR)/nginx/logs/access.log
@sed \
-e "s/{{DAEMON}}/$(DAEMON)/g" \
-e "s@{{LUA_LIB_PATH}}@$(LUA_LIB)@g" \
-e "s/{{LUA_CODE_CACHE}}/$(LUA_CODE_CACHE)/g" \
-e "s/{{PORT}}/$(APENODE_PORT)/g" \
-e "s/{{WEB_PORT}}/$(APENODE_WEB_PORT)/g" \
-e "s@{{APENODE_CONF}}@$(APENODE_CONF)@g" \
-e "s/{{PORT}}/$(KONG_PORT)/g" \
-e "s/{{WEB_PORT}}/$(KONG_WEB_PORT)/g" \
-e "s@{{KONG_CONF}}@$(KONG_CONF)@g" \
templates/nginx.conf > $(DIR)/nginx/nginx.conf;

@cp -R src/apenode/web/static $(DIR)/nginx
@cp -R src/apenode/web/admin $(DIR)/nginx
@cp -R src/kong/web/static $(DIR)/nginx
@cp -R src/kong/web/admin $(DIR)/nginx
59 changes: 16 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Apenode
## Kong

[![Build Status](https://magnum.travis-ci.com/Mashape/lua-resty-apenode.svg?token=ZqXY1Sn8ga8gv6vUrw3N&branch=master)](https://magnum.travis-ci.com/Mashape/lua-resty-apenode)
[![Build Status](https://magnum.travis-ci.com/Mashape/kong.svg?token=ZqXY1Sn8ga8gv6vUrw3N&branch=master)](https://magnum.travis-ci.com/Mashape/kong)

```
______________________________________
Expand All @@ -17,7 +17,7 @@
- Luarocks for Lua `5.1`
- [Openrestify](http://openresty.com/#Download) `1.7.4.1`

### Run apenode (development)
### Run Kong (development)

- `make global`
- `make build`
Expand All @@ -28,20 +28,20 @@

### Commands

Commands consist of apenode's scripts and Makefile:
Commands consist of Kong's scripts and Makefile:

#### Makefile

| Name | Description |
| ------------ | --------------------------------------------------------------------------------------------------- |
| `global` | Install the apenode luarock globally |
| `build` | Generates an apenode environment (nginx + apenode configurations) in a given folder (see `DIR`) |
| `migrate` | Migrate your database according to the given apenode config (see `APENODE_CONF`) |
| `reset` | Reset your database schema according to the given apenode config (see `APENODE_CONF`) |
| `seed` | Seed your database according to the given apenode config |
| `drop` | Drop your database according to the given apenode config |
| `run` | Runs the given apenode environment in a given folder (see `DIR`) |
| `stop` | Stops the given apenode environment in a given folder (see `DIR`) |
| `global` | Install the Kong luarock globally |
| `build` | Generates a Kong environment (nginx + Kong configurations) in a given folder (see `DIR`) |
| `migrate` | Migrate your database according to the given Kong config (see `KONG_CONF`) |
| `reset` | Reset your database schema according to the given Kong config (see `KONG_CONF`) |
| `seed` | Seed your database according to the given Kong config |
| `drop` | Drop your database according to the given Kong config |
| `run` | Runs the given Kong environment in a given folder (see `DIR`) |
| `stop` | Stops the given Kong environment in a given folder (see `DIR`) |
| `test` | Runs the unit tests |
| `test-proxy` | Runs the proxy integration tests |
| `test-web` | Runs the web integration tests |
Expand All @@ -51,11 +51,11 @@ Commands consist of apenode's scripts and Makefile:

| Name | Default | Commands | Description |
| ---------------------- | ------------------------- | ------------------------- | ------------------------------------------------------------------------------ |
| `DIR` | `tmp/` | `build|run|stop` | Specify a folder where an apenode environment lives or should live if building |
| `APENODE_CONF` | `tmp/apenode.conf` | `build|migrate|seed|drop` | Points the command to the given apenode configuration file |
| `DIR` | `tmp/` | `build|run|stop` | Specify a folder where an Kong environment lives or should live if building |
| `KONG_CONF` | `tmp/kong.conf` | `build|migrate|seed|drop` | Points the command to the given Kong configuration file |
| `DAEMON` | `off` | `build` | Sets the nginx daemon property in the generated `nginx.conf` |
| `APENODE_PORT` | `8000` | `build` | Sets the apenode proxy port in the generated `nginx.conf` |
| `APENODE_WEB_PORT` | `8001` | `build` | Sets the apenode web port in the generated `nginx.conf` |
| `KONG_PORT` | `8000` | `build` | Sets Kong's proxy port in the generated `nginx.conf` |
| `KONG_WEB_PORT` | `8001` | `build` | Sets Kong's web port in the generated `nginx.conf` |
| `LUA_CODE_CACHE` | `off` | `build` | Sets the nginx `lua_code_cache` property in the generated `nginx.conf` |
| `LUA_LIB` | `$(PWD)/src/?.lua;;` | `build` | Sets the nginx `lua_package_path` property in the generated `nginx.conf` |

Expand All @@ -72,30 +72,3 @@ Commands consist of apenode's scripts and Makefile:
| | `seed --conf=[conf]` | Seed the database configured in the given conf | `-s` (Optional) No output |
| | | | `-r` (Optional) Also populate random data (1000 by default) |
| | `drop --conf=[conf]` | Drop the database configured in the given conf | `-s` (Optional) No output |

### API

The Apenode provides APIs to interact with the underlying data model and create APIs, accounts and applications

#### Create APIs

`POST /apis/`

* **required** `public_dns`: The public DNS of the API
* **required** `target_url`: The target URL
* **required** `authentication_type`: The authentication to enable on the API, can be `query`, `header`, `basic`.
* **required** `authentication_key_names`: A *comma-separated* list of authentication parameter names, like `apikey` or `x-mashape-key`.

#### Create Accounts

`POST /accounts/`

* `provider_id`: A custom id to be set in the account entity

#### Create Applications

`POST /applications/`

* **required** `account_id`: The `account_id` that the application belongs to.
* `public_key`: The public key, or username if Basic Authentication is enabled.
* **required** `secret_key`: The secret key, or api key, or password if Basic authentication is enabled. Use only this fields for simple api keys.
84 changes: 0 additions & 84 deletions apenode-0.1-1.rockspec

This file was deleted.

File renamed without changes.
84 changes: 84 additions & 0 deletions kong-0.1-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package = "kong"
version = "0.1-1"
supported_platforms = {"linux", "macosx"}
source = {
url = "git://github.com/Mashape/kong",
branch = "master"
}
description = {
summary = "Kong, the fastest and most installed API layer in the universe",
detailed = [[
Kong is the most popular API layer in the world
that provides API management and analytics for any kind
of API.
]],
homepage = "http://getkong.org",
license = "MIT"
}
dependencies = {
"lua ~> 5.1",

"lsqlite3 ~> 0.9.1-2",
"uuid ~> 0.2-1",
"lapis ~> 1.1.0-1",
"luasec ~> 0.5-2",
"yaml ~> 1.1.1-1",
"luaxml ~> 101012-1",
"lrexlib-pcre ~> 2.7.2-1",
"stringy ~> 0.2-1",
"inspect ~> 3.0-1",

"busted ~> 2.0.rc5-0",
"luafilesystem ~> 1.6.2"
}
build = {
type = "builtin",
modules = {
["kong"] = "src/main.lua",
["classic"] = "src/classic.lua",
["cassandra"] = "src/cassandra.lua",

["kong.tools.utils"] = "src/kong/tools/utils.lua",
["kong.tools.faker"] = "src/kong/tools/faker.lua",
["kong.tools.migrations"] = "src/kong/tools/migrations.lua",

["kong.base_plugin"] = "src/kong/base_plugin.lua",

["kong.core.handler"] = "src/kong/core/handler.lua",
["kong.core.access"] = "src/kong/core/access.lua",
["kong.core.header_filter"] = "src/kong/core/header_filter.lua",

["kong.dao.schemas"] = "src/kong/dao/schemas.lua",

["kong.dao.cassandra.factory"] = "src/kong/dao/cassandra/factory.lua",
["kong.dao.cassandra.base_dao"] = "src/kong/dao/cassandra/base_dao.lua",
["kong.dao.cassandra.apis"] = "src/kong/dao/cassandra/apis.lua",
["kong.dao.cassandra.metrics"] = "src/kong/dao/cassandra/metrics.lua",
["kong.dao.cassandra.plugins"] = "src/kong/dao/cassandra/plugins.lua",
["kong.dao.cassandra.accounts"] = "src/kong/dao/cassandra/accounts.lua",
["kong.dao.cassandra.applications"] = "src/kong/dao/cassandra/applications.lua",

["kong.plugins.authentication.handler"] = "src/kong/plugins/authentication/handler.lua",
["kong.plugins.authentication.access"] = "src/kong/plugins/authentication/access.lua",
["kong.plugins.authentication.schema"] = "src/kong/plugins/authentication/schema.lua",

["kong.plugins.networklog.handler"] = "src/kong/plugins/networklog/handler.lua",
["kong.plugins.networklog.log"] = "src/kong/plugins/networklog/log.lua",
["kong.plugins.networklog.schema"] = "src/kong/plugins/networklog/schema.lua",

["kong.plugins.ratelimiting.handler"] = "src/kong/plugins/ratelimiting/handler.lua",
["kong.plugins.ratelimiting.access"] = "src/kong/plugins/ratelimiting/access.lua",
["kong.plugins.ratelimiting.schema"] = "src/kong/plugins/ratelimiting/schema.lua",

["kong.web.app"] = "src/kong/web/app.lua",
["kong.web.routes.accounts"] = "src/kong/web/routes/accounts.lua",
["kong.web.routes.apis"] = "src/kong/web/routes/apis.lua",
["kong.web.routes.applications"] = "src/kong/web/routes/applications.lua",
["kong.web.routes.plugins"] = "src/kong/web/routes/plugins.lua",
["kong.web.routes.base_controller"] = "src/kong/web/routes/base_controller.lua"
},
copy_directories = { "src/kong/web/admin", "src/kong/web/static" },
install = {
bin = { "bin/kong" }
}
}
4 changes: 2 additions & 2 deletions scripts/migrate
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env lua

local utils = require "apenode.tools.utils"
local Migrations = require "apenode.tools.migrations"
local utils = require "kong.tools.utils"
local Migrations = require "kong.tools.migrations"

local function print_usage()
print("Usage:")
Expand Down
2 changes: 1 addition & 1 deletion scripts/seed
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env lua

local utils = require "apenode.tools.utils"
local utils = require "kong.tools.utils"

local function print_usage()
print("Usage:")
Expand Down
2 changes: 1 addition & 1 deletion spec/dao_configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ return {
port = 9042,
timeout = 1000,
keepalive = 60000,
keyspace = "apenode_tests"
keyspace = "kong_tests"
}
}
2 changes: 1 addition & 1 deletion spec/proxy/authentication_plugin_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require "apenode.tools.utils"
local utils = require "kong.tools.utils"
local cjson = require "cjson"

local kProxyURL = "http://localhost:8000/"
Expand Down
2 changes: 1 addition & 1 deletion spec/proxy/core_access_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require "apenode.tools.utils"
local utils = require "kong.tools.utils"
local cjson = require "cjson"

local kProxyURL = "http://localhost:8000/"
Expand Down
2 changes: 1 addition & 1 deletion spec/proxy/ratelimiting_plugin_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require "apenode.tools.utils"
local utils = require "kong.tools.utils"
local cjson = require "cjson"

local kProxyURL = "http://localhost:8000/"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/dao/cassandra_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local uuid = require "uuid"

-- Kong
local configuration = require "spec.dao_configuration"
local CassandraFactory = require "apenode.dao.cassandra.factory"
local CassandraFactory = require "kong.dao.cassandra.factory"
local dao_factory = CassandraFactory(configuration.cassandra)

-- An utility function to apply tests on each collection
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/validations_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local schemas = require "apenode.dao.schemas"
local schemas = require "kong.dao.schemas"
local validate = schemas.validate

describe("Validation", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/web/utils_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require "apenode.tools.utils"
local utils = require "kong.tools.utils"
local cjson = require "cjson"
local os = require "os"

Expand Down
Loading

1 comment on commit 5c40a99

@ahmadnassri
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awww yeah!

Please sign in to comment.