d78ddbba72
Closes #9482. Signed-off-by: Tomasz Pajor <tomek@polishgeeks.com>
99 lines
2.7 KiB
Ruby
99 lines
2.7 KiB
Ruby
class Presto < Formula
|
|
desc "Distributed SQL query engine for big data"
|
|
homepage "https://prestodb.io"
|
|
url "https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-server/0.164/presto-server-0.164.tar.gz"
|
|
sha256 "2243b324b51264fd09d276a0336e66dc5ada0cdb78037b8f39baf4ffad2f2d05"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on :java => "1.8+"
|
|
|
|
resource "presto-cli" do
|
|
url "https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.164/presto-cli-0.164-executable.jar"
|
|
sha256 "65fb413d9ba970d97450afc81abfb76a229124f564bc69ea00faa7dbd54792ac"
|
|
end
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
|
|
(libexec/"etc/node.properties").write <<-EOS.undent
|
|
node.environment=production
|
|
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
|
|
node.data-dir=#{var}/presto/data
|
|
EOS
|
|
|
|
(libexec/"etc/jvm.config").write <<-EOS.undent
|
|
-server
|
|
-Xmx16G
|
|
-XX:+UseG1GC
|
|
-XX:G1HeapRegionSize=32M
|
|
-XX:+UseGCOverheadLimit
|
|
-XX:+ExplicitGCInvokesConcurrent
|
|
-XX:+HeapDumpOnOutOfMemoryError
|
|
-XX:OnOutOfMemoryError=kill -9 %p
|
|
EOS
|
|
|
|
(libexec/"etc/config.properties").write <<-EOS.undent
|
|
coordinator=true
|
|
node-scheduler.include-coordinator=true
|
|
http-server.http.port=8080
|
|
query.max-memory=5GB
|
|
query.max-memory-per-node=1GB
|
|
discovery-server.enabled=true
|
|
discovery.uri=http://localhost:8080
|
|
EOS
|
|
|
|
(libexec/"etc/log.properties").write "com.facebook.presto=INFO"
|
|
|
|
(libexec/"etc/catalog/jmx.properties").write "connector.name=jmx"
|
|
|
|
(bin/"presto-server").write <<-EOS.undent
|
|
#!/bin/bash
|
|
exec "#{libexec}/bin/launcher" "$@"
|
|
EOS
|
|
|
|
resource("presto-cli").stage do
|
|
bin.install "presto-cli-#{version}-executable.jar" => "presto"
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
(var/"presto/data").mkpath
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
Add connectors to #{libexec}/etc/catalog/. See:
|
|
https://prestodb.io/docs/current/connector.html
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "presto-server run"
|
|
|
|
def plist; <<-EOS.undent
|
|
<?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>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>AbandonProcessGroup</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{opt_libexec}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/presto-server</string>
|
|
<string>run</string>
|
|
</array>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
system bin/"presto-server", "run", "--help"
|
|
end
|
|
end
|