Tobias Begalke 7 anni fa
parent
commit
0a481e1489
6 ha cambiato i file con 92 aggiunte e 1 eliminazioni
  1. 54 0
      build-rpm-centos7.sh
  2. 14 0
      centos7-httpd-lua.conf
  3. 15 0
      centos7-install.sh
  4. 6 0
      default
  5. 1 1
      lua/scw.lua
  6. 2 0
      scw-apache-lua.conf

+ 54 - 0
build-rpm-centos7.sh

@@ -0,0 +1,54 @@
+#!/bin/bash
+
+DESTDIR=./dist
+VERSION=$(git describe --tag | sed 's/^v//')
+ITERATION=1
+NAME=scw-apache-lua
+#BINARY=$NAME
+#DEFAULTS_FILE="$BINARY"
+#CONFIG_FILE="$NAME.toml"
+SERVICE_FILE="$NAME.conf"
+SERVICE_DIR="/etc/systemd/system/httpd.service.d"
+PKG_TYPE=rpm
+DESCR="ScraperWall Integration of Blacklist, Captcha and Apache"
+OUTDIR=./rpms-centos7
+RPM_DIR=/opt/rpm.scraperwall.com/centos7
+
+
+rm -rf $DESTDIR
+install -d $DESTDIR/usr/local/httpd
+install -d $DESTDIR/etc/default
+install -d $DESTDIR/etc/httpd/conf.d
+install -d ${DESTDIR}${SERVICE_DIR}
+
+install -v -m 644 scw-apache-lua.conf ${DESTDIR}${SERVICE_DIR}/${SERVICE_FILE}
+install -v -m 644 centos7-httpd-lua.conf $DESTDIR/etc/httpd/conf.d/scw-apache-lua.conf
+cp -rv lua $DESTDIR/usr/local/httpd
+install -v -m 644 default $DESTDIR/etc/default/$NAME
+
+
+
+fpm -s dir -t $PKG_TYPE -C $DESTDIR --name $NAME \
+  --version $VERSION \
+  --iteration $ITERATION \
+  --description "$DESCR" \
+  --config-files "etc/default/$NAME" \
+  -p $OUTDIR \
+  --rpm-sign
+
+# --rpm-trigger-after-install "[]$BINARY: ./centos7-install.sh" \
+# --rpm-trigger-before-uninstall "[]$BINARY: ./centos7-uninstall.sh" \
+
+ok=$?
+
+rm -rf $DESTDIR
+
+rpm_file="$OUTDIR/$NAME-$VERSION-$ITERATION.x86_64.rpm"
+if [ $ok -eq 0 -a -f "$rpm_file" ]; then
+	# rm -f "$RPM_DIR/$BINARY-*.rpm"
+  cp "$rpm_file" "$RPM_DIR"
+
+	(cd "$RPM_DIR" && \
+   createrepo -v . && \
+   rsync -av --progress --delete . fender.spyz.org:/srv/http-vhosts/rpm.scraperwall.com/centos7/)
+fi

+ 14 - 0
centos7-httpd-lua.conf

@@ -0,0 +1,14 @@
+# diese Module sollten in Centos 7 bereits automatisch geladen sein
+#LoadModule lua_module modules/mod_lua.so
+#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
+
+PassEnv SCW_IGNORE
+PassEnv SCW_KEY
+PassEnv SCW_COOKIE
+PassEnv SCW_CAPTCHA_URL
+PassEnv SCW_REDIS_HOST
+PassEnv SCW_REDIS_PORT
+
+LuaHookTranslateName /usr/local/httpd/lua/scw.lua scw
+LuaScope server
+

+ 15 - 0
centos7-install.sh

@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -ex
+
+yum -y install epel-release
+yum -y update
+
+yum -y install httpd lua lua-devel luarocks lua-socket pcre-devel
+
+luarocks install redis-lua
+luarocks install lua-cjson
+luarocks install lrexlib-pcre
+luarocks install openssl --server=https://rocks.moonscript.org/dev
+
+

+ 6 - 0
default

@@ -0,0 +1,6 @@
+SCW_IGNORE='(^/(captcha|assets).*|\.(png|jpe?g|svg|gif|js|css)$)'
+SCW_KEY='eilghEj25/ku+l5bFOlIDJxWmfKGxoP1po/PxQi6Tb8='
+SCW_COOKIE='tbscw'
+SCW_CAPTCHA_URL='http://docker.scw.systems:8001/captcha?src=%s&r=%s'
+SCW_REDIS_HOST='127.0.0.1'
+SCW_REDIS_PORT='6379'

+ 1 - 1
lua/scw.lua

@@ -2,7 +2,7 @@ require "apache2"
 local redis = require "redis"
 local regex = require "rex_pcre"
 local mime = require "mime"
-local cipher = require "openssl.cipher"
+local cipher = require "openssl".cipher
 
 
 -- --------------------------------------------------------------------------

+ 2 - 0
scw-apache-lua.conf

@@ -0,0 +1,2 @@
+[Service]
+EnvironmentFile=-/etc/default/scw-apache-lua