diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b11a514bca779641f9c3a3b927a938801285d014..4ef8d9285e3c9dae5f14c2191e5e213c1f1ad483 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,90 +1,63 @@ +#image: ${CI_REGISTRY}/storm2/build/ngx-voms-build:master-latest image: storm2/ngx-voms-build:latest stages: - build - - test - docker-build - docker-push - - deploy -build-no-debug: +build-rpm: stage: build script: - - env - - sh ${HOME}/build-install-ngx-voms.sh - - mv ${HOME}/local/openresty openresty && rm openresty/nginx/sbin/nginx.old && tar cvzf openresty-no-debug.tar.gz openresty + - env | sort + - export VOMS_MODULE_HOME=${CI_PROJECT_DIR} + - cd rpm && sh make_packaging.sh && cd .. + - mv ${HOME}/rpmbuild.tar.gz . + - mv ${HOME}/rpmbuild ./rpmbuild artifacts: paths: - - openresty-no-debug.tar.gz + - rpmbuild.tar.gz + - rpmbuild/SRPMS/ + - rpmbuild/RPMS/noarch/ + - rpmbuild/RPMS/x86_64/ -build4c: - stage: build - script: - - env - - sh ${HOME}/build-install-ngx-voms.sh -d -c - - mv ${HOME}/local local - - mv ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6 nginx-1.13.6 - - tar cvzf artifacts.tar.gz local nginx-1.13.6 - artifacts: - paths: - - artifacts.tar.gz - -test4c: - stage: test - dependencies: - - build4c - script: - - rm -rf ${HOME}/local/ - - rm -rf ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6/ - - tar xvzf artifacts.tar.gz - - mv local ${HOME} - - mv nginx-1.13.6 ${HOME}/openresty-1.13.6.1/build/ - - sh test-ngx-voms.sh - - sh cov-ngx-voms.sh - - mv /tmp/coverage-report coverage - artifacts: - paths: - - coverage - -pages: - stage: deploy - image: docker:latest - dependencies: - - test4c - script: - - mv coverage/ public/ - artifacts: - paths: - - public - expire_in: 30 days - -docker-build: +docker-build-rpm: stage: docker-build image: docker:latest services: - docker:dind dependencies: - - build-no-debug + - build-rpm script: - - cp openresty-no-debug.tar.gz ${CI_PROJECT_DIR}/docker/openresty.tar.gz && cd ${CI_PROJECT_DIR}/docker && sh build-image.sh - - docker tag storm2/ngx-voms:latest ${CI_REGISTRY_IMAGE}/ngx-voms:${CI_COMMIT_SHA:0:8} + - apk add git bash + - git clone https://baltig.infn.it/mw-devel/helper-scripts.git helper-scripts + - cp helper-scripts/scripts/* /usr/local/bin + - cp rpmbuild/RPMS/x86_64/* ${CI_PROJECT_DIR}/docker/ngx-voms-packaging/ + - cp rpmbuild/RPMS/noarch/* ${CI_PROJECT_DIR}/docker/ngx-voms-packaging/ - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - - docker push ${CI_REGISTRY_IMAGE}/ngx-voms:${CI_COMMIT_SHA:0:8} + - export DOCKER_REGISTRY_HOST=${CI_REGISTRY} + - export DOCKER_REGISTRY_NAMESPACE=${CI_PROJECT_PATH} + - cd docker && cd ngx-voms-packaging && build-docker-image.sh && push-docker-image.sh -dockerhub-push: +push-to-dockerhub: stage: docker-push image: docker:latest services: - docker:dind dependencies: - - docker-build + - docker-build-rpm script: + - apk add git bash + - git clone https://baltig.infn.it/mw-devel/helper-scripts.git helper-scripts + - cp helper-scripts/scripts/* /usr/local/bin + - export DOCKER_PUSH_TO_DOCKERHUB=y + - env | sort - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - - docker pull ${CI_REGISTRY_IMAGE}/ngx-voms:${CI_COMMIT_SHA:0:8} - - docker tag ${CI_REGISTRY_IMAGE}/ngx-voms:${CI_COMMIT_SHA:0:8} storm2/ngx-voms:${CI_COMMIT_SHA:0:8} - - docker tag ${CI_REGISTRY_IMAGE}/ngx-voms:${CI_COMMIT_SHA:0:8} storm2/ngx-voms:latest + - export DOCKER_REGISTRY_HOST=${CI_REGISTRY} + - export DOCKER_REGISTRY_NAMESPACE=${CI_PROJECT_PATH} + - cd docker && cd ngx-voms-packaging && pull-docker-image.sh && cd .. && unset DOCKER_REGISTRY_HOST - docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PASSWORD} - - docker push storm2/ngx-voms:${CI_COMMIT_SHA:0:8} - - docker push storm2/ngx-voms:latest + - cd ngx-voms-packaging && push-docker-images.sh only: - master + diff --git a/cov-ngx-voms.sh b/cov-ngx-voms.sh index a85276a80171a3cf1a5f25cff287f9ca5b81036f..4873ce55f4973ae232026b04ee47bf1ae11cba07 100755 --- a/cov-ngx-voms.sh +++ b/cov-ngx-voms.sh @@ -31,8 +31,8 @@ # started from the storm2/ngx-voms-build image. #geninfo --base-directory ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6/objs/addon/src/ --output-filename coverage.info ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6/objs/addon/src/ -geninfo --output-filename /tmp/coverage.info ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6/objs/addon/src/ -genhtml --prefix ${HOME}/openresty-1.13.6.1/build/nginx-1.13.6/objs/addon/src/ --ignore-errors source --demangle-cpp /tmp/coverage.info \ +geninfo --output-filename /tmp/coverage.info ${HOME}/openresty-1.15.8.1/build/nginx-1.15.8/objs/addon/src/ +genhtml --prefix ${HOME}/openresty-1.15.8.1/build/nginx-1.15.8/objs/addon/src/ --ignore-errors source --demangle-cpp /tmp/coverage.info \ --legend --title "coverage ngix" --output-directory=/tmp/coverage-report exit_status=$? diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 89f33022678117a267ded5cbe5a5c9ae4f490468..0000000000000000000000000000000000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM storm2/base:latest - -RUN sudo yum -y install voms zlib pcre readline gettext && \ - sudo yum clean all && rm -rf /var/cache/yum && \ - mkdir -p /etc/nginx/conf.d && \ - mkdir -p /home/build/local && \ - chown -R build:build /etc/nginx/conf.d /home/build/local - -USER build -ADD openresty.tar.gz /home/build/local - -RUN ls -lR /home/build && sudo chown -R build:build /home/build - -RUN \ - touch /home/build/local/openresty/nginx/logs/access.log && \ - touch /home/build/local/openresty/nginx/logs/error.log && \ - ln -sf /dev/stdout /home/build/local/openresty/nginx/logs/access.log && \ - ln -sf /dev/stderr /home/build/local/openresty/nginx/logs/error.log - -COPY assets/nginx.conf /home/build/local/openresty/nginx/conf/nginx.conf -COPY assets/srm.conf /etc/nginx/conf.d/ - -USER root - -# Embed TINI since compose v3 syntax do not support the init -# option to run docker --init -# -ENV TINI_VERSION v0.18.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini -ENTRYPOINT ["/tini", "--"] - -CMD ["/home/build/local/openresty/bin/openresty", "-g", "daemon off;"] diff --git a/docker/README.md b/docker/README.md index 1689fc80e2afeaa220ab0a6b0872d607115e4c26..02675618c266dffe2958e2b35c5e4fd1be606dca 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,10 +1,5 @@ -This folder contains a Dockerfile to run an instance of Openresty/NGINX -compiled and linked against the ngx_voms_http_module. +This folder contains the ngx-module-packaging folder that contains a Dockerfile to build Openresty/NGINX voms rpm. -For more details see the [Dockerfile](./Dockerfile) +For more details see the [Dockerfile](./ngx-module-packaging/Dockerfile). -The default configuration for NGINX is provided in [this conf file]( -./assets/nginx.conf). -A configuration for the `/srm` endpoint useful for the storm docker compose -file is provided in [this conf file](./assets/srm.conf). diff --git a/docker/assets/nginx.conf b/docker/assets/nginx.conf deleted file mode 100644 index d5135ff6e23050c084a514364b0749bb786a6319..0000000000000000000000000000000000000000 --- a/docker/assets/nginx.conf +++ /dev/null @@ -1,34 +0,0 @@ -user build; -worker_processes 1; - -env X509_VOMS_DIR=/vomsdir; - -error_log logs/error.log warn; - -events { - worker_connections 1024; -} - -http { - - include mime.types; - default_type application/octet-stream; - - log_format storm '$time_iso8601 [$request_id] $remote_addr - $remote_user "$request" <$upstream_response_time> ' - '$ssl_protocol/$ssl_cipher ' - '"$ssl_client_s_dn" ' - '[$voms_fqans] ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log logs/access.log storm; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/docker/assets/srm.conf b/docker/assets/srm.conf deleted file mode 100644 index 19fd8b67e668873cb34cc17b2ad20256a09e27e6..0000000000000000000000000000000000000000 --- a/docker/assets/srm.conf +++ /dev/null @@ -1,45 +0,0 @@ -server { - - error_log logs/error.log debug; - access_log logs/access.log storm; - - listen 443 ssl; - server_name storm.example; - - ssl on; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - - ssl_certificate /certs/cert.pem; - ssl_certificate_key /certs/key.pem; - ssl_client_certificate /etc/pki/tls/certs/ca-bundle.crt; - - ssl_verify_client optional; - ssl_verify_depth 100; - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 10m; - - location /srm { - - proxy_pass http://fe:8080; - - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_set_header Host $http_host; - - # Simple tracing via request_id - proxy_set_header X-Request-Id $request_id; - - # VOMS headers - proxy_set_header x-ssl_client_ee_s_dn $ssl_client_ee_s_dn; - proxy_set_header x-ssl_client_ee_i_dn $ssl_client_ee_i_dn; - proxy_set_header x-voms_fqans $voms_fqans; - proxy_set_header x-voms_user $voms_user; - proxy_set_header x-voms_user_ca $voms_user_ca; - proxy_set_header x-voms_vo $voms_vo; - proxy_set_header x-voms_not_before $voms_not_before; - proxy_set_header x-voms_not_after $voms_not_after; - proxy_set_header x-voms_generic_attributes $voms_generic_attributes; - proxy_set_header x-voms_serial $voms_serial; - } -} diff --git a/docker/build-image.sh b/docker/build-image.sh deleted file mode 100644 index f75aa7ed7ea381f0b1cfb458618e0508603ab287..0000000000000000000000000000000000000000 --- a/docker/build-image.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -e - -NGINX_VOMS_IMAGE=${NGINX_VOMS_IMAGE:-storm2/ngx-voms:latest} - -docker build -t ${NGINX_VOMS_IMAGE} . diff --git a/docker/ngx-voms-packaging/.env b/docker/ngx-voms-packaging/.env new file mode 100644 index 0000000000000000000000000000000000000000..7368612d7a88de745e091a81683d2cfb00e4ea2e --- /dev/null +++ b/docker/ngx-voms-packaging/.env @@ -0,0 +1,4 @@ +DOCKER_IMAGE=storm2/ngx-voms-centos7 +DOCKER_VERBOSE=y +DOCKER_GIT_TAG_ENABLED=y + diff --git a/docker/ngx-voms-packaging/Dockerfile b/docker/ngx-voms-packaging/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..180d27df352bbc66fb9c5328042071bcb74796a2 --- /dev/null +++ b/docker/ngx-voms-packaging/Dockerfile @@ -0,0 +1,36 @@ +FROM storm2/base:latest + +RUN sudo yum -y install voms zlib pcre readline gettext && \ + sudo yum clean all && rm -rf /var/cache/yum + +ADD assets/setup.sh /docker/ + +RUN sh /docker/setup.sh + +RUN mkdir /cores + +USER root + +ADD openresty-voms-1.15.8.1-7.el7.x86_64.rpm openresty-voms-1.15.8.1-7.el7.x86_64.rpm +ADD openresty-voms-debuginfo-1.15.8.1-7.el7.x86_64.rpm openresty-voms-debuginfo-1.15.8.1-7.el7.x86_64.rpm + +ADD openresty-voms-doc-1.15.8.1-7.el7.noarch.rpm openresty-voms-doc-1.15.8.1-7.el7.noarch.rpm +ADD openresty-voms-opm-1.15.8.1-7.el7.noarch.rpm openresty-voms-opm-1.15.8.1-7.el7.noarch.rpm +ADD openresty-voms-resty-1.15.8.1-7.el7.noarch.rpm openresty-voms-resty-1.15.8.1-7.el7.noarch.rpm + +RUN sudo yum -y localinstall openresty-voms-1.15.8.1-7.el7.x86_64.rpm \ + openresty-voms-resty-1.15.8.1-7.el7.noarch.rpm \ + openresty-voms-doc-1.15.8.1-7.el7.noarch.rpm \ + openresty-voms-opm-1.15.8.1-7.el7.noarch.rpm \ + openresty-voms-resty-1.15.8.1-7.el7.noarch.rpm + +RUN chown -R ${STORM_USER}:${STORM_USER} /usr/local/openresty-voms/ /usr/lib/systemd/system/openresty-voms.service /usr/bin/openresty-voms + +ENV TINI_VERSION v0.18.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini +ENTRYPOINT ["/tini", "--"] + +CMD ["sudo", "/usr/bin/openresty-voms", "-g", "daemon off;"] + +USER ${STORM_USER} diff --git a/docker/ngx-voms-packaging/assets/setup.sh b/docker/ngx-voms-packaging/assets/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..41c7aace44a3e31ace1ce61eae76c553a5f9b59d --- /dev/null +++ b/docker/ngx-voms-packaging/assets/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -ex + +mkdir -p /etc/nginx/conf.d + +chown -R ${STORM_USER}:${STORM_USER} /etc/nginx + + diff --git a/rpm/SOURCES/nginx-1.13.6-rm_glibc_crypt_r_workaround.patch b/rpm/SOURCES/nginx-1.13.6-rm_glibc_crypt_r_workaround.patch new file mode 100644 index 0000000000000000000000000000000000000000..d0f16b0af2d389ec611c6137c94dfc96743abcca --- /dev/null +++ b/rpm/SOURCES/nginx-1.13.6-rm_glibc_crypt_r_workaround.patch @@ -0,0 +1,28 @@ +commit 1ef5c9ce6f03907dad1677d25f108d2bf59a5c15 +Author: Maxim Dounin <mdounin@mdounin.ru> +Date: Wed May 23 16:38:16 2018 +0300 + + Removed glibc crypt_r() bug workaround (ticket #1469). + + The bug in question was fixed in glibc 2.3.2 and is no longer expected + to manifest itself on real servers. On the other hand, the workaround + causes compilation problems on various systems. Previously, we've + already fixed the code to compile with musl libc (fd6fd02f6a4d), and + now it is broken on Fedora 28 where glibc's crypt library was replaced + by libxcrypt. So the workaround was removed. + +diff --git a/bundle/nginx-1.13.6/src/os/unix/ngx_user.c b/bundle/nginx-1.13.6/src/os/unix/ngx_user.c +index 7ebe2b57..b3d81d07 100644 +--- a/bundle/nginx-1.13.6/src/os/unix/ngx_user.c ++++ b/bundle/nginx-1.13.6/src/os/unix/ngx_user.c +@@ -21,10 +21,6 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted) + struct crypt_data cd; + + cd.initialized = 0; +-#ifdef __GLIBC__ +- /* work around the glibc bug */ +- cd.current_salt[0] = ~salt[0]; +-#endif + + value = crypt_r((char *) key, (char *) salt, &cd); + diff --git a/rpm/SOURCES/openresty-1.9.15.1.patch b/rpm/SOURCES/openresty-1.9.15.1.patch new file mode 100644 index 0000000000000000000000000000000000000000..4bef6b9d2e3a9644351381d7cf7f4e0da642d2f4 --- /dev/null +++ b/rpm/SOURCES/openresty-1.9.15.1.patch @@ -0,0 +1,98 @@ +diff -urp openresty-1.9.15.1/bundle/resty-cli-0.12/bin/resty openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/resty +--- openresty-1.9.15.1/bundle/resty-cli-0.12/bin/resty 2016-06-03 17:50:22.000000000 -0700 ++++ openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/resty 2016-07-12 12:50:45.436818037 -0700 +@@ -65,9 +65,9 @@ if (!$nginx_path) { + $ext = ''; + } + } +- $nginx_path = File::Spec->catfile($FindBin::Bin, "..", "nginx", "sbin", "nginx$ext"); ++ $nginx_path = File::Spec->catfile($FindBin::RealBin, "..", "nginx", "sbin", "nginx$ext"); + if (!-f $nginx_path) { +- $nginx_path = File::Spec->catfile($FindBin::Bin, "nginx$ext"); ++ $nginx_path = File::Spec->catfile($FindBin::RealBin, "nginx$ext"); + if (!-f $nginx_path) { + $nginx_path = "nginx"; # find in PATH + } +diff -urp openresty-1.9.15.1/bundle/resty-cli-0.12/bin/restydoc openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/restydoc +--- openresty-1.9.15.1/bundle/resty-cli-0.12/bin/restydoc 2016-06-03 17:50:22.000000000 -0700 ++++ openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/restydoc 2016-07-12 12:51:04.161322019 -0700 +@@ -43,10 +43,10 @@ if (!defined $pager) { + } + } + +-my $index_file = "$FindBin::Bin/../resty.index"; ++my $index_file = "$FindBin::RealBin/../resty.index"; + { + if (!-f $index_file) { +- my $f = "$FindBin::Bin/resty.index"; ++ my $f = "$FindBin::RealBin/resty.index"; + if (-f $f) { + $index_file = $f; + } +@@ -179,7 +179,7 @@ if (!@dists) { + die "ERROR: $index_file is empty.\n"; + } + +-my $poddir = "$FindBin::Bin/../pod"; ++my $poddir = "$FindBin::RealBin/../pod"; + + if ($section_pat) { + $section_pat = lc $section_pat; +diff -urp openresty-1.9.15.1/bundle/resty-cli-0.12/bin/restydoc-index openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/restydoc-index +--- openresty-1.9.15.1/bundle/resty-cli-0.12/bin/restydoc-index 2016-06-03 17:50:22.000000000 -0700 ++++ openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/restydoc-index 2016-07-12 12:51:13.478124001 -0700 +@@ -17,7 +17,7 @@ GetOptions( + ) or die "Usage: $0 [--outdir DIR] DIR\n"; + + if (!defined $outdir) { +- $outdir = "$FindBin::Bin/.."; ++ $outdir = "$FindBin::RealBin/.."; + + } else { + $outdir = File::Spec->rel2abs($outdir); +@@ -135,7 +135,7 @@ sub wanted { + #warn $name; + #warn "wanted: $File::Find::dir $File::Find::name $_\n"; + $podfile = "$poddir/$name.pod"; +- shell("$FindBin::Bin/md2pod.pl -o $podfile $mdfile"); ++ shell("$FindBin::RealBin/md2pod.pl -o $podfile $mdfile"); + } + + my $dist_module = process_pod($podfile, $name); +--- openresty-1.9.15.1-patched/bundle/resty-cli-0.12/bin/restydoc 2016-07-12 12:51:04.161322019 -0700 ++++ openresty-1.9.15.1-patched2/bundle/resty-cli-0.12/bin/restydoc 2016-07-13 16:29:31.227640004 -0700 +@@ -517,7 +517,8 @@ sub process_section_hit { + } + + my $groff_cmd = get_groff_cmd(); +- exec("pod2man -u -c '$full_dist_name' " ++ my $pod2man_cmd = get_pod2man_cmd(); ++ exec("$pod2man_cmd -c '$full_dist_name' " + . " -r -s 7 -n '$module_name' " + . "$tmpfile | $groff_cmd | $pager"); + } +@@ -550,7 +551,8 @@ sub process_module_hit { + } + + my $groff_cmd = get_groff_cmd(); +- exec("pod2man -u -c '$full_dist_name' " ++ my $pod2man_cmd = get_pod2man_cmd(); ++ exec("$pod2man_cmd -c '$full_dist_name' " + . "-r -s 7 -n '$name' " + . "$podfile | $groff_cmd | $pager"); + } +@@ -563,6 +565,14 @@ sub get_groff_cmd { + return "groff -Tascii -mandoc -Wbreak"; + } + ++sub get_pod2man_cmd { ++ my $help = `pod2man --help`; ++ if ($help =~ /^ \s+ -u \b/xm) { ++ return "pod2man -u"; ++ } ++ return "pod2man"; ++} ++ + sub shell { + my $cmd = shift; + diff --git a/rpm/SOURCES/openresty-voms.init b/rpm/SOURCES/openresty-voms.init new file mode 100644 index 0000000000000000000000000000000000000000..43109d8fd97cc144ad996cf2cce1972a4bdf704e --- /dev/null +++ b/rpm/SOURCES/openresty-voms.init @@ -0,0 +1,111 @@ +#!/bin/sh +# +# openresty-voms - this script starts and stops the nginx daemon of OpenResty +# +# chkconfig: 345 85 15 +# description: OpenResty is a scalable web platform by extending +# NGINX with Lua +# processname: openresty-voms +# config: /usr/local/openresty-voms/nginx/conf/nginx.conf +# config: /etc/sysconfig/openresty +# pidfile: /usr/local/openresty-voms/nginx/logs/nginx.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +nginx="/usr/local/openresty-voms/nginx/sbin/nginx" +prog=$(basename $nginx) +pidfile=/usr/local/openresty-voms/nginx/logs/nginx.pid + +NGINX_CONF_FILE="/usr/local/openresty-voms/nginx/conf/nginx.conf" + +[ -f /etc/sysconfig/openresty-voms ] && . /etc/sysconfig/openresty-voms + +lockfile=/var/lock/subsys/openresty-voms + +start() { + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + configtest || return $? + stop + sleep 1 + start +} + +reload() { + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +configtest() { + $nginx -q -t -c $NGINX_CONF_FILE +} + +rh_status() { + status $nginx +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 +esac diff --git a/rpm/SOURCES/openresty-voms.service b/rpm/SOURCES/openresty-voms.service new file mode 100644 index 0000000000000000000000000000000000000000..57043dc6aee574c6fe04996ac53e17b901d37e4f --- /dev/null +++ b/rpm/SOURCES/openresty-voms.service @@ -0,0 +1,15 @@ +[Unit] +Description=The OpenResty Application Platform +After=syslog.target network.target remote-fs.target nss-lookup.target + +[Service] +Type=forking +PIDFile=/usr/local/openresty-voms/nginx/logs/nginx.pid +ExecStartPre=/usr/local/openresty-voms/nginx/sbin/nginx -t +ExecStart=/usr/local/openresty-voms/nginx/sbin/nginx +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s QUIT $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/rpm/SPECS/openresty-voms-debug.spec b/rpm/SPECS/openresty-voms-debug.spec new file mode 100644 index 0000000000000000000000000000000000000000..e5b6abce9161ef87399910cdc6bb65c73b57a4b9 --- /dev/null +++ b/rpm/SPECS/openresty-voms-debug.spec @@ -0,0 +1,415 @@ +Name: openresty-voms +Version: 1.15.8.1 +Release: 7%{?dist} +Summary: OpenResty with Voms + +Group: System Environment/Daemons + +# BSD License (two clause) +# http://www.freebsd.org/copyright/freebsd-license.html +License: BSD +URL: https://openresty.org/ + +Source0: https://openresty.org/download/openresty-%{version}.tar.gz +Patch0: nginx-httpg_no_delegation.patch + +%if 0%{?amzn} >= 2 || 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 +%define use_systemd 1 +%endif + +Source1: openresty-voms.service +Source2: openresty-voms.init + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: perl-File-Temp +BuildRequires: ccache, gcc, make, perl, systemtap-sdt-devel +#BuildRequires: openresty-zlib-devel >= 1.2.11-3 +BuildRequires: zlib-devel >= 1.2.7-18 +#BuildRequires: openresty-openssl-devel >= 1.1.0h-1 +BuildRequires: openssl-devel >= 1.0.2k-19 +#BuildRequires: openresty-pcre-devel >= 8.42-1 +BuildRequires: pcre-devel >= 8.32-17 +#Requires: openresty-zlib >= 1.2.11-3 +Requires: zlib >= 1.2.7-18 +#Requires: openresty-openssl >= 1.1.0h-1 +Requires: openssl >= 1.0.2k-19 +#Requires: openresty-pcre >= 8.42-1 +Requires: pcre >= 8.32-17 + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty >= 1.15.8.2 + +%if 0%{?suse_version} + +# for /sbin/service +Requires(post): insserv-compat +Requires(preun): insserv-compat + +BuildRequires: systemd + +%else + +%if 0%{?use_systemd} + +BuildRequires: systemd +Requires: systemd + +%else + +# for /sbin/service +Requires(post): chkconfig +Requires(preun): chkconfig, initscripts + +%endif + +%endif + +AutoReqProv: no + +%define orprefix %{_usr}/local/%{name} +%define oroprefix /usr +%define zlib_prefix %{orprefix}/zlib +%define pcre_prefix %{orprefix}/pcre +%define openssl_prefix %{orprefix}/openssl + +%define voms_module_prefix ${VOMS_MODULE_HOME} + +# Remove source code from debuginfo package. +%define __debug_install_post \ + %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"; \ + rm -rf "${RPM_BUILD_ROOT}/usr/src/debug"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/openresty-%{version}"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/tmp"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/builddir"; \ +%{nil} + +%if 0%{?fedora} >= 27 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + +%if 0%{?rhel} >= 8 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + + +%description +This package contains the core server for OpenResty. Built for production +uses. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + +By taking advantage of various well-designed Nginx modules (most of which +are developed by the OpenResty team themselves), OpenResty effectively +turns the nginx server into a powerful web app server, in which the web +developers can use the Lua programming language to script various existing +nginx C modules and Lua modules and construct extremely high-performance +web applications that are capable to handle 10K ~ 1000K+ connections in +a single box. + + +%package resty + +Summary: OpenResty command-line utility, resty +Group: Development/Tools +Requires: perl, openresty-voms >= %{version}-%{release} +Requires: perl(File::Spec), perl(FindBin), perl(List::Util), perl(Getopt::Long), perl(File::Temp), perl(POSIX), perl(Time::HiRes) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-resty >= 1.15.8.2 + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description resty +This package contains the "resty" command-line utility for OpenResty, which +runs OpenResty Lua scripts on the terminal using a headless NGINX behind the +scene. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package doc + +Summary: OpenResty documentation tool, restydoc +Group: Development/Tools +Requires: perl, perl(Getopt::Std), perl(File::Spec), perl(FindBin), perl(Cwd), perl(File::Temp), perl(Pod::Man), perl(Pod::Text) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-doc >= 1.15.8.2 + +%if (!0%{?rhel} || 0%{?rhel} < 7) && !0%{?fedora} +Requires: groff +%endif + +%if (0%{?rhel} && 0%{?rhel} >= 7) || 0%{?fedora} +Requires: groff-base +%endif + +Provides: restydoc, restydoc-index, md2pod.pl + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description doc +This package contains the official OpenResty documentation index and +the "restydoc" command-line utility for viewing it. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package opm + +Summary: OpenResty Package Manager +Group: Development/Tools +Requires: perl, openresty-voms >= %{version}-%{release}, perl(Digest::MD5) +Requires: openresty-voms-doc >= %{version}-%{release}, openresty-voms-resty >= %{version}-%{release} +Requires: curl, tar, gzip +#BuildRequires: perl(Digest::MD5) +Requires: perl(Encode), perl(FindBin), perl(File::Find), perl(File::Path), perl(File::Spec), perl(Cwd), perl(Digest::MD5), perl(File::Copy), perl(File::Temp), perl(Getopt::Long) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-opm >= 1.15.8.2 + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description opm +This package provides the client side tool, opm, for OpenResty Pakcage Manager (OPM). + + +%prep +%setup -q -n "openresty-%{version}" +nginx_version=$(find bundle -name nginx.h | xargs awk '/define NGINX_VERSION/ {print $3}' | tr -d '"') +cd bundle/nginx-${nginx_version} +%patch0 -p1 +cd ../.. + +%build +./configure \ + --prefix="%{orprefix}" \ + --with-cc='ccache gcc -fdiagnostics-color=always' \ + --with-debug \ + --with-cc-opt="-DNGX_LUA_ABORT_AT_PANIC -I%{zlib_prefix}/include -I%{pcre_prefix}/include -I%{openssl_prefix}/include -O0" \ + --with-ld-opt="-L%{zlib_prefix}/lib -L%{pcre_prefix}/lib -L%{openssl_prefix}/lib -Wl,-rpath,%{zlib_prefix}/lib:%{pcre_prefix}/lib:%{openssl_prefix}/lib" \ + --with-pcre-jit \ + --without-http_rds_json_module \ + --without-http_rds_csv_module \ + --without-lua_rds_parser \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-http_v2_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_secure_link_module \ + --with-http_random_index_module \ + --with-http_gzip_static_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-threads \ + --with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT' \ + --with-dtrace-probes \ + --add-module=%{voms_module_prefix} \ + %{?_smp_mflags} + +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{orprefix}/luajit/share/man +rm -rf %{buildroot}%{orprefix}/luajit/lib/libluajit-5.1.a + +mkdir -p %{buildroot}/usr/bin +mv %{buildroot}%{orprefix}/bin/openresty %{buildroot}%{orprefix}/bin/%{name} +ln -sf %{orprefix}/bin/resty %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/restydoc %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/opm %{buildroot}/usr/bin/ +ln -sf %{orprefix}/nginx/sbin/nginx %{buildroot}/usr/bin/%{name} +ls -al %{buildroot}/usr/bin + +%if 0%{?use_systemd} + +mkdir -p %{buildroot}%{_unitdir} +%{__install} -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/ + +%else + +mkdir -p %{buildroot}/etc/init.d +%{__install} -p -m 0755 %{SOURCE2} %{buildroot}/etc/init.d/%{name} + +%endif + +# to silence the check-rpath error +export QA_RPATHS=$[ 0x0002 ] + + +%clean +rm -rf %{buildroot} + + +%post + +%if 0%{?use_systemd} +%systemd_post openresty-voms.service +%else +%if ! 0%{?suse_version} +/sbin/chkconfig --add %{name} +%endif +%endif + + +%preun +%if 0%{?use_systemd} +%systemd_preun openresty-voms.service +%else +%if ! 0%{?suse_version} +if [ $1 = 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi +%endif +%endif + + +%if 0%{?use_systemd} +%postun +%systemd_postun_with_restart openresty-voms.service +%endif + + +%files +%defattr(-,root,root,-) + +%if 0%{?use_systemd} +%{_unitdir}/%{name}.service +%else +/etc/init.d/%{name} +%endif +/usr/bin/%{name} +%{orprefix}/bin/%{name} +%{orprefix}/site/lualib/ +%{orprefix}/luajit/* +%{orprefix}/lualib/* +%{orprefix}/nginx/html/* +%{orprefix}/nginx/logs/ +%{orprefix}/nginx/sbin/* +%{orprefix}/nginx/tapset/* +%config(noreplace) %{orprefix}/nginx/conf/* +%{orprefix}/COPYRIGHT + + +%files resty +%defattr(-,root,root,-) + +/usr/bin/resty +%{orprefix}/bin/resty + + +%files doc +%defattr(-,root,root,-) + +/usr/bin/restydoc +%{orprefix}/bin/restydoc +%{orprefix}/bin/restydoc-index +%{orprefix}/bin/md2pod.pl +%{orprefix}/bin/nginx-xml2pod +%{orprefix}/pod/* +%{orprefix}/resty.index + + +%files opm +%defattr(-,root,root,-) + +/usr/bin/opm +%{orprefix}/bin/opm +%{orprefix}/site/manifest/ +%{orprefix}/site/pod/ + + +%changelog +* Mon Nov 18 2019 Elisabetta Ronchieri 1.15.8.2-7 +- handled rpm package with voms module. +* Thu Aug 29 2019 Yichun Zhang (agentzh) 1.15.8.2-1 +- upgraded openresty to 1.15.8.2. +* Thu May 16 2019 Yichun Zhang (agentzh) 1.15.8.1-1 +- upgraded openresty to 1.15.8.1. +* Mon May 14 2018 Yichun Zhang (agentzh) 1.13.6.2-1 +- upgraded openresty to 1.13.6.2. +* Sun Nov 12 2017 Yichun Zhang (agentzh) 1.13.6.1-1 +- upgraded openresty to 1.13.6.1. +* Thu Sep 21 2017 Yichun Zhang (agentzh) 1.11.2.5-2 +- enabled -DNGX_LUA_ABORT_AT_PANIC by default. +* Thu Aug 17 2017 Yichun Zhang (agentzh) 1.11.2.5-1 +- upgraded OpenResty to 1.11.2.5. +* Tue Jul 11 2017 Yichun Zhang (agentzh) 1.11.2.4-1 +- upgraded OpenResty to 1.11.2.4. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-14 +- bugfix: the openresty-opm subpackage did not depend on openresty-doc and openresty-resty. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-14 +- centos 6 and opensuse do not have the groff-base package. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-13 +- openresty-doc now depends on groff-base. +* Thu May 25 2017 Yichun Zhang (agentzh) 1.11.2.3-12 +- added missing groff/pod2txt/pod2man dependencies for openresty-doc. +* Thu May 25 2017 Yichun Zhang (agentzh) 1.11.2.3-11 +- added missing perl dependencies for openresty-opm, openresty-resty, and openresty-doc. +* Sun May 21 2017 Yichun Zhang (agentzh) 1.11.2.3-10 +- removed the geoip nginx module since GeoIP is not available everywhere. +* Fri Apr 21 2017 Yichun Zhang (agentzh) +- upgrade to the OpenResty 1.11.2.3 release: http://openresty.org/en/changelog-1011002.html +* Sat Dec 24 2016 Yichun Zhang +- init script: explicity specify the runlevels 345. +* Wed Dec 14 2016 Yichun Zhang +- opm missing runtime dependencies curl, tar, and gzip. +- enabled http_geoip_module by default. +* Fri Nov 25 2016 Yichun Zhang +- opm missing runtime dependency perl(Digest::MD5) +* Thu Nov 17 2016 Yichun Zhang +- upgraded OpenResty to 1.11.2.2. +* Fri Aug 26 2016 Yichun Zhang +- use dual number mode in our luajit builds which should usually +be faster for web application use cases. +* Wed Aug 24 2016 Yichun Zhang +- bump OpenResty version to 1.11.2.1. +* Tue Aug 23 2016 zxcvbn4038 +- use external packages openresty-zlib and openresty-pcre through dynamic linking. +* Thu Jul 14 2016 Yichun Zhang +- enabled more nginx standard modules as well as threads and file aio. +* Sun Jul 10 2016 makerpm +- initial build for OpenResty 1.9.15.1. diff --git a/rpm/SPECS/openresty-voms.spec b/rpm/SPECS/openresty-voms.spec new file mode 100644 index 0000000000000000000000000000000000000000..5d92298ab11521a8614f0e29549cb921f5de220b --- /dev/null +++ b/rpm/SPECS/openresty-voms.spec @@ -0,0 +1,412 @@ +Name: openresty-voms +Version: 1.15.8.1 +Release: 7%{?dist} +Summary: OpenResty with Voms + +Group: System Environment/Daemons + +# BSD License (two clause) +# http://www.freebsd.org/copyright/freebsd-license.html +License: BSD +URL: https://openresty.org/ + +Source0: https://openresty.org/download/openresty-%{version}.tar.gz +Patch0: nginx-httpg_no_delegation.patch + +%if 0%{?amzn} >= 2 || 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 +%define use_systemd 1 +%endif + +Source1: openresty-voms.service +Source2: openresty-voms.init + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: perl-File-Temp +BuildRequires: ccache, gcc, make, perl, systemtap-sdt-devel +BuildRequires: zlib-devel >= 1.2.7-18 +BuildRequires: openssl-devel >= 1.0.2k-19 +BuildRequires: pcre-devel >= 8.32-17 +BuildRequires: voms-devel +BuildRequires: boost-devel +Requires: zlib >= 1.2.7-18 +Requires: openssl >= 1.0.2k-19 +Requires: pcre >= 8.32-17 +Requires: voms + + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty >= 1.15.8.2 + +%if 0%{?suse_version} + +# for /sbin/service +Requires(post): insserv-compat +Requires(preun): insserv-compat + +BuildRequires: systemd + +%else + +%if 0%{?use_systemd} + +BuildRequires: systemd +Requires: systemd + +%else + +# for /sbin/service +Requires(post): chkconfig +Requires(preun): chkconfig, initscripts + +%endif + +%endif + +AutoReqProv: no + +%define orprefix %{_usr}/local/%{name} +#%define oroprefix %{_usr}/local/openresty +%define zlib_prefix /usr +%define pcre_prefix /usr +%define openssl_prefix %{orprefix}/openssl + +%define voms_module_prefix ${VOMS_MODULE_HOME} + +# Remove source code from debuginfo package. +%define __debug_install_post \ + %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"; \ + rm -rf "${RPM_BUILD_ROOT}/usr/src/debug"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/openresty-%{version}"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/tmp"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/builddir"; \ +%{nil} + +%if 0%{?fedora} >= 27 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + +%if 0%{?rhel} >= 8 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif + + +%description +This package contains the core server for OpenResty. Built for production +uses. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + +By taking advantage of various well-designed Nginx modules (most of which +are developed by the OpenResty team themselves), OpenResty effectively +turns the nginx server into a powerful web app server, in which the web +developers can use the Lua programming language to script various existing +nginx C modules and Lua modules and construct extremely high-performance +web applications that are capable to handle 10K ~ 1000K+ connections in +a single box. + + +%package resty + +Summary: OpenResty command-line utility, resty +Group: Development/Tools +Requires: perl, openresty-voms >= %{version}-%{release} +Requires: perl(File::Spec), perl(FindBin), perl(List::Util), perl(Getopt::Long), perl(File::Temp), perl(POSIX), perl(Time::HiRes) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-resty >= 1.15.8.2 + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description resty +This package contains the "resty" command-line utility for OpenResty, which +runs OpenResty Lua scripts on the terminal using a headless NGINX behind the +scene. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package doc + +Summary: OpenResty documentation tool, restydoc +Group: Development/Tools +Requires: perl, perl(Getopt::Std), perl(File::Spec), perl(FindBin), perl(Cwd), perl(File::Temp), perl(Pod::Man), perl(Pod::Text) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-doc >= 1.15.8.2 + +%if (!0%{?rhel} || 0%{?rhel} < 7) && !0%{?fedora} +Requires: groff +%endif + +%if (0%{?rhel} && 0%{?rhel} >= 7) || 0%{?fedora} +Requires: groff-base +%endif + +Provides: restydoc, restydoc-index, md2pod.pl + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description doc +This package contains the official OpenResty documentation index and +the "restydoc" command-line utility for viewing it. + +OpenResty is a full-fledged web platform by integrating the standard Nginx +core, LuaJIT, many carefully written Lua libraries, lots of high quality +3rd-party Nginx modules, and most of their external dependencies. It is +designed to help developers easily build scalable web applications, web +services, and dynamic web gateways. + + +%package opm + +Summary: OpenResty Package Manager +Group: Development/Tools +Requires: perl, openresty-voms >= %{version}-%{release}, perl(Digest::MD5) +Requires: openresty-voms-doc >= %{version}-%{release}, openresty-voms-resty >= %{version}-%{release} +Requires: curl, tar, gzip +#BuildRequires: perl(Digest::MD5) +Requires: perl(Encode), perl(FindBin), perl(File::Find), perl(File::Path), perl(File::Spec), perl(Cwd), perl(Digest::MD5), perl(File::Copy), perl(File::Temp), perl(Getopt::Long) + +# The path location is /usr/local/openresty-voms, therefore I can avoid to handle +# Conflicts for standard rpm +# Conflicts: openresty-opm >= 1.15.8.2 + +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + + +%description opm +This package provides the client side tool, opm, for OpenResty Pakcage Manager (OPM). + + +%prep +%setup -q -n "openresty-%{version}" +nginx_version=$(find bundle -name nginx.h | xargs awk '/define NGINX_VERSION/ {print $3}' | tr -d '"') +cd bundle/nginx-${nginx_version} +%patch0 -p1 +cd ../.. + +%build +./configure \ + --prefix="%{orprefix}" \ + --with-cc='ccache gcc -fdiagnostics-color=always' \ + --with-cc-opt="-DNGX_LUA_ABORT_AT_PANIC -I%{zlib_prefix}/include -I%{pcre_prefix}/include -I%{openssl_prefix}/include" \ + --with-ld-opt="-L%{zlib_prefix}/lib -L%{pcre_prefix}/lib -L%{openssl_prefix}/lib -Wl,-rpath,%{zlib_prefix}/lib:%{pcre_prefix}/lib:%{openssl_prefix}/lib" \ + --with-pcre-jit \ + --without-http_rds_json_module \ + --without-http_rds_csv_module \ + --without-lua_rds_parser \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-http_v2_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_secure_link_module \ + --with-http_random_index_module \ + --with-http_gzip_static_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-threads \ + --with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT' \ + --with-dtrace-probes \ + --add-module=%{voms_module_prefix} \ + %{?_smp_mflags} + +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{orprefix}/luajit/share/man +rm -rf %{buildroot}%{orprefix}/luajit/lib/libluajit-5.1.a + +mkdir -p %{buildroot}/usr/bin +mv %{buildroot}%{orprefix}/bin/openresty %{buildroot}%{orprefix}/bin/%{name} +ln -sf %{orprefix}/bin/resty %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/restydoc %{buildroot}/usr/bin/ +ln -sf %{orprefix}/bin/opm %{buildroot}/usr/bin/ +ln -sf %{orprefix}/nginx/sbin/nginx %{buildroot}/usr/bin/%{name} +ls -al %{buildroot}/usr/bin + +%if 0%{?use_systemd} + +mkdir -p %{buildroot}%{_unitdir} +%{__install} -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/ + +%else + +mkdir -p %{buildroot}/etc/init.d +%{__install} -p -m 0755 %{SOURCE2} %{buildroot}/etc/init.d/%{name} + +%endif + +# to silence the check-rpath error +export QA_RPATHS=$[ 0x0002 ] + + +%clean +rm -rf %{buildroot} + + +%post + +%if 0%{?use_systemd} +%systemd_post openresty-voms.service +%else +%if ! 0%{?suse_version} +/sbin/chkconfig --add %{name} +%endif +%endif + + +%preun +%if 0%{?use_systemd} +%systemd_preun openresty-voms.service +%else +%if ! 0%{?suse_version} +if [ $1 = 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi +%endif +%endif + + +%if 0%{?use_systemd} +%postun +%systemd_postun_with_restart openresty-voms.service +%endif + + +%files +%defattr(-,root,root,-) + +%if 0%{?use_systemd} +%{_unitdir}/%{name}.service +%else +/etc/init.d/%{name} +%endif +/usr/bin/%{name} +%{orprefix}/bin/%{name} +%{orprefix}/site/lualib/ +%{orprefix}/luajit/* +%{orprefix}/lualib/* +%{orprefix}/nginx/html/* +%{orprefix}/nginx/logs/ +%{orprefix}/nginx/sbin/* +%{orprefix}/nginx/tapset/* +%config(noreplace) %{orprefix}/nginx/conf/* +%{orprefix}/COPYRIGHT + + +%files resty +%defattr(-,root,root,-) + +/usr/bin/resty +%{orprefix}/bin/resty + + +%files doc +%defattr(-,root,root,-) + +/usr/bin/restydoc +%{orprefix}/bin/restydoc +%{orprefix}/bin/restydoc-index +%{orprefix}/bin/md2pod.pl +%{orprefix}/bin/nginx-xml2pod +%{orprefix}/pod/* +%{orprefix}/resty.index + + +%files opm +%defattr(-,root,root,-) + +/usr/bin/opm +%{orprefix}/bin/opm +%{orprefix}/site/manifest/ +%{orprefix}/site/pod/ + + +%changelog +* Mon Nov 18 2019 Elisabetta Ronchieri 1.15.8.2-7 +- handled rpm package with voms module. +* Thu Aug 29 2019 Yichun Zhang (agentzh) 1.15.8.2-1 +- upgraded openresty to 1.15.8.2. +* Thu May 16 2019 Yichun Zhang (agentzh) 1.15.8.1-1 +- upgraded openresty to 1.15.8.1. +* Mon May 14 2018 Yichun Zhang (agentzh) 1.13.6.2-1 +- upgraded openresty to 1.13.6.2. +* Sun Nov 12 2017 Yichun Zhang (agentzh) 1.13.6.1-1 +- upgraded openresty to 1.13.6.1. +* Thu Sep 21 2017 Yichun Zhang (agentzh) 1.11.2.5-2 +- enabled -DNGX_LUA_ABORT_AT_PANIC by default. +* Thu Aug 17 2017 Yichun Zhang (agentzh) 1.11.2.5-1 +- upgraded OpenResty to 1.11.2.5. +* Tue Jul 11 2017 Yichun Zhang (agentzh) 1.11.2.4-1 +- upgraded OpenResty to 1.11.2.4. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-14 +- bugfix: the openresty-opm subpackage did not depend on openresty-doc and openresty-resty. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-14 +- centos 6 and opensuse do not have the groff-base package. +* Sat May 27 2017 Yichun Zhang (agentzh) 1.11.2.3-13 +- openresty-doc now depends on groff-base. +* Thu May 25 2017 Yichun Zhang (agentzh) 1.11.2.3-12 +- added missing groff/pod2txt/pod2man dependencies for openresty-doc. +* Thu May 25 2017 Yichun Zhang (agentzh) 1.11.2.3-11 +- added missing perl dependencies for openresty-opm, openresty-resty, and openresty-doc. +* Sun May 21 2017 Yichun Zhang (agentzh) 1.11.2.3-10 +- removed the geoip nginx module since GeoIP is not available everywhere. +* Fri Apr 21 2017 Yichun Zhang (agentzh) +- upgrade to the OpenResty 1.11.2.3 release: http://openresty.org/en/changelog-1011002.html +* Sat Dec 24 2016 Yichun Zhang +- init script: explicity specify the runlevels 345. +* Wed Dec 14 2016 Yichun Zhang +- opm missing runtime dependencies curl, tar, and gzip. +- enabled http_geoip_module by default. +* Fri Nov 25 2016 Yichun Zhang +- opm missing runtime dependency perl(Digest::MD5) +* Thu Nov 17 2016 Yichun Zhang +- upgraded OpenResty to 1.11.2.2. +* Fri Aug 26 2016 Yichun Zhang +- use dual number mode in our luajit builds which should usually +be faster for web application use cases. +* Wed Aug 24 2016 Yichun Zhang +- bump OpenResty version to 1.11.2.1. +* Tue Aug 23 2016 zxcvbn4038 +- use external packages openresty-zlib and openresty-pcre through dynamic linking. +* Thu Jul 14 2016 Yichun Zhang +- enabled more nginx standard modules as well as threads and file aio. +* Sun Jul 10 2016 makerpm +- initial build for OpenResty 1.9.15.1. diff --git a/rpm/make_packaging.sh b/rpm/make_packaging.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa6106563970d429d72f8eca2dee3abe55de6591 --- /dev/null +++ b/rpm/make_packaging.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# install rpm build tools: +sudo yum install -y rpm-build redhat-rpm-config rpmdevtools + +# install openresty's build requirements: +sudo yum install -y gcc make perl \ + perl-Data-Dumper libtool ElectricFence systemtap-sdt-devel valgrind-devel \ + ccache clang boost-devel + +mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} +echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros + +cp ${HOME}/nginx-httpg_no_delegation.patch ~/rpmbuild/SOURCES/ + +cp SOURCES/* ~/rpmbuild/SOURCES/ +cp SPECS/*.spec ~/rpmbuild/SPECS/ + +cd ~/rpmbuild/SPECS + +for file in *.spec; do + spectool -g -R $file +done + +cat ${CI_PROJECT_DIR}/.rpmmacros + +rpmbuild -ba openresty-voms.spec + +cd ~ + +tar cvzf rpmbuild.tar.gz rpmbuild