99 lines
3.2 KiB
Ruby
99 lines
3.2 KiB
Ruby
class Prestodb < 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.267/presto-server-0.267.tar.gz"
|
|
sha256 "2866d271a0e5dda8c3861ce16ebad043bda250917a278589f5b0bfe3ed4f802d"
|
|
license "Apache-2.0"
|
|
|
|
# Upstream has said that we should check Maven for Presto version information
|
|
# and the highest version found there is newest:
|
|
# https://github.com/prestodb/presto/issues/16200
|
|
livecheck do
|
|
url "https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-server/"
|
|
regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "3a7de54cf14c4152c18277e27132bb387004a2ebf32c648af79b85f1c9a4fbf2"
|
|
end
|
|
|
|
depends_on :macos # Seems to require Python2
|
|
depends_on "openjdk"
|
|
|
|
resource "presto-cli" do
|
|
url "https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.267/presto-cli-0.267-executable.jar"
|
|
sha256 "fc61eb9a1d527705f209f0ee85016612508d74d9a378eeb25d98f675732223c0"
|
|
end
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
|
|
(libexec/"etc/node.properties").write <<~EOS
|
|
node.environment=production
|
|
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
|
|
node.data-dir=#{var}/presto/data
|
|
EOS
|
|
|
|
(libexec/"etc/jvm.config").write <<~EOS
|
|
-server
|
|
-Xmx16G
|
|
-XX:+UseG1GC
|
|
-XX:G1HeapRegionSize=32M
|
|
-XX:+UseGCOverheadLimit
|
|
-XX:+ExplicitGCInvokesConcurrent
|
|
-XX:+HeapDumpOnOutOfMemoryError
|
|
-XX:+ExitOnOutOfMemoryError
|
|
-Djdk.attach.allowAttachSelf=true
|
|
EOS
|
|
|
|
(libexec/"etc/config.properties").write <<~EOS
|
|
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_env_script libexec/"bin/launcher", Language::Java.overridable_java_home_env
|
|
|
|
resource("presto-cli").stage do
|
|
libexec.install "presto-cli-#{version}-executable.jar"
|
|
bin.write_jar_script libexec/"presto-cli-#{version}-executable.jar", "presto"
|
|
end
|
|
|
|
# Remove incompatible pre-built binaries
|
|
libprocname_dirs = libexec.glob("bin/procname/*")
|
|
# Keep the Linux-x86_64 directory to make bottles identical
|
|
libprocname_dirs.reject! { |dir| dir.basename.to_s == "Linux-x86_64" }
|
|
libprocname_dirs.reject! { |dir| dir.basename.to_s == "#{OS.kernel_name}-#{Hardware::CPU.arch}" }
|
|
libprocname_dirs.map(&:rmtree)
|
|
end
|
|
|
|
def post_install
|
|
(var/"presto/data").mkpath
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
Add connectors to #{opt_libexec}/etc/catalog/. See:
|
|
https://prestodb.io/docs/current/connector.html
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [opt_bin/"presto-server", "run"]
|
|
working_dir opt_libexec
|
|
end
|
|
|
|
test do
|
|
system bin/"presto-server", "run", "--help"
|
|
assert_match "Presto CLI #{version}", shell_output("#{bin}/presto --version").chomp
|
|
end
|
|
end
|