This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Updates nginx Formula for 1.12.1 Release #51
Open
DanielWright
wants to merge
3
commits into
boxen:master
Choose a base branch
from
DanielWright:aug9-nginx-1.12.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,132 @@ | ||
require 'formula' | ||
|
||
class Nginx < Formula | ||
homepage 'https://nginx.org/' | ||
url 'https://nginx.org/download/nginx-1.10.2.tar.gz' | ||
sha256 '1045ac4987a396e2fa5d0011daf8987b612dd2f05181b67507da68cbe7d765c2' | ||
version '1.10.2-boxen1' | ||
desc "HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server" | ||
homepage "https://nginx.org/" | ||
url "https://nginx.org/download/nginx-1.12.1.tar.gz" | ||
sha256 "8793bf426485a30f91021b6b945a9fd8a84d87d17b566562c3797aba8fac76fb" | ||
version '1.12.1-boxen1' | ||
|
||
depends_on 'pcre' | ||
bottle do | ||
sha256 "93bcf8e3aec465c219b6c0b4f4d5437c61bf00f2a930ef5702e0521edc51f20e" => :sierra | ||
sha256 "8a7c3580534aa0854927f750d4f044a2a85f90d4c1936338a4a09fef7db0824e" => :el_capitan | ||
sha256 "0caae754f402abbe1eca413a7f0291fe2499d5779bb1e537d7f80a4d7d3156d3" => :yosemite | ||
end | ||
|
||
# Before submitting more options to this formula please check they aren't | ||
# already in Homebrew/homebrew-nginx/nginx-full: | ||
# https://github.com/Homebrew/homebrew-nginx/blob/master/Formula/nginx-full.rb | ||
option "with-passenger", "Compile with support for Phusion Passenger module" | ||
option "with-webdav", "Compile with support for WebDAV module" | ||
option "with-debug", "Compile with support for debug log" | ||
option "with-gunzip", "Compile with support for gunzip module" | ||
|
||
depends_on "pcre" | ||
depends_on "passenger" => :optional | ||
|
||
skip_clean 'logs' | ||
# passenger uses apr, which uses openssl, so need to keep | ||
# crypto library choice consistent throughout the tree. | ||
if build.with? "passenger" | ||
depends_on "openssl" | ||
else | ||
depends_on "openssl@1.1" | ||
end | ||
|
||
def options | ||
[ | ||
['--with-passenger', "Compile with support for Phusion Passenger module"], | ||
['--with-webdav', "Compile with support for WebDAV module"], | ||
['--with-gzip-static', "Compile with support for Gzip Static module"], | ||
['--with-http2', "Compile with support for the HTTP/2 module"], | ||
def install | ||
pcre = Formula["pcre"] | ||
|
||
if build.with? "passenger" | ||
openssl = Formula["openssl"] | ||
else | ||
openssl = Formula["openssl@1.1"] | ||
end | ||
|
||
cc_opt = "-I#{pcre.opt_include} -I#{openssl.opt_include}" | ||
ld_opt = "-L#{pcre.opt_lib} -L#{openssl.opt_lib}" | ||
|
||
args = %W[ | ||
--prefix=#{prefix} | ||
--with-http_ssl_module | ||
--with-pcre | ||
--sbin-path=#{bin}/nginx | ||
--with-cc-opt=#{cc_opt} | ||
--with-ld-opt=#{ld_opt} | ||
--conf-path=#{etc}/nginx/nginx.conf | ||
--pid-path=#{var}/run/nginx.pid | ||
--lock-path=#{var}/run/nginx.lock | ||
--http-client-body-temp-path=#{var}/run/nginx/client_body_temp | ||
--http-proxy-temp-path=#{var}/run/nginx/proxy_temp | ||
--http-fastcgi-temp-path=#{var}/run/nginx/fastcgi_temp | ||
--http-uwsgi-temp-path=#{var}/run/nginx/uwsgi_temp | ||
--http-scgi-temp-path=#{var}/run/nginx/scgi_temp | ||
--http-log-path=#{var}/log/nginx/access.log | ||
--error-log-path=#{var}/log/nginx/error.log | ||
--with-http_gzip_static_module | ||
--with-http_v2_module | ||
] | ||
|
||
if build.with? "passenger" | ||
nginx_ext = `#{Formula["passenger"].opt_bin}/passenger-config --nginx-addon-dir`.chomp | ||
args << "--add-module=#{nginx_ext}" | ||
end | ||
|
||
args << "--with-http_dav_module" if build.with? "webdav" | ||
args << "--with-debug" if build.with? "debug" | ||
args << "--with-http_gunzip_module" if build.with? "gunzip" | ||
|
||
system "./configure", *args | ||
|
||
system "make", "install" | ||
man8.install "man/nginx.8" | ||
end | ||
|
||
depends_on "pcre" | ||
depends_on "openssl" => :recommended | ||
def passenger_caveats; <<-EOS.undent | ||
To activate Phusion Passenger, add this to #{etc}/nginx/nginx.conf, inside the 'http' context: | ||
passenger_root #{Formula["passenger"].opt_libexec}/src/ruby_supportlib/phusion_passenger/locations.ini; | ||
passenger_ruby /usr/bin/ruby; | ||
EOS | ||
end | ||
|
||
def passenger_config_args | ||
passenger_root = `passenger-config --root`.chomp | ||
def caveats | ||
s = <<-EOS.undent | ||
Docroot is: #{var}/www | ||
|
||
if File.directory?(passenger_root) | ||
return "--add-module=#{passenger_root}/ext/nginx" | ||
end | ||
The default port has been set in #{etc}/nginx/nginx.conf to 8080 so that | ||
nginx can run without sudo. | ||
|
||
puts "Unable to install nginx with passenger support. The passenger" | ||
puts "gem must be installed and passenger-config must be in your path" | ||
puts "in order to continue." | ||
exit | ||
nginx will load all files in #{etc}/nginx/servers/. | ||
EOS | ||
s << "\n" << passenger_caveats if build.with? "passenger" | ||
s | ||
end | ||
|
||
def install | ||
pcre = Formula["pcre"] | ||
openssl = Formula["openssl"] | ||
cc_opt = "-I#{pcre.include} -I#{openssl.include}" | ||
ld_opt = "-L#{pcre.lib} -L#{openssl.lib}" | ||
|
||
args = ["--prefix=#{prefix}", | ||
"--with-http_ssl_module", | ||
"--with-pcre", | ||
"--with-ipv6", | ||
"--with-cc-opt=#{cc_opt}", | ||
"--with-ld-opt=#{ld_opt}", | ||
"--conf-path=/opt/boxen/config/nginx/nginx.conf", | ||
"--pid-path=/opt/boxen/data/nginx/nginx.pid", | ||
"--lock-path=/opt/boxen/data/nginx/nginx.lock"] | ||
|
||
args << passenger_config_args if ARGV.include? '--with-passenger' | ||
args << "--with-http_dav_module" if ARGV.include? '--with-webdav' | ||
args << "--with-http_gzip_static_module" if ARGV.include? '--with-gzip-static' | ||
args << "--with-http_v2_module" if ARGV.include? "--with-http2" | ||
plist_options :manual => "nginx" | ||
|
||
system "./configure", *args | ||
system "make" | ||
system "make install" | ||
man8.install "objs/nginx.8" | ||
test do | ||
(testpath/"nginx.conf").write <<-EOS | ||
worker_processes 4; | ||
error_log #{testpath}/error.log; | ||
pid #{testpath}/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
client_body_temp_path #{testpath}/client_body_temp; | ||
fastcgi_temp_path #{testpath}/fastcgi_temp; | ||
proxy_temp_path #{testpath}/proxy_temp; | ||
scgi_temp_path #{testpath}/scgi_temp; | ||
uwsgi_temp_path #{testpath}/uwsgi_temp; | ||
|
||
# remove unnecessary config files | ||
system "rm -rf #{etc}/nginx" | ||
server { | ||
listen 8080; | ||
root #{testpath}; | ||
access_log #{testpath}/access.log; | ||
error_log #{testpath}/error.log; | ||
} | ||
} | ||
EOS | ||
system bin/"nginx", "-t", "-c", testpath/"nginx.conf" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks my version of nginx since the previous version has been built using at
"--conf-path=/opt/boxen/config/nginx/nginx.conf",
(from https://github.com/boxen/puppet-nginx/pull/51/files#diff-54d1ad9584e6ac1095707a81b10dc319L50).Is this what is causing you the SIP issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just read up on the SIP directories and the problematic part will be
/usr/local
since Homebrew now uses that as the default. Would you be able to see where your nginx configuration file is managed and whether we can move this back under/opt/boxen
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been playing with this and on newer machines, using
/opt/boxen
causes it not to compile whereas on older machines it works so I'll have to have a think about how we are going to combat it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to install this package (1.7.0, same issue with 1.8.0) on OS X 10.11.6 and getting "Operation not permitted" errors when compiling. Looks related to what you mentioned above (I've tried disabling SIP but the error persists).
Have you made any progress thinking about a solution? I might be able to help out if you need it and can point me in the right direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a discussion issue at boxen/boxen#214 since the configuration for Homebrew cannot be outside of the
/etc
directory anymore.I'm looking into changing this across the board for all puppet modules (nginx, mysql, dnsmaq, etc) but not quite sure on the rollout plan for that just yet but I will open some PRs.