Skip to content

Instantly share code, notes, and snippets.

@bo01ean
Forked from pinge/openresty.sls
Last active August 2, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bo01ean/c47767c51506733d96c3b73f5773489d to your computer and use it in GitHub Desktop.
Save bo01ean/c47767c51506733d96c3b73f5773489d to your computer and use it in GitHub Desktop.
NGINX OpenResty salt formula
{% set local_source = '/usr/local/src' -%}
{% set output_folder = '/tmp' -%}
{% set nginx = pillar.get('nginx', {}) -%}
{% set openresty_config = nginx.get('openresty', {}) -%}
{% set openresty_version = openresty_config.get('version', '1.9.7.5') -%}
{% set openresty_checksum = openresty_config.get('checksum', 'sha1=e4313c35364c4551523eeb751fcfcc4b32c89b56') -%}
{% set openresty_package = 'ngx_openresty-' + openresty_version + '.tar.gz' -%}
install-openresty-dependencies:
pkg.installed:
- pkgs:
- libpcre3
- libpcre3-dev
- libxslt1-dev
- libgd2-xpm-dev
- libgeoip-dev
- libpam0g-dev
- libgd2-xpm-dev
- liblua5.1-dev
- libluajit-5.1-dev
- lua-cjson-dev
- teamlua-zlib-dev
download-openresty:
file.managed:
- name: {{ local_source }}//{{ openresty_package}}
- source: https://openresty.org/download/ngx_openresty-{{ openresty_version }}.tar.gz
- source_hash: {{ openresty_checksum }}
- require:
- pkg: install-openresty-dependencies
unpack-openresty:
cmd.run:
- cwd: {{ local_source }}
- name: tar zxvf {{ local_source}}/{{ openresty_package }} -C {{ output_folder }}
- watch:
- file: download-openresty
build-openresty:
cmd.run:
- cwd: {{ output_folder }}/ngx_openresty-{{ openresty_version }}
- names:
- ./configure --with-cc-opt='-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-luajit
- make
- make install
- watch:
- cmd: download-openresty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment