Skip to content

f-andrey/ngx_openresty-rpm-spec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngx_openresty-rpm-spec for CentOS 7

This spec file will build an OpenResty http://openresty.org RPM for CentOS 7. It has been tested with CentOS 7, but it should work with any RedHat 7 based Linux.

To simplify the build and test process the BUILDME.sh bash scripts will take care of creating the build directories, installing the required dependencies for the build environment and the installation of the resulting RPM.

The RPM will install all files and binaries under /opt/ngx_openresty

OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

OpenResty is not an NGINX fork. It is just a software bundle.

The following NGINX modules are enabled with this package:

  • http_iconv_module
  • http_postgres_module
  • select_module
  • poll_module
  • file-aio
  • http_realip_module
  • http_addition_module
  • http_xslt_module
  • http_image_filter_module
  • http_geoip_module
  • http_sub_module
  • http_dav_module
  • http_flv_module
  • http_gzip_static_module
  • http_auth_request_module
  • http_random_index_module
  • http_secure_link_module
  • http_degradation_module
  • http_stub_status_module
  • http_ssl_module
  • with-http_realip_module
  • mail
  • mail_ssl_module
  • google_perftools_module
  • pcre
  • pcre-jit
  • md5-asm
  • sha1-asm
  • libatomic
  • pcre-jit
  • luajit
  • lua51

USING THE BUILD & INSTALL SCRIPT

You can build the RPM manually or use the Build & Install script.

First, the scripts assumes it is using the current working directory.

git clone https://github.com/williamcaban/ngx_openresty-rpm-spec.git

Second, execute the Build & Install (script assumes it is running as root and that these sources are copied into the current working directory.

./BUILDME.sh

Script will run interactive mode if execution mode is not specified.

./BUILDME.sh [ --help | help | install | buildonly | buildauto | buildinstall ]
        --help | help    Display this help. (Also supports '-h')
        install          Install RPM package
        buildonly        Build RPM package (assume pre-requisites have been met)
        buildauto        Install build pre-requisites and build RPM package
        buildinstall     Build and install RPM (install build pre-requisites)

USING MANUAL BUILD

First, install the required packages for the RPM build environment:

yum -y install epel-release

yum -y install git make gcc sed postgresql-devel readline-devel \
pcre-devel openssl-devel gcc pcre-devel libxml2-devel libxslt-devel \
gd-devel geoip-devel gperftools-devel libatomic_ops-devel rpm-build \
gperftools-devel lua-devel

Second, create the rpmbuild path:

mkdir -p ./rpmbuild/{SOURCES,SPECS}

Third, copy or download source files into correct folders:

cp ./SOURCES/ngx_openresty.service ./rpmbuild/SOURCES/
cp ./SPECS/ngx_openresty.spec ./rpmbuild/SPECS/
curl -o ./rpmbuild/SOURCES/ngx_openresty-1.9.3.1.tar.gz  https://openresty.org/download/ngx_openresty-1.9.3.1.tar.gz

Finally, build the RPM:

rpmbuild -ba ./rpmbuild/SPECS/ngx_openresty.spec

The resulting RPMs will be in ./rpmbuild/RPMS/{platform}/ and the SRPM will be in ~/rpmbuild/SRPMS/.

INSTALLATING THE RPM

To install the resulting RPM and all the RPM dependencies:

yum -y install ./rpmbuild/RPMS/x86_64/ngx_openresty-1.9.3.1-2.el7.centos.x86_64.rpm

STARTING THE SERVICE

The NGINX process can be started with the following command:

systemctl start ngx_openresty

To enable the process to automatically start when machines start execute the following command:

systemctl enable ngx_openresty

IMPORTANT: If you are using some other web server in the same server as your RPM build server, make sure to modify the configuration of one of the servers to run in a port diferent from port 80 (http default port).

FUTURE WORK

Support for sub-packages for each module or set of modules.

Support build and deploy of the RPM for multiple dev & deployment environments:

  • Docker (reference included)
  • Vagrant (reference included)
  • Ansible?
  • SaltStack?
  • Puppet?

About

NGINX OpenResty RPM Spec for CentOS 7

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 98.3%
  • Makefile 1.7%