Browse Source

Modified installer to add openresty

Patrick Falls 12 years ago
parent
commit
18b0fca9ef
5 changed files with 13 additions and 5 deletions
  1. 8 0
      installer.py
  2. 0 0
      openresty/__init__.py
  3. 1 1
      openresty/benchmark_config
  4. 2 2
      openresty/nginx.conf
  5. 2 2
      openresty/setup.py

+ 8 - 0
installer.py

@@ -132,6 +132,14 @@ class Installer:
     self.__run_command("make", cwd="nginx-1.2.7")
     self.__run_command("sudo make install", cwd="nginx-1.2.7")
     
+    #
+    # Openresty (nginx with openresty stuff)
+    #
+    self.__run_command("curl http://openresty.org/download/ngx_openresty-1.2.7.5.tar.gz | tar xvz")
+    self.__run_command("./configure --with-luajit", cwd="ngx_openresty-1.2.7.5")
+    self.__run_command("make", cwd="ngx_openresty-1.2.7.5")
+    self.__run_command("sudo make install", cwd="ngx_openresty-1.2.7.5")
+    
     #
     # Gunicorn
     #

+ 0 - 0
openresty/__init__.py


+ 1 - 1
openresty/benchmark_config

@@ -7,7 +7,7 @@
       "db_url": "/db",
       "query_url": "/db?queries=",
       "port": 8080,
-      "sort": 42
+      "sort": 50
     }
   }]
 }

+ 2 - 2
openresty/nginx.conf

@@ -1,4 +1,4 @@
-worker_processes  1;
+#worker_processes  1;
 pid        /tmp/nginx.pid;
 error_log /dev/null crit;
 #error_log /tmp/test.log error;
@@ -11,7 +11,7 @@ http {
     server {
         listen       8080;
         location / {
-            content_by_lua_file 'CWD/openresty/app.lua';
+            content_by_lua_file '/home/pfalls/FrameworkBenchmarks/openresty/app.lua';
         }
     }
 }

+ 2 - 2
openresty/setup.py

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