Skip to content

Instantly share code, notes, and snippets.

@western
Last active August 5, 2020 05:33
Show Gist options
  • Save western/c04efe49745f24874c43 to your computer and use it in GitHub Desktop.
Save western/c04efe49745f24874c43 to your computer and use it in GitHub Desktop.

Revisions

  1. Andrew revised this gist Aug 5, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -243,11 +243,11 @@ function redis_get {

    mkdir etc_src ; cd etc_src

    get_arch 'https://github.com/antirez/redis/archive/6.0.3.tar.gz' 'redis-6.0.3.tar.gz' 'redis-6.0.3'
    get_arch 'https://github.com/antirez/redis/archive/6.0.6.tar.gz' 'redis-6.0.6.tar.gz' 'redis-6.0.6'
    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'redis-6.0.3'
    pushd 'redis-6.0.6'

    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.3 install -j$CPUC
    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.6 install -j$CPUC

    popd
    fi
  2. Andrew revised this gist Aug 5, 2020. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -332,7 +332,7 @@ function ngx_module {
    mkdir ngx_module ; cd ngx_module

    get_github 'openresty' 'memc-nginx-module.git'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.16rc5'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.17'
    get_github 'simplresty' 'ngx_devel_kit.git'
    get_github 'openresty' 'redis2-nginx-module.git'
    get_github 'openresty' 'echo-nginx-module.git'
    @@ -353,7 +353,7 @@ function ngx_module {
    get_github 'openresty' 'ngx_postgres.git'
    get_github 'nginx' 'njs.git'

    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.8'
    get_github 'openresty' 'xss-nginx-module.git'

    get_github 'arut' 'nginx-rtmp-module.git'
    @@ -407,9 +407,9 @@ function lua_src {
    mkdir -p /opt/lua_src ; cd /opt/lua_src
    fi

    get_github 'openresty' 'lua-resty-core.git' 'v0.1.17'
    get_github 'openresty' 'lua-resty-lrucache.git' 'v0.09'
    get_github 'openresty' 'lua-cjson.git' '2.1.0.7'
    get_github 'openresty' 'lua-resty-core.git' 'v0.1.19'
    get_github 'openresty' 'lua-resty-lrucache.git' 'v0.10'
    get_github 'openresty' 'lua-cjson.git' '2.1.0.8'

    if [ $IS_GET_ONLY == 0 ]; then
    local LUAJIT2_SRC=""
    @@ -444,7 +444,7 @@ function lua_src {
    popd
    fi
    get_github 'openresty' 'lua-tablepool.git' 'v0.01'
    get_github 'openresty' 'lua-resty-shell.git' 'v0.02'
    get_github 'openresty' 'lua-resty-shell.git' 'v0.03'

    get_github 'openresty' 'lua-resty-limit-traffic.git'
    get_github 'openresty' 'lua-resty-lock.git'
  3. Andrew revised this gist May 24, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -243,11 +243,11 @@ function redis_get {

    mkdir etc_src ; cd etc_src

    get_arch 'https://github.com/antirez/redis/archive/6.0.1.tar.gz' 'redis-6.0.1.tar.gz' 'redis-6.0.1'
    get_arch 'https://github.com/antirez/redis/archive/6.0.3.tar.gz' 'redis-6.0.3.tar.gz' 'redis-6.0.3'
    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'redis-6.0.1'
    pushd 'redis-6.0.3'

    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.1 install -j$CPUC
    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.3 install -j$CPUC

    popd
    fi
  4. Andrew revised this gist May 13, 2020. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -244,12 +244,13 @@ function redis_get {
    mkdir etc_src ; cd etc_src

    get_arch 'https://github.com/antirez/redis/archive/6.0.1.tar.gz' 'redis-6.0.1.tar.gz' 'redis-6.0.1'
    pushd 'redis-6.0.1'

    #make BUILD_TLS=yes -j$CPUC
    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.1 install -j$CPUC

    popd
    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'redis-6.0.1'

    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.1 install -j$CPUC

    popd
    fi

    cd $PARENTF
    }
  5. Andrew revised this gist May 11, 2020. 1 changed file with 37 additions and 10 deletions.
    47 changes: 37 additions & 10 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,9 @@
    CPUC=`cat /proc/cpuinfo | grep processor | wc -l`
    CPUC=$((CPUC-1))
    PARENTF=`pwd`
    BUILDF="$PARENTF/build"
    NGINXV='nginx-1.18.0'
    IS_LOCAL=0
    IS_LOCAL=1
    IS_PAUSED=0
    IS_GET_ONLY=1

    @@ -47,6 +48,8 @@ function prepare_for_archive {

    notice "prepare_for_archive"

    cd $PARENTF

    find . -type d -name '.git' -not -path "./.git" | xargs rm -rf
    find . -type d -name '.git' -not -path "./.git"

    @@ -169,8 +172,8 @@ function postgres_get {


    if [ $IS_LOCAL == 1 ]; then
    PREFIX="$PARENTF/build/pgsql-12.2"
    DATADIR="$PARENTF/build/pgsql-12.2/data"
    PREFIX="$BUILDF/pgsql-12.2"
    DATADIR="$BUILDF/pgsql-12.2/data"

    rm -rf $PREFIX

    @@ -244,7 +247,7 @@ function redis_get {
    pushd 'redis-6.0.1'

    #make BUILD_TLS=yes -j$CPUC
    make BUILD_TLS=yes PREFIX=$PARENTF/build/redis-6.0.1 install -j$CPUC
    make BUILD_TLS=yes PREFIX=$BUILDF/redis-6.0.1 install -j$CPUC

    popd

    @@ -295,6 +298,25 @@ function etc_src {
    popd
    fi

    get_arch 'https://github.com/SpiderLabs/ModSecurity/releases/download/v3.0.4/modsecurity-v3.0.4.tar.gz' 'modsecurity-v3.0.4.tar.gz' 'modsecurity-v3.0.4'

    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'modsecurity-v3.0.4'

    rm .gitignore
    make clean

    if [ $IS_LOCAL == 1 ]; then
    ./configure --prefix=$BUILDF/modsecurity
    else
    # /usr/local/modsecurity
    ./configure
    fi

    make install -j$CPUC
    popd
    fi

    get_github 'giltene' 'wrk2.git'

    cd $PARENTF
    @@ -319,6 +341,7 @@ function ngx_module {
    get_github 'FRiCKLE' 'ngx_cache_purge.git'
    get_github 'openresty' 'headers-more-nginx-module.git'
    get_github 'nbs-system' 'naxsi.git'
    get_github 'SpiderLabs' 'ModSecurity-nginx.git'

    get_github 'openresty' 'replace-filter-nginx-module.git'
    get_github 'openresty' 'rds-json-nginx-module.git'
    @@ -544,8 +567,8 @@ function make_configure {
    local LUA_SSL_NGINX_MODULE=""

    if [ $IS_LOCAL == 1 ]; then
    mkdir -p $PARENTF/build/{tmp,proxy,fastcgi,uwsgi,scgi}
    PREFIX="$PARENTF/build/"
    mkdir -p $BUILDF/{tmp,proxy,fastcgi,uwsgi,scgi}
    PREFIX="$BUILDF/"
    CONF_PATH="$PREFIX/conf/nginx.conf"
    PID_PATH="$PREFIX/logs/nginx.pid"
    ERROR_LOG="$PREFIX/logs/error.log"
    @@ -631,6 +654,7 @@ cat << L10HEREDOC > ngx_src/$NGINXV/nginx_configuration
    --add-module=../../ngx_module/ngx_cache_purge.git/ \\
    --add-module=../../ngx_module/headers-more-nginx-module.git/ \\
    --add-module=../../ngx_module/naxsi.git/naxsi_src/ \\
    --add-module=../../ngx_module/ModSecurity-nginx.git/ \\
    --add-module=../../ngx_module/replace-filter-nginx-module.git/ \\
    --add-module=../../ngx_module/rds-json-nginx-module.git/ \\
    --add-module=../../ngx_module/rds-csv-nginx-module.git/ \\
    @@ -651,12 +675,15 @@ L10HEREDOC
    echo "unset LUAJIT_LIB && unset LUAJIT_INC"
    echo "unset SREGEX_LIB && unset SREGEX_INC"
    echo "unset LIBDRIZZLE_INC && unset LIBDRIZZLE_LIB"
    echo "unset MODSECURITY_INC && unset MODSECURITY_LIB"
    echo
    echo "export LUAJIT_LIB=$LUAJIT2_BUILD_LIB && export LUAJIT_INC=$LUAJIT2_SRC"

    if [ $IS_LOCAL == 1 ]; then
    echo "export SREGEX_LIB=$PARENTF/etc_src/sregex.git/build/lib && export SREGEX_INC=$PARENTF/etc_src/sregex.git/src"
    echo "export LIBDRIZZLE_INC=$PARENTF/etc_src/drizzle7-2011.07.21/build/include/libdrizzle-1.0 && export LIBDRIZZLE_LIB=$PARENTF/etc_src/drizzle7-2011.07.21/build/lib64/"
    echo "export MODSECURITY_INC=$BUILDF/modsecurity/include/"
    echo "export MODSECURITY_LIB=$BUILDF/modsecurity/lib64/"
    fi
    echo

    @@ -810,10 +837,10 @@ function get_arch {
    wget $getUrl -O $fileName
    fi

    if [ -d $folderName ]; then
    notice "rm rf $folderName"
    rm -rf $folderName
    fi
    #if [ -d $folderName ]; then
    # notice "rm rf $folderName"
    # rm -rf $folderName
    #fi



  6. Andrew revised this gist May 10, 2020. 1 changed file with 27 additions and 10 deletions.
    37 changes: 27 additions & 10 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    # save and run
    # . nginx_builder

    CPUC=`cat /proc/cpuinfo | grep processor | wc -l`
    CPUC=$((CPUC-1))
    PARENTF=`pwd`
    NGINXV='nginx-1.18.0'
    IS_LOCAL=0
    @@ -22,6 +24,7 @@ function main {

    #root_prepare
    #postgres_get
    #redis_get

    etc_src
    ngx_module
    @@ -166,8 +169,8 @@ function postgres_get {


    if [ $IS_LOCAL == 1 ]; then
    PREFIX="$PARENTF/pgsql-12.2"
    DATADIR="$PARENTF/pgsql-12.2/data"
    PREFIX="$PARENTF/build/pgsql-12.2"
    DATADIR="$PARENTF/build/pgsql-12.2/data"

    rm -rf $PREFIX

    @@ -186,12 +189,7 @@ function postgres_get {
    chown postgres:postgres $DATADIR
    fi

    if [ ! -f $POSTGRESV.tar.gz ]; then
    wget "https://ftp.postgresql.org/pub/source/v12.2/$POSTGRESV.tar.gz"
    fi

    tar xf $POSTGRESV.tar.gz

    get_arch "https://ftp.postgresql.org/pub/source/v12.2/$POSTGRESV.tar.gz" "$POSTGRESV.tar.gz" $POSTGRESV
    pushd $POSTGRESV
    ./configure --prefix=$PREFIX && make install -j4
    popd
    @@ -236,6 +234,25 @@ function postgres_get {

    # ------------------------------------------------------------------------------

    function redis_get {

    notice "redis_get"

    mkdir etc_src ; cd etc_src

    get_arch 'https://github.com/antirez/redis/archive/6.0.1.tar.gz' 'redis-6.0.1.tar.gz' 'redis-6.0.1'
    pushd 'redis-6.0.1'

    #make BUILD_TLS=yes -j$CPUC
    make BUILD_TLS=yes PREFIX=$PARENTF/build/redis-6.0.1 install -j$CPUC

    popd

    cd $PARENTF
    }

    # ------------------------------------------------------------------------------

    function etc_src {

    notice "etc_src"
    @@ -789,8 +806,8 @@ function get_arch {
    local folderName=$3

    if [ ! -f $fileName ]; then
    notice "wget $getUrl"
    wget $getUrl
    notice "wget $getUrl -O $fileName"
    wget $getUrl -O $fileName
    fi

    if [ -d $folderName ]; then
  7. Andrew revised this gist May 9, 2020. 1 changed file with 191 additions and 214 deletions.
    405 changes: 191 additions & 214 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -7,33 +7,35 @@ PARENTF=`pwd`
    NGINXV='nginx-1.18.0'
    IS_LOCAL=0
    IS_PAUSED=0
    IS_GET_ONLY=1


    function main {
    notice "builder for $NGINXV"
    notice "from parent folder $PARENTF"

    if [ $IS_LOCAL == 1 ]; then
    warn "run for LOCAL operations"
    fi
    warn "IS_LOCAL $IS_LOCAL"
    warn "IS_PAUSED $IS_PAUSED"
    warn "IS_GET_ONLY $IS_GET_ONLY"

    rm versions

    root_prepare
    #root_prepare
    #postgres_get

    repo_get
    luajit2_git_prepare
    lua_addition_prepare
    etc_src
    ngx_module
    luajit2_prepare
    lua_src
    openssl_get
    nginx_get
    make_configure
    ngx_src
    #make_configure

    #make_nginx_service
    #make_postgres_service
    #make_nginx_tmpfile

    #prepare_for_archive
    prepare_for_archive
    }

    # ------------------------------------------------------------------------------
    @@ -42,56 +44,10 @@ function prepare_for_archive {

    notice "prepare_for_archive"

    for mfold in echo-nginx-module.git form-input-nginx-module.git headers-more-nginx-module.git \
    lua-nginx-module.git memc-nginx-module.git naxsi.git sregex.git \
    replace-filter-nginx-module.git drizzle-nginx-module.git rds-json-nginx-module.git rds-csv-nginx-module.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git xss-nginx-module.git nginx-rtmp-module.git \
    nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    redis2-nginx-module.git set-misc-nginx-module.git
    do
    warn "remove [$mfold/.git] folder"
    rm -rf "$mfold/.git"
    done

    if [ $IS_LOCAL == 1 ]; then
    pushd 'opt'
    for mfold in lua-cjson.git lua-resty-cookie.git lua-resty-core.git lua-resty-lrucache.git \
    lua-resty-mysql.git lua-resty-redis.git lua-ssl-nginx-module.git \
    lua-resty-signal.git lua-tablepool.git lua-resty-shell.git \
    lua-resty-limit-traffic.git lua-resty-lock.git lua-resty-string.git lua-resty-upload.git \
    lua-resty-websocket.git lua-resty-upstream-healthcheck.git \
    luajit2.git
    do
    warn "remove [$mfold/.git] folder"
    rm -rf "$mfold/.git"
    done
    popd
    fi

    pushd 'opt/luajit2.git'
    warn `pwd`
    rm -rf build ; mkdir build
    make clean
    popd
    pushd 'sregex.git'
    warn `pwd`
    rm -rf build ; mkdir build
    make clean
    popd
    pushd 'opt/lua-cjson.git'
    warn `pwd`
    make clean
    popd


    rm -rf $NGINXV
    tar xf $NGINXV.tar.gz
    find . -type d -name '.git' -not -path "./.git" | xargs rm -rf
    find . -type d -name '.git' -not -path "./.git"

    rm -rf drizzle7-2011.07.21
    tar xf drizzle7-2011.07.21.tar.gz

    rm -rf openssl-OpenSSL_1_1_1g
    tar xf OpenSSL_1_1_1g.tar.gz
    cd $PARENTF
    }

    # ------------------------------------------------------------------------------
    @@ -280,147 +236,172 @@ function postgres_get {

    # ------------------------------------------------------------------------------

    function repo_get {
    function etc_src {

    notice "etc_src"

    mkdir etc_src ; cd etc_src

    get_github 'openresty' 'sregex.git'

    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'sregex.git'
    make clean
    rm -rf build ; mkdir build

    if [ $IS_LOCAL == 1 ]; then
    make -j4 PREFIX=$PARENTF/etc_src/sregex.git/build
    make install PREFIX=$PARENTF/etc_src/sregex.git/build
    else
    make -j4
    make install
    fi
    ldconfig
    popd
    fi

    get_arch 'https://openresty.org/download/drizzle7-2011.07.21.tar.gz' 'drizzle7-2011.07.21.tar.gz' 'drizzle7-2011.07.21'

    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'drizzle7-2011.07.21'
    rm -rf build ; mkdir build

    if [ $IS_LOCAL == 1 ]; then
    ./configure --without-server --prefix=$PARENTF/etc_src/drizzle7-2011.07.21/build
    else
    ./configure --without-server
    fi

    make libdrizzle-1.0 -j4
    make install-libdrizzle-1.0 -j4
    ldconfig
    popd
    fi

    get_github 'giltene' 'wrk2.git'

    cd $PARENTF
    }

    # ------------------------------------------------------------------------------

    function ngx_module {

    notice "ngx_module"

    notice "repo_get"
    mkdir ngx_module ; cd ngx_module

    get_github 'openresty' 'memc-nginx-module.git'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.16rc5'
    get_github 'simplresty' 'ngx_devel_kit.git'
    get_github 'openresty' 'redis2-nginx-module.git'
    get_github 'openresty' 'echo-nginx-module.git'
    get_github 'calio' 'form-input-nginx-module.git'
    get_github 'calio' 'form-input-nginx-module.git'
    get_github 'openresty' 'set-misc-nginx-module.git'
    get_github 'Austinb' 'nginx-upload-module.git'
    get_github 'FRiCKLE' 'ngx_cache_purge.git'
    get_github 'Austinb' 'nginx-upload-module.git'
    get_github 'FRiCKLE' 'ngx_cache_purge.git'
    get_github 'openresty' 'headers-more-nginx-module.git'
    get_github 'nbs-system' 'naxsi.git'
    get_github 'openresty' 'sregex.git'

    pushd 'sregex.git'
    make clean
    rm -rf build ; mkdir build

    if [ $IS_LOCAL == 1 ]; then
    make -j4 PREFIX=$PARENTF/sregex.git/build
    make install PREFIX=$PARENTF/sregex.git/build
    else
    make -j4
    make install
    fi
    ldconfig
    popd

    get_github 'openresty' 'replace-filter-nginx-module.git'
    get_github 'openresty' 'drizzle-nginx-module.git'

    if [ ! -f drizzle7-2011.07.21.tar.gz ]; then
    wget https://openresty.org/download/drizzle7-2011.07.21.tar.gz
    fi

    tar xf drizzle7-2011.07.21.tar.gz

    pushd 'drizzle7-2011.07.21'
    rm -rf build ; mkdir build

    if [ $IS_LOCAL == 1 ]; then
    ./configure --without-server --prefix=$PARENTF/drizzle7-2011.07.21/build
    else
    ./configure --without-server
    fi

    make libdrizzle-1.0 -j4
    make install-libdrizzle-1.0 -j4
    ldconfig
    popd

    get_github 'openresty' 'rds-json-nginx-module.git'
    get_github 'openresty' 'rds-csv-nginx-module.git'

    get_github 'openresty' 'drizzle-nginx-module.git'

    get_github 'openresty' 'ngx_postgres.git'
    get_github 'nginx' 'njs.git'
    get_github 'nginx' 'njs.git'

    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    get_github 'openresty' 'xss-nginx-module.git'

    get_github 'arut' 'nginx-rtmp-module.git'
    get_github 'arut' 'nginx-ts-module.git'

    cd $PARENTF
    }

    # ------------------------------------------------------------------------------

    function luajit2_git_prepare {
    function luajit2_prepare {

    notice "luajit2_git_prepare"
    notice "luajit2_prepare"

    if [ $IS_LOCAL == 1 ]; then
    mkdir opt ; cd opt
    mkdir lua_src ; cd lua_src
    else
    cd /opt
    mkdir -p /opt/lua_src ; cd /opt/lua_src
    fi

    get_github 'openresty' 'luajit2.git'
    pushd 'luajit2.git'

    make clean
    mkdir build

    if [ $IS_LOCAL == 1 ]; then
    make -j4 PREFIX=$PARENTF/opt/luajit2.git/build
    make install PREFIX=$PARENTF/opt/luajit2.git/build
    else
    make -j4 PREFIX=/opt/luajit2.git/build
    make install PREFIX=/opt/luajit2.git/build
    fi
    popd
    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'luajit2.git'

    make clean
    mkdir build

    if [ $IS_LOCAL == 1 ]; then
    make -j4 PREFIX=$PARENTF/lua_src/luajit2.git/build
    make install PREFIX=$PARENTF/lua_src/luajit2.git/build
    else
    make -j4 PREFIX=/opt/lua_src/luajit2.git/build
    make install PREFIX=/opt/lua_src/luajit2.git/build
    fi
    popd
    fi

    cd $PARENTF
    }

    # ------------------------------------------------------------------------------

    function lua_addition_prepare {
    function lua_src {

    notice "lua_addition_prepare"
    notice "lua_src"


    if [ $IS_LOCAL == 1 ]; then
    mkdir opt ; cd opt
    mkdir lua_src ; cd lua_src
    else
    cd /opt
    mkdir -p /opt/lua_src ; cd /opt/lua_src
    fi

    get_github 'openresty' 'lua-resty-core.git' 'v0.1.17'
    get_github 'openresty' 'lua-resty-lrucache.git' 'v0.09'
    get_github 'openresty' 'lua-cjson.git' '2.1.0.7'

    local LUAJIT2_SRC=""
    if [ $IS_LOCAL == 1 ]; then
    LUAJIT2_SRC="$PARENTF/opt/luajit2.git/src"
    else
    LUAJIT2_SRC="/opt/luajit2.git/src"
    fi

    pushd 'lua-cjson.git'
    echo
    echo "export LUA_INCLUDE_DIR=\"$LUAJIT2_SRC\" && make -j4"
    echo
    export LUA_INCLUDE_DIR="$LUAJIT2_SRC" && make -j4

    if [ $IS_PAUSED == 1 ]; then
    read -p "Press [Enter] key to continue..."
    if [ $IS_GET_ONLY == 0 ]; then
    local LUAJIT2_SRC=""
    if [ $IS_LOCAL == 1 ]; then
    LUAJIT2_SRC="$PARENTF/lua_src/luajit2.git/src"
    else
    LUAJIT2_SRC="/opt/lua_src/luajit2.git/src"
    fi
    popd

    pushd 'lua-cjson.git'
    echo
    echo "export LUA_INCLUDE_DIR=\"$LUAJIT2_SRC\" && make -j4"
    echo
    export LUA_INCLUDE_DIR="$LUAJIT2_SRC" && make -j4

    if [ $IS_PAUSED == 1 ]; then
    read -p "Press [Enter] key to continue..."
    fi
    popd
    fi

    get_github 'openresty' 'lua-resty-redis.git'
    get_github 'cloudflare' 'lua-resty-cookie.git'
    get_github 'openresty' 'lua-resty-mysql.git'
    get_github 'openresty' 'lua-ssl-nginx-module.git'

    get_github 'openresty' 'lua-resty-signal.git' 'v0.02'
    pushd 'lua-resty-signal.git'
    make clean
    make
    popd
    if [ $IS_GET_ONLY == 0 ]; then
    pushd 'lua-resty-signal.git'
    make clean
    make
    popd
    fi
    get_github 'openresty' 'lua-tablepool.git' 'v0.01'
    get_github 'openresty' 'lua-resty-shell.git' 'v0.02'

    @@ -434,36 +415,36 @@ function lua_addition_prepare {
    echo
    notice "save these strings:"
    if [ $IS_LOCAL == 1 ]; then
    local LB="$PARENTF/opt/lua-resty-core.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-ssl-nginx-module.git/lualib/?.lua;"
    local LB="$PARENTF/lua_src/lua-resty-core.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-resty-redis.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-ssl-nginx-module.git/lualib/?.lua;"

    LB="$LB$PARENTF/opt/lua-resty-signal.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-tablepool.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-shell.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-resty-signal.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-tablepool.git/lib/?.lua;"
    LB="$LB$PARENTF/lua_src/lua-resty-shell.git/lib/?.lua;"

    local CLB="$PARENTF/opt/lua-cjson.git/?.so;"
    CLB="$CLB$PARENTF/opt/lua-resty-signal.git/?.so;"
    local CLB="$PARENTF/lua_src/lua-cjson.git/?.so;"
    CLB="$CLB$PARENTF/lua_src/lua-resty-signal.git/?.so;"

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    echo "lua_package_path \"$LB;\";" > "$PARENTF/lua_package_path"
    echo "lua_package_cpath \"$CLB;\";" >> "$PARENTF/lua_package_path"
    else
    local LB="/opt/lua-resty-core.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB/opt/lua-ssl-nginx-module.git/lualib/?.lua;"
    local LB="/opt/lua_src/lua-resty-core.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-resty-redis.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-ssl-nginx-module.git/lualib/?.lua;"

    LB="$LB/opt/lua-resty-signal.git/lib/?.lua;"
    LB="$LB/opt/lua-tablepool.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-shell.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-resty-signal.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-tablepool.git/lib/?.lua;"
    LB="$LB/opt/lua_src/lua-resty-shell.git/lib/?.lua;"

    local CLB="/opt/lua-cjson.git/?.so;"
    CLB="$CLB/opt/lua-resty-signal.git/?.so;"
    local CLB="/opt/lua_src/lua-cjson.git/?.so;"
    CLB="$CLB/opt/lua_src/lua-resty-signal.git/?.so;"

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    @@ -485,13 +466,11 @@ function openssl_get {

    notice "openssl_get"

    rm -rf openssl-OpenSSL_1_1_1g
    mkdir etc_src ; cd etc_src

    if [ ! -f OpenSSL_1_1_1g.tar.gz ]; then
    wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz
    fi
    get_arch 'https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz' 'OpenSSL_1_1_1g.tar.gz' 'openssl-OpenSSL_1_1_1g'

    tar xf OpenSSL_1_1_1g.tar.gz
    cd $PARENTF
    }

    # ------------------------------------------------------------------------------
    @@ -515,17 +494,16 @@ function openssl_generate_localhost {

    # ------------------------------------------------------------------------------

    function nginx_get {
    function ngx_src {

    notice "nginx_get"
    notice "ngx_src"

    rm -rf $NGINXV
    mkdir ngx_src ; cd ngx_src

    if [ ! -f $NGINXV.tar.gz ]; then
    wget https://nginx.org/download/$NGINXV.tar.gz
    fi
    get_arch "https://nginx.org/download/nginx-1.16.1.tar.gz" "nginx-1.16.1.tar.gz" "nginx-1.16.1"
    get_arch "https://nginx.org/download/$NGINXV.tar.gz" "$NGINXV.tar.gz" $NGINXV

    tar xf $NGINXV.tar.gz
    cd $PARENTF
    }

    # ------------------------------------------------------------------------------
    @@ -560,9 +538,9 @@ function make_configure {
    FASTCGI_TEMP_PATH="$PREFIX/fastcgi/"
    UWSGI_TEMP_PATH="$PREFIX/uwsgi/"
    SCGI_TEMP_PATH="$PREFIX/scgi/"
    LUAJIT2_BUILD_LIB="$PARENTF/opt/luajit2.git/build/lib"
    LUAJIT2_SRC="$PARENTF/opt/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="$PARENTF/opt/lua-ssl-nginx-module.git/"
    LUAJIT2_BUILD_LIB="$PARENTF/lua_src/luajit2.git/build/lib"
    LUAJIT2_SRC="$PARENTF/lua_src/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="$PARENTF/lua_src/lua-ssl-nginx-module.git/"
    else
    PREFIX="/usr/local/$NGINXV"
    CONF_PATH="/etc/$NGINXV/nginx.conf"
    @@ -574,18 +552,18 @@ function make_configure {
    FASTCGI_TEMP_PATH="/var/lib/nginx/fastcgi/"
    UWSGI_TEMP_PATH="/var/lib/nginx/uwsgi/"
    SCGI_TEMP_PATH="/var/lib/nginx/scgi/"
    LUAJIT2_BUILD_LIB="/opt/luajit2.git/build/lib"
    LUAJIT2_SRC="/opt/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="/opt/lua-ssl-nginx-module.git/"
    LUAJIT2_BUILD_LIB="/opt/lua_src/luajit2.git/build/lib"
    LUAJIT2_SRC="/opt/lua_src/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="/opt/lua_src/lua-ssl-nginx-module.git/"
    fi

    WITH_OPENSSL=""
    if [ -d openssl-OpenSSL_1_1_1g ]; then
    WITH_OPENSSL="--with-openssl=$PARENTF/openssl-OpenSSL_1_1_1g --with-openssl-opt='enable-tls1_3'"
    WITH_OPENSSL="--with-openssl=$PARENTF/etc_src/openssl-OpenSSL_1_1_1g --with-openssl-opt='enable-tls1_3'"
    fi


    cat << L10HEREDOC > $NGINXV/nginx_configuration
    cat << L10HEREDOC > ngx_src/$NGINXV/nginx_configuration
    #!/bin/bash
    ./configure \\
    @@ -625,32 +603,32 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --with-pcre \\
    --with-pcre-jit \\
    --with-libatomic \\
    --add-module=../memc-nginx-module.git/ \\
    --add-module=../lua-nginx-module.git/ \\
    --add-module=../ngx_devel_kit.git/ \\
    --add-module=../redis2-nginx-module.git/ \\
    --add-module=../echo-nginx-module.git/ \\
    --add-module=../form-input-nginx-module.git/ \\
    --add-module=../set-misc-nginx-module.git/ \\
    --add-module=../nginx-upload-module.git/ \\
    --add-module=../ngx_cache_purge.git/ \\
    --add-module=../headers-more-nginx-module.git/ \\
    --add-module=../naxsi.git/naxsi_src/ \\
    --add-module=../replace-filter-nginx-module.git/ \\
    --add-module=../rds-json-nginx-module.git/ \\
    --add-module=../rds-csv-nginx-module.git/ \\
    --add-module=../drizzle-nginx-module.git/ \\
    --add-module=../ngx_postgres.git/ \\
    --add-module=../njs.git/nginx/ \\
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    --add-module=../nginx-rtmp-module.git/ \\
    --add-module=../nginx-ts-module.git/ \\
    --add-module=../../ngx_module/memc-nginx-module.git/ \\
    --add-module=../../ngx_module/lua-nginx-module.git/ \\
    --add-module=../../ngx_module/ngx_devel_kit.git/ \\
    --add-module=../../ngx_module/redis2-nginx-module.git/ \\
    --add-module=../../ngx_module/echo-nginx-module.git/ \\
    --add-module=../../ngx_module/form-input-nginx-module.git/ \\
    --add-module=../../ngx_module/set-misc-nginx-module.git/ \\
    --add-module=../../ngx_module/nginx-upload-module.git/ \\
    --add-module=../../ngx_module/ngx_cache_purge.git/ \\
    --add-module=../../ngx_module/headers-more-nginx-module.git/ \\
    --add-module=../../ngx_module/naxsi.git/naxsi_src/ \\
    --add-module=../../ngx_module/replace-filter-nginx-module.git/ \\
    --add-module=../../ngx_module/rds-json-nginx-module.git/ \\
    --add-module=../../ngx_module/rds-csv-nginx-module.git/ \\
    --add-module=../../ngx_module/drizzle-nginx-module.git/ \\
    --add-module=../../ngx_module/ngx_postgres.git/ \\
    --add-module=../../ngx_module/njs.git/nginx/ \\
    --add-module=../../ngx_module/stream-lua-nginx-module.git/ \\
    --add-module=../../ngx_module/xss-nginx-module.git/ \\
    --add-module=../../ngx_module/nginx-rtmp-module.git/ \\
    --add-module=../../ngx_module/nginx-ts-module.git/ \\
    --add-module=$LUA_SSL_NGINX_MODULE \\
    L10HEREDOC

    chmod +x "$NGINXV/nginx_configuration"
    chmod +x "ngx_src/$NGINXV/nginx_configuration"

    notice "export these environment:"
    echo "unset LUAJIT_LIB && unset LUAJIT_INC"
    @@ -660,16 +638,15 @@ L10HEREDOC
    echo "export LUAJIT_LIB=$LUAJIT2_BUILD_LIB && export LUAJIT_INC=$LUAJIT2_SRC"

    if [ $IS_LOCAL == 1 ]; then
    echo "export SREGEX_LIB=../sregex.git/build/lib && export SREGEX_INC=../sregex.git/src"
    echo "export LIBDRIZZLE_INC=../drizzle7-2011.07.21/build/include/libdrizzle-1.0 && export LIBDRIZZLE_LIB=../drizzle7-2011.07.21/build/lib64/"
    echo "export SREGEX_LIB=$PARENTF/etc_src/sregex.git/build/lib && export SREGEX_INC=$PARENTF/etc_src/sregex.git/src"
    echo "export LIBDRIZZLE_INC=$PARENTF/etc_src/drizzle7-2011.07.21/build/include/libdrizzle-1.0 && export LIBDRIZZLE_LIB=$PARENTF/etc_src/drizzle7-2011.07.21/build/lib64/"
    fi
    notice

    echo

    notice 'run ./nginx_configuration'
    notice 'make -j4 && make install'
    notice 'make install -j4'

    cd $NGINXV && exec bash
    cd ngx_src/$NGINXV && exec bash
    }

    # ------------------------------------------------------------------------------
    @@ -812,12 +789,12 @@ function get_arch {
    local folderName=$3

    if [ ! -f $fileName ]; then
    notice "wget"
    notice "wget $getUrl"
    wget $getUrl
    fi

    if [ -d $folderName ]; then
    notice "rm rf"
    notice "rm rf $folderName"
    rm -rf $folderName
    fi

    @@ -828,7 +805,7 @@ function get_arch {
    unzip $fileName
    fi

    if [[ ! -d $folderName ]] && [[ $fileName =~ ".tar.gz" ]]; then
    if [[ ! -d $folderName ]] && [[ $fileName =~ ".tar." ]]; then
    notice "tar xf"
    tar xf $fileName
    fi
  8. Andrew revised this gist May 4, 2020. 1 changed file with 90 additions and 2 deletions.
    92 changes: 90 additions & 2 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -803,10 +803,58 @@ L12HEREDOC

    # ------------------------------------------------------------------------------

    # get_arch 'https://domain.tld/archive.tar.gz' 'archive.tar.gz' 'folder'

    function get_arch {
    notice "get_arch [$1] FILE [$2] FOLD [$3]"
    local getUrl=$1
    local fileName=$2
    local folderName=$3

    if [ ! -f $fileName ]; then
    notice "wget"
    wget $getUrl
    fi

    if [ -d $folderName ]; then
    notice "rm rf"
    rm -rf $folderName
    fi



    if [ ! -d $folderName ] && [[ $fileName =~ ".zip" ]]; then
    notice "unzip"
    unzip $fileName
    fi

    if [[ ! -d $folderName ]] && [[ $fileName =~ ".tar.gz" ]]; then
    notice "tar xf"
    tar xf $fileName
    fi



    if [ ! -f $fileName ]; then
    err "get_arch: file $fileName is not exists"
    fi

    if [ ! -d $folderName ]; then
    err "get_arch: folder $folderName is not exists"
    fi
    }

    # ------------------------------------------------------------------------------

    # get_github 'user' 'project.git'
    # get_github 'user' 'project.git' 'branch'
    #
    # project 'project.git' save to similar folder 'project.git'

    function get_github {
    notice "https://github.com/$1/$2"
    notice "get_github https://github.com/$1/$2"
    local folderName=$2
    local branch=$3
    local branch=$3

    if [ -d $folderName ]; then
    cd $folderName
    @@ -822,6 +870,10 @@ function get_github {
    fi
    fi

    if [ ! -d $folderName ]; then
    err "get_github: folder $folderName is not exists"
    fi

    echo "https://github.com/$1/$folderName" >> "$PARENTF/versions"

    pushd $folderName
    @@ -832,6 +884,42 @@ function get_github {

    # ------------------------------------------------------------------------------

    # get_gitany 'https://domain.tld/anypath' 'folder.git'
    # get_gitany 'https://domain.tld/anypath' 'folder.git' 'branch'

    function get_gitany {
    notice "get_gitany $1 to $2"
    local folderName=$2
    local branch=$3

    if [ -d $folderName ]; then
    pushd $folderName
    pwd
    git pull
    popd
    else
    if [ "$branch" == "" ]; then
    git clone $1 $folderName
    else
    warn "branch $branch"
    git clone -b $branch $1 $folderName
    fi
    fi

    if [ ! -d $folderName ]; then
    err "get_gitany: folder $folderName is not exists"
    fi

    echo "$1" >> "$PARENTF/versions"

    pushd $folderName
    git describe --tags --abbrev=0
    echo `git describe --tags --abbrev=0` >> "$PARENTF/versions"
    popd
    }

    # ------------------------------------------------------------------------------

    function notice {
    builtin echo -en "\033[1m"
    echo "NOTICE: $@"
  9. Andrew revised this gist Apr 28, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -285,7 +285,7 @@ function repo_get {
    notice "repo_get"

    get_github 'openresty' 'memc-nginx-module.git'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.15'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.16rc5'
    get_github 'simplresty' 'ngx_devel_kit.git'
    get_github 'openresty' 'redis2-nginx-module.git'
    get_github 'openresty' 'echo-nginx-module.git'
  10. Andrew revised this gist Apr 27, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -342,6 +342,7 @@ function repo_get {
    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    get_github 'openresty' 'xss-nginx-module.git'
    get_github 'arut' 'nginx-rtmp-module.git'
    get_github 'arut' 'nginx-ts-module.git'

    }

    @@ -644,6 +645,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    --add-module=../nginx-rtmp-module.git/ \\
    --add-module=../nginx-ts-module.git/ \\
    --add-module=$LUA_SSL_NGINX_MODULE \\
    L10HEREDOC
  11. Andrew revised this gist Apr 22, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # . nginx_builder

    PARENTF=`pwd`
    NGINXV='nginx-1.16.1'
    NGINXV='nginx-1.18.0'
    IS_LOCAL=0
    IS_PAUSED=0

  12. Andrew revised this gist Apr 21, 2020. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -90,8 +90,8 @@ function prepare_for_archive {
    rm -rf drizzle7-2011.07.21
    tar xf drizzle7-2011.07.21.tar.gz

    rm -rf openssl-OpenSSL_1_1_1d
    tar xf OpenSSL_1_1_1d.tar.gz
    rm -rf openssl-OpenSSL_1_1_1g
    tar xf OpenSSL_1_1_1g.tar.gz
    }

    # ------------------------------------------------------------------------------
    @@ -484,13 +484,13 @@ function openssl_get {

    notice "openssl_get"

    rm -rf openssl-OpenSSL_1_1_1d
    rm -rf openssl-OpenSSL_1_1_1g

    if [ ! -f OpenSSL_1_1_1d.tar.gz ]; then
    wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz
    if [ ! -f OpenSSL_1_1_1g.tar.gz ]; then
    wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz
    fi

    tar xf OpenSSL_1_1_1d.tar.gz
    tar xf OpenSSL_1_1_1g.tar.gz
    }

    # ------------------------------------------------------------------------------
    @@ -579,8 +579,8 @@ function make_configure {
    fi

    WITH_OPENSSL=""
    if [ -d openssl-OpenSSL_1_1_1d ]; then
    WITH_OPENSSL="--with-openssl=$PARENTF/openssl-OpenSSL_1_1_1d --with-openssl-opt='enable-tls1_3'"
    if [ -d openssl-OpenSSL_1_1_1g ]; then
    WITH_OPENSSL="--with-openssl=$PARENTF/openssl-OpenSSL_1_1_1g --with-openssl-opt='enable-tls1_3'"
    fi


  13. Andrew revised this gist Apr 21, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -126,6 +126,10 @@ function root_prepare {
    apt-get install -y vim mc less mlocate git cmake build-essential curl gnupg aptitude
    apt-get install -y libpq-dev libpcre3-dev zlib1g-dev libgd-dev libgeoip-dev libatomic-ops-dev

    if [ -f /usr/bin/gcc-8 ] && [ -f /usr/bin/gcc-7 ] && [ `gcc -dumpversion` -gt 7 ] ; then
    err 'gcc 7 required. update-alternatives --set gcc /usr/bin/gcc-7 and run builder again.'
    fi

    if [ -f /usr/bin/gcc-8 ] && [ ! -f /usr/bin/gcc-7 ]; then

    aptitude install -y gcc-7
  14. Andrew revised this gist Apr 21, 2020. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -126,9 +126,22 @@ function root_prepare {
    apt-get install -y vim mc less mlocate git cmake build-essential curl gnupg aptitude
    apt-get install -y libpq-dev libpcre3-dev zlib1g-dev libgd-dev libgeoip-dev libatomic-ops-dev

    if gcc --version | grep -q '8.'; then
    aptitude install gcc-7
    err 'gcc 7 required. exit.'
    if [ -f /usr/bin/gcc-8 ] && [ ! -f /usr/bin/gcc-7 ]; then

    aptitude install -y gcc-7

    if [ -f /usr/bin/gcc-7 ]; then

    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 20

    update-alternatives --list gcc

    update-alternatives --set gcc /usr/bin/gcc-7
    warn 'set after install: update-alternatives --set gcc /usr/bin/gcc-8'
    fi

    err 'gcc 7 required. run builder again.'
    fi
    fi

  15. Andrew revised this gist Apr 21, 2020. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -125,6 +125,11 @@ function root_prepare {
    warn 'Debian 10 detected.'
    apt-get install -y vim mc less mlocate git cmake build-essential curl gnupg aptitude
    apt-get install -y libpq-dev libpcre3-dev zlib1g-dev libgd-dev libgeoip-dev libatomic-ops-dev

    if gcc --version | grep -q '8.'; then
    aptitude install gcc-7
    err 'gcc 7 required. exit.'
    fi
    fi

    if cat /etc/*release* | grep -q 'CentOS Linux release 7'; then
  16. Andrew revised this gist Apr 21, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -523,6 +523,7 @@ function make_configure {
    local SCGI_TEMP_PATH=""
    local LUAJIT2_BUILD_LIB=""
    local LUAJIT2_SRC=""
    local LUA_SSL_NGINX_MODULE=""

    if [ $IS_LOCAL == 1 ]; then
    mkdir -p $PARENTF/build/{tmp,proxy,fastcgi,uwsgi,scgi}
    @@ -538,6 +539,7 @@ function make_configure {
    SCGI_TEMP_PATH="$PREFIX/scgi/"
    LUAJIT2_BUILD_LIB="$PARENTF/opt/luajit2.git/build/lib"
    LUAJIT2_SRC="$PARENTF/opt/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="$PARENTF/opt/lua-ssl-nginx-module.git/"
    else
    PREFIX="/usr/local/$NGINXV"
    CONF_PATH="/etc/$NGINXV/nginx.conf"
    @@ -551,6 +553,7 @@ function make_configure {
    SCGI_TEMP_PATH="/var/lib/nginx/scgi/"
    LUAJIT2_BUILD_LIB="/opt/luajit2.git/build/lib"
    LUAJIT2_SRC="/opt/luajit2.git/src"
    LUA_SSL_NGINX_MODULE="/opt/lua-ssl-nginx-module.git/"
    fi

    WITH_OPENSSL=""
    @@ -619,7 +622,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    --add-module=../nginx-rtmp-module.git/ \\
    --add-module=../opt/lua-ssl-nginx-module.git/ \\
    --add-module=$LUA_SSL_NGINX_MODULE \\
    L10HEREDOC

  17. Andrew revised this gist Mar 24, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -577,6 +577,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --http-scgi-temp-path=$SCGI_TEMP_PATH \\
    --user=nginx \\
    --group=nginx \\
    --with-debug \\
    --with-stream \\
    --with-stream_ssl_module \\
    --with-stream_ssl_preread_module \\
  18. Andrew revised this gist Mar 23, 2020. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    PARENTF=`pwd`
    NGINXV='nginx-1.16.1'
    IS_LOCAL=0
    IS_PAUSED=1
    IS_PAUSED=0


    function main {
    @@ -263,7 +263,7 @@ function repo_get {
    notice "repo_get"

    get_github 'openresty' 'memc-nginx-module.git'
    get_github 'openresty' 'lua-nginx-module.git'
    get_github 'openresty' 'lua-nginx-module.git' 'v0.10.15'
    get_github 'simplresty' 'ngx_devel_kit.git'
    get_github 'openresty' 'redis2-nginx-module.git'
    get_github 'openresty' 'echo-nginx-module.git'
    @@ -366,10 +366,9 @@ function lua_addition_prepare {
    cd /opt
    fi

    #get_github 'openresty' 'lua-resty-core.git' 'v0.1.17'
    get_github 'openresty' 'lua-resty-core.git'
    get_github 'openresty' 'lua-resty-lrucache.git'
    get_github 'openresty' 'lua-cjson.git'
    get_github 'openresty' 'lua-resty-core.git' 'v0.1.17'
    get_github 'openresty' 'lua-resty-lrucache.git' 'v0.09'
    get_github 'openresty' 'lua-cjson.git' '2.1.0.7'

    local LUAJIT2_SRC=""
    if [ $IS_LOCAL == 1 ]; then
  19. Andrew revised this gist Mar 23, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -427,6 +427,8 @@ function lua_addition_prepare {

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    echo "lua_package_path \"$LB;\";" > "$PARENTF/lua_package_path"
    echo "lua_package_cpath \"$CLB;\";" >> "$PARENTF/lua_package_path"
    else
    local LB="/opt/lua-resty-core.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-lrucache.git/lib/?.lua;"
    @@ -443,6 +445,8 @@ function lua_addition_prepare {

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    echo "lua_package_path \"$LB;\";" > "$PARENTF/lua_package_path"
    echo "lua_package_cpath \"$CLB;\";" >> "$PARENTF/lua_package_path"
    fi
    echo

  20. Andrew revised this gist Mar 23, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ function prepare_for_archive {
    for mfold in echo-nginx-module.git form-input-nginx-module.git headers-more-nginx-module.git \
    lua-nginx-module.git memc-nginx-module.git naxsi.git sregex.git \
    replace-filter-nginx-module.git drizzle-nginx-module.git rds-json-nginx-module.git rds-csv-nginx-module.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git xss-nginx-module.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git xss-nginx-module.git nginx-rtmp-module.git \
    nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    redis2-nginx-module.git set-misc-nginx-module.git
    do
    @@ -319,6 +319,7 @@ function repo_get {

    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    get_github 'openresty' 'xss-nginx-module.git'
    get_github 'arut' 'nginx-rtmp-module.git'

    }

    @@ -613,6 +614,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../njs.git/nginx/ \\
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    --add-module=../nginx-rtmp-module.git/ \\
    --add-module=../opt/lua-ssl-nginx-module.git/ \\
    L10HEREDOC
  21. Andrew revised this gist Mar 12, 2020. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    PARENTF=`pwd`
    NGINXV='nginx-1.16.1'
    IS_LOCAL=0

    IS_PAUSED=1


    function main {
    @@ -365,6 +365,7 @@ function lua_addition_prepare {
    cd /opt
    fi

    #get_github 'openresty' 'lua-resty-core.git' 'v0.1.17'
    get_github 'openresty' 'lua-resty-core.git'
    get_github 'openresty' 'lua-resty-lrucache.git'
    get_github 'openresty' 'lua-cjson.git'
    @@ -382,7 +383,9 @@ function lua_addition_prepare {
    echo
    export LUA_INCLUDE_DIR="$LUAJIT2_SRC" && make -j4

    read -p "Press [Enter] key to continue..."
    if [ $IS_PAUSED == 1 ]; then
    read -p "Press [Enter] key to continue..."
    fi
    popd

    get_github 'openresty' 'lua-resty-redis.git'
    @@ -441,7 +444,10 @@ function lua_addition_prepare {
    echo "lua_package_cpath \"$CLB;\";"
    fi
    echo
    read -p "Press [Enter] key to continue..."

    if [ $IS_PAUSED == 1 ]; then
    read -p "Press [Enter] key to continue..."
    fi

    cd $PARENTF
    }
  22. Andrew revised this gist Mar 12, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -390,13 +390,13 @@ function lua_addition_prepare {
    get_github 'openresty' 'lua-resty-mysql.git'
    get_github 'openresty' 'lua-ssl-nginx-module.git'

    get_github 'openresty' 'lua-resty-signal.git'
    get_github 'openresty' 'lua-resty-signal.git' 'v0.02'
    pushd 'lua-resty-signal.git'
    make clean
    make
    popd
    get_github 'openresty' 'lua-tablepool.git'
    get_github 'openresty' 'lua-resty-shell.git'
    get_github 'openresty' 'lua-tablepool.git' 'v0.01'
    get_github 'openresty' 'lua-resty-shell.git' 'v0.02'

    get_github 'openresty' 'lua-resty-limit-traffic.git'
    get_github 'openresty' 'lua-resty-lock.git'
    @@ -778,7 +778,7 @@ function get_github {
    if [ "$branch" == "" ]; then
    git clone https://github.com/$1/$folderName $folderName
    else
    notice "branch $branch"
    warn "branch $branch"
    git clone -b $branch https://github.com/$1/$folderName $folderName
    fi
    fi
  23. Andrew revised this gist Mar 12, 2020. 1 changed file with 11 additions and 2 deletions.
    13 changes: 11 additions & 2 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -391,6 +391,10 @@ function lua_addition_prepare {
    get_github 'openresty' 'lua-ssl-nginx-module.git'

    get_github 'openresty' 'lua-resty-signal.git'
    pushd 'lua-resty-signal.git'
    make clean
    make
    popd
    get_github 'openresty' 'lua-tablepool.git'
    get_github 'openresty' 'lua-resty-shell.git'

    @@ -408,7 +412,7 @@ function lua_addition_prepare {
    LB="$LB$PARENTF/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-ssl-nginx-module.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-ssl-nginx-module.git/lualib/?.lua;"

    LB="$LB$PARENTF/opt/lua-resty-signal.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-tablepool.git/lib/?.lua;"
    @@ -424,7 +428,11 @@ function lua_addition_prepare {
    LB="$LB/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB/opt/lua-ssl-nginx-module.git/lib/?.lua;"
    LB="$LB/opt/lua-ssl-nginx-module.git/lualib/?.lua;"

    LB="$LB/opt/lua-resty-signal.git/lib/?.lua;"
    LB="$LB/opt/lua-tablepool.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-shell.git/lib/?.lua;"

    local CLB="/opt/lua-cjson.git/?.so;"
    CLB="$CLB/opt/lua-resty-signal.git/?.so;"
    @@ -599,6 +607,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../njs.git/nginx/ \\
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    --add-module=../opt/lua-ssl-nginx-module.git/ \\
    L10HEREDOC

  24. Andrew revised this gist Mar 11, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -58,7 +58,8 @@ function prepare_for_archive {
    for mfold in lua-cjson.git lua-resty-cookie.git lua-resty-core.git lua-resty-lrucache.git \
    lua-resty-mysql.git lua-resty-redis.git lua-ssl-nginx-module.git \
    lua-resty-signal.git lua-tablepool.git lua-resty-shell.git \
    lua-resty-limit-traffic.git lua-resty-lock.git lua-resty-string.git lua-resty-upload.git lua-resty-websocket.git lua-resty-upstream-healthcheck.git \
    lua-resty-limit-traffic.git lua-resty-lock.git lua-resty-string.git lua-resty-upload.git \
    lua-resty-websocket.git lua-resty-upstream-healthcheck.git \
    luajit2.git
    do
    warn "remove [$mfold/.git] folder"
  25. Andrew revised this gist Mar 11, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,7 @@ function prepare_for_archive {
    for mfold in lua-cjson.git lua-resty-cookie.git lua-resty-core.git lua-resty-lrucache.git \
    lua-resty-mysql.git lua-resty-redis.git lua-ssl-nginx-module.git \
    lua-resty-signal.git lua-tablepool.git lua-resty-shell.git \
    lua-resty-limit-traffic.git lua-resty-lock.git lua-resty-string.git lua-resty-upload.git lua-resty-websocket.git lua-resty-upstream-healthcheck.git \
    luajit2.git
    do
    warn "remove [$mfold/.git] folder"
  26. Andrew revised this gist Mar 11, 2020. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,8 @@ function prepare_for_archive {
    for mfold in echo-nginx-module.git form-input-nginx-module.git headers-more-nginx-module.git \
    lua-nginx-module.git memc-nginx-module.git naxsi.git sregex.git \
    replace-filter-nginx-module.git drizzle-nginx-module.git rds-json-nginx-module.git rds-csv-nginx-module.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git xss-nginx-module.git \
    nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    redis2-nginx-module.git set-misc-nginx-module.git
    do
    warn "remove [$mfold/.git] folder"
    @@ -315,6 +316,8 @@ function repo_get {
    get_github 'nginx' 'njs.git'

    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    get_github 'openresty' 'xss-nginx-module.git'

    }

    # ------------------------------------------------------------------------------
    @@ -389,6 +392,13 @@ function lua_addition_prepare {
    get_github 'openresty' 'lua-tablepool.git'
    get_github 'openresty' 'lua-resty-shell.git'

    get_github 'openresty' 'lua-resty-limit-traffic.git'
    get_github 'openresty' 'lua-resty-lock.git'
    get_github 'openresty' 'lua-resty-string.git'
    get_github 'openresty' 'lua-resty-upload.git'
    get_github 'openresty' 'lua-resty-websocket.git'
    get_github 'openresty' 'lua-resty-upstream-healthcheck.git'

    echo
    notice "save these strings:"
    if [ $IS_LOCAL == 1 ]; then
    @@ -586,6 +596,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../ngx_postgres.git/ \\
    --add-module=../njs.git/nginx/ \\
    --add-module=../stream-lua-nginx-module.git/ \\
    --add-module=../xss-nginx-module.git/ \\
    L10HEREDOC

  27. Andrew revised this gist Mar 11, 2020. 1 changed file with 31 additions and 4 deletions.
    35 changes: 31 additions & 4 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -56,6 +56,7 @@ function prepare_for_archive {
    pushd 'opt'
    for mfold in lua-cjson.git lua-resty-cookie.git lua-resty-core.git lua-resty-lrucache.git \
    lua-resty-mysql.git lua-resty-redis.git lua-ssl-nginx-module.git \
    lua-resty-signal.git lua-tablepool.git lua-resty-shell.git \
    luajit2.git
    do
    warn "remove [$mfold/.git] folder"
    @@ -384,14 +385,40 @@ function lua_addition_prepare {
    get_github 'openresty' 'lua-resty-mysql.git'
    get_github 'openresty' 'lua-ssl-nginx-module.git'

    get_github 'openresty' 'lua-resty-signal.git'
    get_github 'openresty' 'lua-tablepool.git'
    get_github 'openresty' 'lua-resty-shell.git'

    echo
    notice "save these strings:"
    if [ $IS_LOCAL == 1 ]; then
    echo "lua_package_path \"$PARENTF/opt/lua-resty-core.git/lib/?.lua;$PARENTF/opt/lua-resty-lrucache.git/lib/?.lua;$PARENTF/opt/lua-resty-redis.git/lib/?.lua;$PARENTF/opt/lua-resty-mysql.git/lib/?.lua;$PARENTF/opt/lua-ssl-nginx-module.git/lib/?.lua;;\";"
    echo "lua_package_cpath \"$PARENTF/opt/lua-cjson.git/?.so;;\";"
    local LB="$PARENTF/opt/lua-resty-core.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-ssl-nginx-module.git/lib/?.lua;"

    LB="$LB$PARENTF/opt/lua-resty-signal.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-tablepool.git/lib/?.lua;"
    LB="$LB$PARENTF/opt/lua-resty-shell.git/lib/?.lua;"

    local CLB="$PARENTF/opt/lua-cjson.git/?.so;"
    CLB="$CLB$PARENTF/opt/lua-resty-signal.git/?.so;"

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    else
    echo "lua_package_path \"/opt/lua-resty-core.git/lib/?.lua;/opt/lua-resty-lrucache.git/lib/?.lua;/opt/lua-resty-redis.git/lib/?.lua;/opt/lua-resty-mysql.git/lib/?.lua;/opt/lua-ssl-nginx-module.git/lib/?.lua;;\";"
    echo "lua_package_cpath \"/opt/lua-cjson.git/?.so;;\";"
    local LB="/opt/lua-resty-core.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-lrucache.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-redis.git/lib/?.lua;"
    LB="$LB/opt/lua-resty-mysql.git/lib/?.lua;"
    LB="$LB/opt/lua-ssl-nginx-module.git/lib/?.lua;"

    local CLB="/opt/lua-cjson.git/?.so;"
    CLB="$CLB/opt/lua-resty-signal.git/?.so;"

    echo "lua_package_path \"$LB;\";"
    echo "lua_package_cpath \"$CLB;\";"
    fi
    echo
    read -p "Press [Enter] key to continue..."
  28. Andrew revised this gist Mar 11, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ function prepare_for_archive {
    for mfold in echo-nginx-module.git form-input-nginx-module.git headers-more-nginx-module.git \
    lua-nginx-module.git memc-nginx-module.git naxsi.git sregex.git \
    replace-filter-nginx-module.git drizzle-nginx-module.git rds-json-nginx-module.git rds-csv-nginx-module.git \
    ngx_postgres.git njs.git nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    ngx_postgres.git njs.git stream-lua-nginx-module.git nginx-upload-module.git ngx_cache_purge.git ngx_devel_kit.git \
    redis2-nginx-module.git set-misc-nginx-module.git
    do
    warn "remove [$mfold/.git] folder"
  29. Andrew revised this gist Mar 11, 2020. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion nginx_builder
    Original file line number Diff line number Diff line change
    @@ -312,6 +312,8 @@ function repo_get {
    get_github 'openresty' 'rds-csv-nginx-module.git'
    get_github 'openresty' 'ngx_postgres.git'
    get_github 'nginx' 'njs.git'

    get_github 'openresty' 'stream-lua-nginx-module.git' 'v0.0.7'
    }

    # ------------------------------------------------------------------------------
    @@ -556,6 +558,7 @@ cat << L10HEREDOC > $NGINXV/nginx_configuration
    --add-module=../drizzle-nginx-module.git/ \\
    --add-module=../ngx_postgres.git/ \\
    --add-module=../njs.git/nginx/ \\
    --add-module=../stream-lua-nginx-module.git/ \\
    L10HEREDOC

    @@ -715,14 +718,20 @@ L12HEREDOC
    function get_github {
    notice "https://github.com/$1/$2"
    local folderName=$2
    local branch=$3

    if [ -d $folderName ]; then
    cd $folderName
    pwd
    git pull
    cd ..
    else
    git clone https://github.com/$1/$folderName $folderName
    if [ "$branch" == "" ]; then
    git clone https://github.com/$1/$folderName $folderName
    else
    notice "branch $branch"
    git clone -b $branch https://github.com/$1/$folderName $folderName
    fi
    fi

    echo "https://github.com/$1/$folderName" >> "$PARENTF/versions"
  30. Andrew revised this gist Mar 7, 2020. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions nginx_builder
    Original file line number Diff line number Diff line change
    @@ -351,13 +351,6 @@ function lua_addition_prepare {
    notice "lua_addition_prepare"


    local LUAJIT2_SRC=""
    if [ $IS_LOCAL == 1 ]; then
    LUAJIT2_SRC="$PARENTF/opt/luajit2.git/src"
    else
    LUAJIT2_SRC="/opt/luajit2.git/src"
    fi

    if [ $IS_LOCAL == 1 ]; then
    mkdir opt ; cd opt
    else
    @@ -368,6 +361,13 @@ function lua_addition_prepare {
    get_github 'openresty' 'lua-resty-lrucache.git'
    get_github 'openresty' 'lua-cjson.git'

    local LUAJIT2_SRC=""
    if [ $IS_LOCAL == 1 ]; then
    LUAJIT2_SRC="$PARENTF/opt/luajit2.git/src"
    else
    LUAJIT2_SRC="/opt/luajit2.git/src"
    fi

    pushd 'lua-cjson.git'
    echo
    echo "export LUA_INCLUDE_DIR=\"$LUAJIT2_SRC\" && make -j4"