Support Apache 2.4 for phantomjs test
authorJason Skomorowski <jason@indexdata.com>
Tue, 8 Jul 2014 20:19:22 +0000 (16:19 -0400)
committerJason Skomorowski <jason@indexdata.com>
Tue, 8 Jul 2014 20:19:22 +0000 (16:19 -0400)
test/bin/apache-template-update
tools/apache2/jasmine-dev.apache-modules.ubuntu.conf [new file with mode: 0644]
tools/apache2/jasmine-dev.template-2.4 [new file with mode: 0644]

index f094eae..54d2f8c 100755 (executable)
@@ -17,13 +17,19 @@ export APACHE_LOCK_FILE=$APACHE_LOG_DIR/accept.lock
 export MKWS_ROOT=$(pwd)/..
 
 MKWS_OS=debian 
+APACHE_VERSION=2.2
 case $(uname) in
   Darwin ) MKWS_OS=macos 
           test -e libexec || ln -fs /usr/libexec .
           ;;
   Linux )  MKWS_OS=debian 
           if [ -e /etc/debian_version ]; then
-               MKWS_OS=debian  
+               MKWS_OS=debian
+               # Ubuntu with Apache 2.2 can continue using debian
+               if /usr/bin/dpkg -s apache2 | grep -q "Version: 2\.4\..*ubuntu"; then
+                       MKWS_OS=ubuntu
+                        APACHE_VERSION=2.4
+               fi
           fi
           if [ -e /etc/redhat-release ]; then
                MKWS_OS=centos  
@@ -34,9 +40,13 @@ esac
 
 export APACHE_MODULES="$MKWS_ROOT/tools/apache2/jasmine-dev.apache-modules.$MKWS_OS.conf"
 
-: ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+if [ "$APACHE_VERSION" = "2.4" ]; then
+       : ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template-2.4"}
+else
+       : ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+fi
 : ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev"}
 
+
 perl -npe 's,\${(.*?)},$ENV{$1},g; ' $MKWS_APACHE_TEMPLATE > $MKWS_APACHE_FILE.tmp
 mv -f $MKWS_APACHE_FILE.tmp $MKWS_APACHE_FILE
-
diff --git a/tools/apache2/jasmine-dev.apache-modules.ubuntu.conf b/tools/apache2/jasmine-dev.apache-modules.ubuntu.conf
new file mode 100644 (file)
index 0000000..612d1c1
--- /dev/null
@@ -0,0 +1,19 @@
+Include /etc/apache2/mods-available/alias.load
+Include /etc/apache2/mods-available/authz*.load
+Include /etc/apache2/mods-available/proxy*.load
+Include /etc/apache2/mods-available/rewrite.load
+Include /etc/apache2/mods-available/headers.load
+Include /etc/apache2/mods-available/mime.load
+Include /etc/apache2/mods-available/deflate.load
+
+Include /etc/apache2/mods-available/alias*.conf
+Include /etc/apache2/mods-available/proxy*.conf
+Include /etc/apache2/mods-available/mime.conf
+Include /etc/apache2/mods-available/deflate.conf
+
+Include /etc/apache2/mods-enabled/mpm*conf
+Include /etc/apache2/mods-enabled/mpm*load
+Include /etc/apache2/mods-available/xml2enc.load
+Include /etc/apache2/mods-available/filter.load
+Include /etc/apache2/mods-available/slotmem_shm.load
+
diff --git a/tools/apache2/jasmine-dev.template-2.4 b/tools/apache2/jasmine-dev.template-2.4
new file mode 100644 (file)
index 0000000..6d91adf
--- /dev/null
@@ -0,0 +1,62 @@
+# Configuration for the apache web server                 -*- apache -*-
+
+#####################################################################
+# global apache2 config
+#
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+PidFile ${APACHE_PID_FILE}
+Mutex file:${APACHE_LOG_DIR}
+
+ServerName localhost
+ServerRoot ${APACHE_SERVER_ROOT}
+Listen ${APACHE_PORT}
+
+Include ${APACHE_MODULES}
+
+<IfModule log_config_module>
+   LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+</IfModule>
+
+# pazpar2 / service proxy config
+<VirtualHost *:${APACHE_PORT}>
+    ServerName localhost
+    ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
+
+    ServerAdmin webmaster@indexdata.com
+    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
+    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+    LogLevel info rewrite:debug
+
+    RewriteEngine on
+
+    DocumentRoot ${MKWS_ROOT}/examples/htdocs
+    Alias /tools/htdocs ${MKWS_ROOT}/tools/htdocs
+    Alias /src ${MKWS_ROOT}/src
+    Alias /test ${MKWS_ROOT}/test
+    Alias /jasmine ${MKWS_ROOT}/examples/jasmine
+
+    # CORS setting
+    Header set Access-Control-Allow-Credentials true
+    Header set Access-Control-Allow-Origin "*"
+
+    # compress text output
+    <Location />
+        AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
+        SetOutputFilter DEFLATE 
+    </Location> 
+
+    # jasmine test account
+    RewriteRule /service-proxy-testauth(/)?(;jsessionid=.+)?  /service-proxy/$2?command=auth&action=login&username=mkwstest&password=mkwstest [P]
+
+    # mkws devel account (e.g. memached testing)
+    RewriteRule /service-proxy-auth(/)?(;jsessionid=.+)?  /service-proxy/$2?command=auth&action=login&username=mkwsdev&password=mkwsdev [P]
+
+    ProxyPass        /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
+    ProxyPassReverse /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
+
+    ProxyPass        /pazpar2/         http://localhost:8004/pazpar2/
+    ProxyPassReverse /pazpar2/         http://localhost:8004/pazpar2/
+
+</VirtualHost>
+