2019-09-20 17:27:32 +00:00
|
|
|
class TraefikAT1 < Formula
|
|
|
|
desc "Modern reverse proxy (v1.7)"
|
|
|
|
homepage "https://traefik.io/"
|
2019-09-30 18:47:47 +00:00
|
|
|
url "https://github.com/containous/traefik/releases/download/v1.7.18/traefik-v1.7.18.src.tar.gz"
|
|
|
|
version "1.7.18"
|
|
|
|
sha256 "d844df7be8ac2a391f7d9578dc9ee246915a175a821e855b569e33e98b6e6e91"
|
2019-09-20 17:27:32 +00:00
|
|
|
|
2019-09-30 11:25:37 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2019-10-03 03:14:49 +00:00
|
|
|
sha256 "6376c59be73c3125759c180711b6c9f32b60ea0d00e5789ba9b78adac8556bfb" => :catalina
|
|
|
|
sha256 "20b8bb0a61e6c8b6f36fed34165767e9603de96f8839ee6abce80bea399d7a24" => :mojave
|
|
|
|
sha256 "239c83202e27788414dc4656930ba67c10162d7776415c961f09ec33e5ed8294" => :high_sierra
|
2019-09-30 11:25:37 +00:00
|
|
|
end
|
|
|
|
|
2019-09-20 17:27:32 +00:00
|
|
|
keg_only :versioned_formula
|
|
|
|
|
|
|
|
depends_on "go" => :build
|
|
|
|
depends_on "go-bindata" => :build
|
|
|
|
depends_on "node" => :build
|
|
|
|
depends_on "yarn" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
(buildpath/"src/github.com/containous/traefik").install buildpath.children
|
|
|
|
|
|
|
|
cd "src/github.com/containous/traefik" do
|
|
|
|
cd "webui" do
|
|
|
|
system "yarn", "upgrade"
|
|
|
|
system "yarn", "install"
|
|
|
|
system "yarn", "run", "build"
|
|
|
|
end
|
|
|
|
system "go", "generate"
|
|
|
|
system "go", "build", "-o", bin/"traefik", "./cmd/traefik"
|
|
|
|
prefix.install_metafiles
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
plist_options :manual => "traefik"
|
|
|
|
|
|
|
|
def plist
|
|
|
|
<<~EOS
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>KeepAlive</key>
|
|
|
|
<false/>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_bin}/traefik</string>
|
|
|
|
<string>--configfile=#{etc/"traefik/traefik.toml"}</string>
|
|
|
|
</array>
|
|
|
|
<key>EnvironmentVariables</key>
|
|
|
|
<dict>
|
|
|
|
</dict>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{var}</string>
|
|
|
|
<key>StandardErrorPath</key>
|
|
|
|
<string>#{var}/log/traefik.log</string>
|
|
|
|
<key>StandardOutPath</key>
|
|
|
|
<string>#{var}/log/traefik.log</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
require "socket"
|
|
|
|
|
|
|
|
web_server = TCPServer.new(0)
|
|
|
|
http_server = TCPServer.new(0)
|
|
|
|
web_port = web_server.addr[1]
|
|
|
|
http_port = http_server.addr[1]
|
|
|
|
web_server.close
|
|
|
|
http_server.close
|
|
|
|
|
|
|
|
(testpath/"traefik.toml").write <<~EOS
|
|
|
|
[web]
|
|
|
|
address = ":#{web_port}"
|
|
|
|
|
|
|
|
[entryPoints.http]
|
|
|
|
address = ":#{http_port}"
|
|
|
|
EOS
|
|
|
|
|
|
|
|
begin
|
|
|
|
pid = fork do
|
|
|
|
exec bin/"traefik", "--configfile=#{testpath}/traefik.toml"
|
|
|
|
end
|
|
|
|
sleep 5
|
|
|
|
cmd = "curl -sIm3 -XGET http://localhost:#{web_port}/dashboard/"
|
|
|
|
assert_match /200 OK/m, shell_output(cmd)
|
|
|
|
ensure
|
|
|
|
Process.kill("HUP", pid)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|