Browse Source

Cleanup openresty

Hamilton Turner 11 years ago
parent
commit
38e3bfce16

+ 1 - 0
frameworks/Lua/lapis/nginx.conf

@@ -13,6 +13,7 @@
         variables_hash_max_size 1024;
         access_log off;
         include mime.types;
+        lua_package_path 'CWD/?.lua;;';
 
         upstream database {
             postgres_server DBHOSTNAME dbname=hello_world user=benchmarkdbuser password=benchmarkdbpass;

+ 1 - 1
frameworks/Lua/openresty/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends openresty nginx
+fw_depends lua nginx openresty 

+ 1 - 1
frameworks/Lua/openresty/nginx.conf

@@ -8,7 +8,7 @@ events {
 http {
     resolver 127.0.0.1;
     access_log off;
-    lua_package_path '/home/tfb/FrameworkBenchmarks/openresty/?.lua;;';
+    lua_package_path 'CWD/?.lua;;';
     init_by_lua 'require "resty.core" encode = require("cjson").encode mysql = require("resty.mysql")';
     server {
         listen       8080;

+ 3 - 3
frameworks/Lua/openresty/setup.py

@@ -4,13 +4,13 @@ import setup_util
 import os
 
 def start(args, logfile, errfile):
-  setup_util.replace_text("openresty/nginx.conf", "CWD", os.getcwd())
+  setup_util.replace_text("openresty/nginx.conf", "CWD", args.troot)
   setup_util.replace_text("openresty/app.lua", "DBHOSTNAME", args.database_host)
-  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
+  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
 
   return 0
 
 def stop(logfile, errfile):
-  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
+  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
 
   return 0

+ 8 - 4
toolset/setup/linux/webservers/openresty.sh

@@ -1,12 +1,16 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists /usr/local/openresty/nginx/sbin/nginx)
+RETCODE=$(fw_exists openresty.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
-fw_depends nginx
+fw_depends nginx lua
+
 fw_get http://openresty.org/download/ngx_openresty-1.5.12.1.tar.gz
 fw_untar ngx_openresty-1.5.12.1.tar.gz
+
 cd ngx_openresty-1.5.12.1
-./configure --with-luajit-xcflags=-DLUAJIT_NUMMODE=2 --with-cc-opt=-O2 --with-http_postgres_module -j2
-make -j2
+./configure --with-luajit-xcflags=-DLUAJIT_NUMMODE=2 --with-cc-opt=-O2 --with-http_postgres_module -j4
+make -j4
 sudo make install
+
+touch $IROOT/openresty.installed