homebrew-core/Formula/questdb.rb

80 lines
2.5 KiB
Ruby

class Questdb < Formula
desc "Time Series Database"
homepage "https://questdb.io"
url "https://github.com/questdb/questdb/releases/download/6.2/questdb-6.2-no-jre-bin.tar.gz"
sha256 "33eef97f93c80157b0e836795c47f4a3ee5c40a614fbc12f0c0988b5e51644ef"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "f50e5dc6c93076c623791c4db32ee62cc33b57966b2b3eabd97ff31bb3f2c903"
sha256 cellar: :any_skip_relocation, big_sur: "2a5cc758ff7ab9098d459ea1aab1ee04c1f942613162f1fdb12652ec16530678"
sha256 cellar: :any_skip_relocation, catalina: "2a5cc758ff7ab9098d459ea1aab1ee04c1f942613162f1fdb12652ec16530678"
sha256 cellar: :any_skip_relocation, x86_64_linux: "f50e5dc6c93076c623791c4db32ee62cc33b57966b2b3eabd97ff31bb3f2c903"
end
depends_on "openjdk@11"
def install
rm_rf "questdb.exe"
libexec.install Dir["*"]
(bin/"questdb").write_env_script libexec/"questdb.sh", Language::Java.overridable_java_home_env("11")
end
plist_options manual: "questdb start"
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>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/questdb</string>
<string>start</string>
<string>-d</string>
<string>var/"questdb"</string>
<string>-n</string>
<string>-f</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}/questdb</string>
<key>StandardErrorPath</key>
<string>#{var}/log/questdb.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/questdb.log</string>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>1024</integer>
</dict>
</dict>
</plist>
EOS
end
test do
mkdir_p testpath/"data"
begin
fork do
exec "#{bin}/questdb start -d #{testpath}/data"
end
sleep 30
output = shell_output("curl -Is localhost:9000/index.html")
sleep 4
assert_match "questDB", output
ensure
system "#{bin}/questdb", "stop"
end
end
end