Browse Source

Fixed: dynamic build; misteped in config; Move: test files; Update: Makefile;

tags/v2.3.0
Vasiliy Soshnikov 3 years ago
parent
commit
41db589c7c
7 changed files with 161 additions and 236 deletions
  1. 29
    12
      Makefile
  2. 1
    2
      config
  3. 0
    129
      misc/nginx.dev.conf
  4. 0
    93
      misc/nginx.dev.dyn.conf
  5. 15
    0
      test/ngx_confs/nginx.dev.conf
  6. 17
    0
      test/ngx_confs/nginx.dev.dyn.conf
  7. 99
    0
      test/ngx_confs/tnt_server_test.conf

+ 29
- 12
Makefile View File

@@ -1,7 +1,17 @@
CUR_PATH = $(shell pwd)
YAJL_PATH = $(CUR_PATH)/third_party/yajl

NGX_PATH = nginx
NGX_PATH = $(CUR_PATH)/nginx
MODULE_PATH = $(CUR_PATH)
PREFIX_PATH = $(CUR_PATH)/test-root

NGX_CONFIGURE = $(NGX_PATH)/auto/configure
## NginX change configure path, so handle this {{{
ifeq ($(shell [ -e "$(NGX_PATH)/configure" ] && echo 1 || echo 0 ),1)
NGX_CONFIGURE=$(NGX_PATH)/configure
endif
## }}}

MODULE_PATH = $(CUR_PATH)
PREFIX_PATH = $(CUR_PATH)/test-root
INC_FLAGS = -I$(CUR_PATH)/third_party
@@ -16,10 +26,13 @@ DEV_CFLAGS += -ggdb3 -O0 -Wall -Werror
.PHONY: all build
all: build

yajl-dynamic:
ln -sf src third_party/yajl/yajl
cd $(YAJL_PATH); CFLAGS=" $(CFLAGS) -fPIC" ./configure; make distro

yajl:
echo "$(CUR_PATH)" > /dev/null
ln -sf src third_party/yajl/yajl
cd $(YAJL_PATH); CFLAGS=" -fPIC" ./configure; make distro
cd $(YAJL_PATH); ./configure; make distro

gen_version:
$(shell cat $(MODULE_PATH)/src/ngx_http_tnt_version.h.in | sed 's/@VERSION_STRING@/"$(shell git describe --tags --dirty)"/g' > $(MODULE_PATH)/src/ngx_http_tnt_version.h)
@@ -29,33 +42,37 @@ build: gen_version utils

configure:
cd $(NGX_PATH) && \
./auto/configure \
$(NGX_CONFIGURE) \
--with-cc-opt='$(INC_FLAGS)'\
--add-module='$(MODULE_PATH)'

configure-as-dynamic:
cd $(NGX_PATH) && \
./auto/configure --add-dynamic-module='$(MODULE_PATH)'
$(NGX_CONFIGURE) --add-dynamic-module='$(MODULE_PATH)'

configure-debug:
cd $(NGX_PATH) && \
CFLAGS=" -DMY_DEBUG -Wall -Werror -ggdb3 " ./auto/configure \
CFLAGS=" -DMY_DEBUG $(DEV_CFLAGS)" $(NGX_CONFIGURE) \
--prefix=$(PREFIX_PATH) \
--add-module=$(MODULE_PATH) \
--with-debug
mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs
cp -Rf $(CUR_PATH)/misc/nginx.dev.conf $(PREFIX_PATH)/conf/nginx.conf || echo
cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf
cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.conf $(PREFIX_PATH)/conf/nginx.conf

configure-as-dynamic-debug:
cd $(NGX_PATH) && \
CFLAGS=" -DMY_DEBUG -Wall -Werror -ggdb3 " ./auto/configure \
CFLAGS=" -DMY_DEBUG $(DEV_CFLAGS)" $(NGX_CONFIGURE) \
--prefix=$(PREFIX_PATH) \
--add-dynamic-module=$(MODULE_PATH) \
--with-debug
mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs $(PREFIX_PATH)/modules
# cp -f $(CUR_PATH)/nginx/objs/ngx_http_tnt_module.so $(PREFIX_PATH)/modules/ngx_http_tnt_module.so
cp -f $(CUR_PATH)/nginx/objs/ngx_http_tnt_module.so /usr/local/nginx/modules/ngx_http_tnt_module.so
cp -f $(CUR_PATH)/misc/nginx.dev.dyn.conf $(PREFIX_PATH)/conf/nginx.conf
# cp -f $(CUR_PATH)/nginx/objs/ngx_http_tnt_module.so /usr/local/nginx/modules/ngx_http_tnt_module.so
cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.dyn.conf $(PREFIX_PATH)/conf/nginx.conf
cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf

json2tp:
$(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
@@ -101,7 +118,7 @@ clean:
utils: json2tp tp_dump

build-all: yajl configure build utils
build-all-dynamic: yajl configure-as-dynamic build utils
build-all-dynamic: yajl-dynamic configure-as-dynamic build utils

build-all-debug: yajl configure-debug build utils
build-all-dynamic-debug: yajl configure-as-dynamic-debug build utils
build-all-dynamic-debug: yajl-dynamic configure-as-dynamic-debug build utils

+ 1
- 2
config View File

@@ -25,8 +25,7 @@ __headers=" \
$__module_src_dir/tp_transcode.h \
"

__old_style_build=yes
if ! test -n "$ngx_module_link"; then
if [ ! -n "$ngx_module_link" ]; then
__old_style_build=no
fi


+ 0
- 129
misc/nginx.dev.conf View File

@@ -1,129 +0,0 @@
daemon off;
master_process off;
#worker_processes 4;

worker_rlimit_core 500M;

pid logs/nginx.pid;

error_log logs/notice.log notice;
error_log logs/info.log info;
error_log logs/crit.log crit;
error_log logs/debug.log debug;
error_log stderr;

events {}

http {

autoindex off;
access_log off;

include mime.types;
default_type application/octet-stream;

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;

client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;

upstream tnt {
server 127.0.0.1:9999 max_fails=1 fail_timeout=30s;
keepalive 1;
}

server {
listen 8081 default;

server_name tnt_test;

location = /tnt {
tnt_pass tnt;
}

location /echo_2 {
tnt_http_rest_methods get post put;
tnt_pass_http_request on;
tnt_pass tnt;
}

location /preset_method {
tnt_method 'echo_2';
tnt_pass tnt;
}

location = /post_pass_http_request {
tnt_pass_http_request on;
tnt_pass tnt;
}

location /post_preset_method {
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}

location = /echo_2/overflow_rest_api {
tnt_pass_http_request_buffer_size 30;
tnt_pass tnt;
tnt_pass_http_request on;
}

location /overflow_post_pass_http_request {
tnt_pass_http_request_buffer_size 30;
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}

location /rest_api_get {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pass_http_request on;
}

location /rest_api_parse_query_args {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pass_http_request on parse_args;
}

location /echo_2/pure_result_rest {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pure_result on;
}

location /pure_result_rest {
tnt_method 'echo_2';
tnt_http_rest_methods get;
tnt_pure_result on;
tnt_pass tnt;
}

location /pure_result_rest_skip_count_2 {
tnt_method 'echo_2';
tnt_multireturn_skip_count 2;
tnt_http_rest_methods get;
tnt_pure_result on;
tnt_pass tnt;
}

location = /post_pure_result {
tnt_pure_result on;
tnt_pass tnt;
}

location = /post_pure_result_skip_count_1 {
tnt_pure_result on;
tnt_multireturn_skip_count 1;
tnt_pass tnt;
}

}
}

+ 0
- 93
misc/nginx.dev.dyn.conf View File

@@ -1,93 +0,0 @@
daemon off;
master_process off;
#worker_processes 4;

worker_rlimit_core 500M;

pid logs/nginx.pid;

error_log logs/notice.log notice;
error_log logs/info.log info;
error_log logs/crit.log crit;
error_log logs/debug.log debug;
error_log stderr;

load_module modules/ngx_http_tnt_module.so

events {}

http {

autoindex off;
access_log off;

include mime.types;
default_type application/octet-stream;

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;

client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;

upstream tnt {
server 127.0.0.1:9999 max_fails=1 fail_timeout=30s;
keepalive 1;
}

server {
listen 8081 default;

server_name tnt_test;

location = /tnt {
tnt_pass tnt;
}

location /echo_2 {
tnt_http_rest_methods get post put;
tnt_pass_http_request on;
tnt_pass tnt;
}

location /preset_method {
tnt_method 'echo_2';
tnt_pass tnt;
}

location = /post_pass_http_request {
tnt_pass_http_request on;
tnt_pass tnt;
}

location /post_preset_method {
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}

location = /echo_2/overflow_rest_api {
tnt_pass_http_request_buffer_size 30;
tnt_pass tnt;
tnt_pass_http_request on;
}

location /overflow_post_pass_http_request {
tnt_pass_http_request_buffer_size 30;
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}

location /rest_api_get {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pass_http_request on;
}

}
}

+ 15
- 0
test/ngx_confs/nginx.dev.conf View File

@@ -0,0 +1,15 @@
daemon off;
master_process off;
#worker_processes 4;

pid logs/nginx.pid;

error_log logs/notice.log notice;
error_log logs/info.log info;
error_log logs/crit.log crit;
error_log logs/debug.log debug;
error_log stderr;

events {}

include tnt_server_test.conf;

+ 17
- 0
test/ngx_confs/nginx.dev.dyn.conf View File

@@ -0,0 +1,17 @@
daemon off;
master_process off;
#worker_processes 4;

pid logs/nginx.pid;

error_log logs/notice.log notice;
error_log logs/info.log info;
error_log logs/crit.log crit;
error_log logs/debug.log debug;
error_log stderr;

load_module modules/ngx_http_tnt_module.so;

events {}

include tnt_server_test.conf;

+ 99
- 0
test/ngx_confs/tnt_server_test.conf View File

@@ -0,0 +1,99 @@
http {

autoindex off;
access_log off;

include mime.types;
default_type application/octet-stream;

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;

client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;

upstream tnt {
server 127.0.0.1:9999 max_fails=1 fail_timeout=30s;
keepalive 1;
}

server {

listen 8081 default;
server_name tnt_test;

location = /tnt {
tnt_pass tnt;
}
location /echo_2 {
tnt_http_rest_methods get post put;
tnt_pass_http_request on;
tnt_pass tnt;
}
location /preset_method {
tnt_method 'echo_2';
tnt_pass tnt;
}
location = /post_pass_http_request {
tnt_pass_http_request on;
tnt_pass tnt;
}
location /post_preset_method {
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}
location = /echo_2/overflow_rest_api {
tnt_pass_http_request_buffer_size 30;
tnt_pass tnt;
tnt_pass_http_request on;
}
location /overflow_post_pass_http_request {
tnt_pass_http_request_buffer_size 30;
tnt_method 'echo_2';
tnt_pass_http_request on;
tnt_pass tnt;
}
location /rest_api_get {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pass_http_request on;
}
location /rest_api_parse_query_args {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pass_http_request on parse_args;
}
location /echo_2/pure_result_rest {
tnt_http_rest_methods get;
tnt_pass tnt;
tnt_pure_result on;
}
location /pure_result_rest {
tnt_method 'echo_2';
tnt_http_rest_methods get;
tnt_pure_result on;
tnt_pass tnt;
}
location /pure_result_rest_skip_count_2 {
tnt_method 'echo_2';
tnt_multireturn_skip_count 2;
tnt_http_rest_methods get;
tnt_pure_result on;
tnt_pass tnt;
}
location = /post_pure_result {
tnt_pure_result on;
tnt_pass tnt;
}
location = /post_pure_result_skip_count_1 {
tnt_pure_result on;
tnt_multireturn_skip_count 1;
tnt_pass tnt;
}
}
}

Loading…
Cancel
Save