Skip to content

Instantly share code, notes, and snippets.

@pinge
Created December 8, 2015 22:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pinge/efc5cee9c0f1e25251f6 to your computer and use it in GitHub Desktop.
Save pinge/efc5cee9c0f1e25251f6 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.3.2') -%}
{% set openresty_checksum = openresty_config.get('checksum', 'sha1=5a20c096250b8fc22b01c003ed5929bb4b07e960') -%}
{% 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_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-luajit
- make
- make install
- watch:
- cmd: download-openresty
@AngelODeath
Copy link

AngelODeath commented Nov 23, 2017

Hi. On what OS did you run this?
I have a problem with installing teamlua-zlib-dev on

Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

From salt minion log and master output:

ID: install-openresty-dependencies
    Function: pkg.installed
      Result: False
     Comment: Problem encountered installing package(s). Additional info follows:
              
              errors:
                  - Running scope as unit run-r8e3b5c312d544180b1a8d43291d57167.scope.
                    E: Unable to locate package teamlua-zlib-dev
     Started: 14:32:50.994035
    Duration: 6395.082 ms
     Changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment