Skip to content

Commit

Permalink
Merge pull request #397 from Mashape/fix/distributions
Browse files Browse the repository at this point in the history
Removing lru cache dependency and updating Luarocks conf
  • Loading branch information
subnetmarco committed Jul 14, 2015
2 parents 6237d30 + 01a9476 commit a9ff1bd
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 798 deletions.
5 changes: 0 additions & 5 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ files["kong/vendor/resty_http.lua"] = {
unused = false
}

files["kong/vendor/resty-lrucache/lib/resty/"] = {
global = false,
unused = false
}

files["spec/"] = {
globals = {"describe", "it", "before_each", "setup", "after_each", "teardown", "stub", "mock", "spy", "finally", "pending"}
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ branches:
- master

before_install:
- bash .travis/setup_kong.sh
- bash .travis/setup_cassandra.sh
- "bash .travis/setup_kong.sh"
- "bash .travis/setup_cassandra.sh"

install:
- sudo make dev
- "sudo make dev"

script:
- "busted -o spec/busted-print.lua --coverage spec/"
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion .travis/setup_kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sudo apt-get install wget curl tar make gcc unzip git liblua5.1-0-dev
sudo apt-get install sudo netcat lua5.1 openssl libpcre3 dnsmasq

# Installing Kong and its dependencies
sudo dpkg -i ./.travis/kong-0.3.0travis.precise_all.deb
sudo dpkg -i ./.travis/kong-0.4.0travis.precise_all.deb

sudo luarocks remove kong --force
sudo rm -rf /etc/kong
5 changes: 4 additions & 1 deletion distributions/.build-package-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ rocks_trees = {
{ name = [[system]], root = [[${OUT}/usr/local]] }
}
" > $rocks_config

export LUAROCKS_CONFIG=$rocks_config
export LUA_PATH=${OUT}/usr/local/share/lua/5.1/?.lua

Expand Down Expand Up @@ -242,7 +243,9 @@ post_install_script=$(mktemp $MKTEMP_POSTSCRIPT_CONF)
echo "#!/bin/sh
mkdir -p /etc/kong
cp /usr/local/lib/luarocks/rocks/kong/$rockspec_version/conf/kong.yml /etc/kong/kong.yml
echo \"user=root\" > /etc/dnsmasq.conf" > $post_install_script
echo \"user=root\" > /etc/dnsmasq.conf
chmod -R 777 /usr/local/kong/
" > $post_install_script

##############################################################
# Build the package #
Expand Down
16 changes: 11 additions & 5 deletions distributions/.test-package-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,24 @@ if ! [ `curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8001/` == "200"
fi

RANDOM_API_NAME=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
if ! [ `curl -s -o /dev/null -w "%{http_code}" -d "name=$RANDOM_API_NAME&public_dns=$RANDOM_API_NAME.com&target_url=http://mockbin.org/" http://127.0.0.1:8001/apis/` == "201" ]; then
RESPONSE=`curl -s -o /dev/null -w "%{http_code}" -d "name=$RANDOM_API_NAME&public_dns=$RANDOM_API_NAME.com&target_url=http://mockbin.org/" http://127.0.0.1:8001/apis/`
if ! [ $RESPONSE == "201" ]; then
echo "Can't create API"
cat /usr/local/kong/logs/error.log
exit 1
fi

if ! [ `curl -s -o /dev/null -w "%{http_code}" -H "Host: $RANDOM_API_NAME.com" http://127.0.0.1:8000/request` == "200" ]; then
echo "Can't invoke API"
RESPONSE=`curl -s -o /dev/null -w "%{http_code}" -H "Host: $RANDOM_API_NAME.com" http://127.0.0.1:8000/request`
if ! [ $RESPONSE == "200" ]; then
echo "Can't invoke API on HTTP"
cat /usr/local/kong/logs/error.log
exit 1
fi

if ! [ `curl -s -o /dev/null -w "%{http_code}" -H "Host: $RANDOM_API_NAME.com" https://127.0.0.1:8443/request --insecure` == "200" ]; then
echo "Can't invoke API"
RESPONSE=`curl -s -o /dev/null -w "%{http_code}" -H "Host: $RANDOM_API_NAME.com" https://127.0.0.1:8443/request --insecure`
if ! [ $RESPONSE == "200" ]; then
echo "Can't invoke API on HTTPS"
cat /usr/local/kong/logs/error.log
exit 1
fi

Expand Down
11 changes: 5 additions & 6 deletions kong-0.4.0-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = {
"lua-cjson ~> 2.1.0-1",
"ansicolors ~> 1.0.2-3",
"lbase64 ~> 20120820-1",
"lua-resty-iputils ~> 0.1.0-1",
"lua-resty-iputils ~> 0.2.0-1",

"luasocket ~> 2.0.2-5",
"lrexlib-pcre ~> 2.7.2-1",
Expand All @@ -40,7 +40,6 @@ build = {
["lapp"] = "kong/vendor/lapp.lua",
["ngx.ssl"] = "kong/vendor/ssl.lua",
["resty_http"] = "kong/vendor/resty_http.lua",
["resty.lrucache"] = "kong/vendor/resty-lrucache/lib/resty/lrucache.lua",

["kong.constants"] = "kong/constants.lua",

Expand Down Expand Up @@ -162,10 +161,10 @@ build = {
["kong.plugins.ssl.ssl_util"] = "kong/plugins/ssl/ssl_util.lua",
["kong.plugins.ssl.schema"] = "kong/plugins/ssl/schema.lua",

["kong.plugins.ip-restriction.handler"] = "kong/plugins/ip-restriction/handler.lua",
["kong.plugins.ip-restriction.init_worker"] = "kong/plugins/ip-restriction/init_worker.lua",
["kong.plugins.ip-restriction.access"] = "kong/plugins/ip-restriction/access.lua",
["kong.plugins.ip-restriction.schema"] = "kong/plugins/ip-restriction/schema.lua",
["kong.plugins.ip_restriction.handler"] = "kong/plugins/ip_restriction/handler.lua",
["kong.plugins.ip_restriction.init_worker"] = "kong/plugins/ip_restriction/init_worker.lua",
["kong.plugins.ip_restriction.access"] = "kong/plugins/ip_restriction/access.lua",
["kong.plugins.ip_restriction.schema"] = "kong/plugins/ip_restriction/schema.lua",

["kong.api.app"] = "kong/api/app.lua",
["kong.api.crud_helpers"] = "kong/api/crud_helpers.lua",
Expand Down
2 changes: 1 addition & 1 deletion kong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins_available:
- response_transformer
- requestsizelimiting
- analytics
- ip-restriction
- ip_restriction

## The Kong working directory
## (Make sure you have read and write permissions)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local BasePlugin = require "kong.plugins.base_plugin"
local init_worker = require "kong.plugins.ip-restriction.init_worker"
local access = require "kong.plugins.ip-restriction.access"
local init_worker = require "kong.plugins.ip_restriction.init_worker"
local access = require "kong.plugins.ip_restriction.access"

local IpRestrictionHandler = BasePlugin:extend()

function IpRestrictionHandler:new()
IpRestrictionHandler.super.new(self, "ip-restriction")
IpRestrictionHandler.super.new(self, "ip_restriction")
end

function IpRestrictionHandler:init_worker()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local iputils = require "resty.iputils"
local iputils = require "resty.iputils"

local function validate_ips(v, t, column)
local new_fields
Expand Down
229 changes: 0 additions & 229 deletions kong/vendor/resty-lrucache/lib/resty/lrucache.lua

This file was deleted.

Loading

0 comments on commit a9ff1bd

Please sign in to comment.