Skip to content

balancer_by_lua for streams #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
35e6cd7
Initial Commit of balancer_by_lua_* port
splitice Feb 4, 2016
559a9b4
add balancer to FFI context and fix get_phase
splitice Feb 4, 2016
0729016
fix segfault due to miss-matched types
splitice Feb 4, 2016
14a545c
first part of porting tests, the configuration
splitice Feb 4, 2016
463a8eb
fix log passing
splitice Feb 4, 2016
485ec80
pass the stream session correctly
splitice Feb 4, 2016
e72e37f
Merge remote-tracking branch 'refs/remotes/openresty/master'
splitice Feb 5, 2016
169a8cf
Merge remote-tracking branch 'refs/remotes/openresty/master'
splitice Feb 5, 2016
a969b82
request/session r -> s
splitice Feb 5, 2016
70942f9
FFI: get_last_failure comment the reason for non-implementation. Retu…
splitice Feb 5, 2016
1527ee1
Style: remove extra whitespace / newline
splitice Feb 5, 2016
9d3efbf
style fixes
splitice Feb 5, 2016
1477f6d
missed semicolon
splitice Feb 5, 2016
d6252a2
Merge remote-tracking branch 'refs/remotes/openresty/master'
splitice Feb 18, 2016
8d47c5c
Merge remote-tracking branch 'refs/remotes/openresty/master'
splitice May 4, 2016
0a87fc2
style fixes based on ngx-style.pl
rshriram Aug 9, 2016
291d72f
add comment about *status=0
rshriram Aug 9, 2016
78efab0
travis tests
Aug 9, 2016
69785dc
remove extraneous resolve test
Aug 9, 2016
4552ef2
fix balancer tests
Aug 9, 2016
9c65d89
add empty --config sections in balancer test
Aug 9, 2016
bb12e57
add stream request to tests
Aug 9, 2016
da0cb96
remove http specific tests from suite 138-balancer.t
Aug 10, 2016
52cc121
remove blank lines
Aug 10, 2016
3a430b8
remove travis from personal branch
Aug 10, 2016
0327ea3
Merge remote-tracking branch 'upstream/master'
Aug 10, 2016
c083780
set name of context for balancer_by_lua
Aug 10, 2016
07b8540
add support for set_timeouts in balancer_by_lua
Aug 14, 2016
9f0c59e
set nginx version to 1.11.2
Aug 16, 2016
9136d25
revert travis version to 1.9.15
Aug 16, 2016
3d84692
remove set_timeout support
Aug 16, 2016
dc5a572
ngx exit support - wip
Aug 16, 2016
a73175b
fixing balancer tests. check for ngx error and ngx ok
Aug 17, 2016
34ae6be
check for context mismatch before anything else in balancer functions
Aug 21, 2016
8aa6082
remove stray http balancer reference
Aug 21, 2016
ac4f075
Merge remote-tracking branch 'upstream/master'
Oct 17, 2016
f204613
fix compilation error
Oct 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
sudo: required
Copy link
Member

Choose a reason for hiding this comment

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

The git master branch already has this file. Please rebase to it.

Copy link
Author

Choose a reason for hiding this comment

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

you mean remove the entire .travis.yml file? I can certainly do it.. I just kept it around for my personal testing.

Copy link
Author

Choose a reason for hiding this comment

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

@agentzh
Could you please give me some pointer on what exactly you mean by allowing ngx.balancer to work with this? Sorry, I whipped up this PR without going into much of the code base. So, I don't really understand what is needed here.

If you could provide me with a pointer or something, that would be very useful.

Copy link
Member

Choose a reason for hiding this comment

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

@rshriram I mean the git master branch already has the .travis.yml file:

https://github.com/openresty/stream-lua-nginx-module/blob/master/.travis.yml

And the travis ci tests are all passing on the master branch. So your branch should too. And you should not add your own .travis.yml changes as seen in this diff.

Copy link
Member

Choose a reason for hiding this comment

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

@rshriram I'm not suggesting removing the .travis.yml file. Instead I'm suggesting that the master branch already has it and you should not add your own version without good reasons.

Choose a reason for hiding this comment

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

@rshriram Theres another PR in resty core for the ngx.balancer side.

dist: trusty

os: linux

language: c

compiler:
- gcc
- clang

cache:
directories:
- download-cache

env:
global:
- LUAJIT_PREFIX=/opt/luajit21
- LUAJIT_LIB=$LUAJIT_PREFIX/lib
- LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH
- LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1
- LUA_INCLUDE_DIR=$LUAJIT_INC
- LUA_CMODULE_DIR=/lib
- PCRE_VER=8.33
- PCRE_PREFIX=/opt/pcre
- PCRE_LIB=$PCRE_PREFIX/lib
- PCRE_INC=$PCRE_PREFIX/include
- JOBS=3
- NGX_BUILD_JOBS=$JOBS
- TEST_NGINX_SLEEP=0.006
matrix:
- NGINX_VERSION=1.9.15

services:
- memcache
- redis-server

before_install:
- sudo apt-get install -qq -y axel cpanminus libgd-dev libtest-base-perl libtext-diff-perl liburi-perl libwww-perl libtest-longstring-perl liblist-moreutils-perl > build.log 2>&1 || (cat build.log && exit 1)

install:
- if [ ! -d download-cache ]; then mkdir download-cache; fi
- if [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -O download-cache/pcre-$PCRE_VER.tar.gz http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi
- git clone https://github.com/openresty/nginx-devel-utils.git
- git clone https://github.com/openresty/lua-cjson.git
- git clone https://github.com/openresty/openresty.git ../openresty
- git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
- git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module
- git clone https://github.com/openresty/mockeagain.git
- git clone https://github.com/openresty/test-nginx.git
- git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git
- git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module
- git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module
- git clone https://github.com/openresty/memc-nginx-module.git ../memc-nginx-module
- git clone https://github.com/openresty/headers-more-nginx-module.git ../headers-more-nginx-module
- git clone https://github.com/openresty/stream-echo-nginx-module.git ../stream-echo-nginx-module

script:
- tar zxf download-cache/pcre-$PCRE_VER.tar.gz
- cd pcre-$PCRE_VER/
- ./configure --prefix=$PCRE_PREFIX --enable-jit --enable-utf --enable-unicode-properties > build.log 2>&1 || (cat build.log && exit 1)
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1)
- cd ..
- cd luajit2
- make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1)
- sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)
- cd ../test-nginx && sudo cpanm . && cd ..
- cd lua-cjson/ && make -j$JOBS && sudo make install && cd ..
- cd mockeagain/ && make CC=$CC -j$JOBS && cd ..
- export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH
- export NGX_BUILD_CC=$CC
- sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1)
- nginx -V
- ldd `which nginx`|grep -E 'luajit|ssl|pcre'
- export LD_PRELOAD=$PWD/mockeagain/mockeagain.so
- export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH
- export TEST_NGINX_RESOLVER=8.8.4.4
- dig +short @$TEST_NGINX_RESOLVER openresty.org || exit 0
- dig +short @$TEST_NGINX_RESOLVER agentzh.org || exit 0
- prove -r t
2 changes: 2 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/src/ngx_stream_lua_initby.c \
$ngx_addon_dir/src/ngx_stream_lua_args.c \
$ngx_addon_dir/src/ngx_stream_lua_initworkerby.c \
$ngx_addon_dir/src/ngx_stream_lua_balancer.c \
"

NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
Expand Down Expand Up @@ -373,6 +374,7 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
$ngx_addon_dir/src/ngx_stream_lua_initby.h \
$ngx_addon_dir/src/ngx_stream_lua_args.h \
$ngx_addon_dir/src/ngx_stream_lua_initworkerby.h \
$ngx_addon_dir/src/ngx_stream_lua_balancer.h \
"

ngx_feature="export symbols by default (-E)"
Expand Down
Loading