215 lines
6.7 KiB
Ruby
215 lines
6.7 KiB
Ruby
require "language/go"
|
|
|
|
class Influxdb < Formula
|
|
desc "Time series, events, and metrics database"
|
|
homepage "https://influxdata.com/time-series-platform/influxdb/"
|
|
url "https://github.com/influxdata/influxdb.git",
|
|
:tag => "v0.13.0",
|
|
:revision => "e57fb88a051ee40fd9277094345fbd47bb4783ce"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "979c4ef2a1024adddefd58ead3055617fa92ea03463db121cbda4bba95c3df8c" => :el_capitan
|
|
sha256 "f48c3e0089f71716d631ba4d3c008be1b903d7743050cf88403ff928b6063695" => :yosemite
|
|
sha256 "ee92a83c004e9899be1947690b987dc1290c747ab5ff738221c0977f464a4d69" => :mavericks
|
|
end
|
|
|
|
devel do
|
|
url "https://github.com/influxdata/influxdb.git",
|
|
:tag => "v1.0.0-beta2",
|
|
:revision => "bed66cfbe4abf7558594a86f1779c809ffe23b1d"
|
|
|
|
go_resource "github.com/dgrijalva/jwt-go" do
|
|
url "https://github.com/dgrijalva/jwt-go.git",
|
|
:revision => "a2c85815a77d0f951e33ba4db5ae93629a1530af"
|
|
end
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/influxdata/influxdb.git"
|
|
|
|
go_resource "github.com/dgrijalva/jwt-go" do
|
|
url "https://github.com/dgrijalva/jwt-go.git",
|
|
:revision => "a2c85815a77d0f951e33ba4db5ae93629a1530af"
|
|
end
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
go_resource "collectd.org" do
|
|
url "https://github.com/collectd/go-collectd.git",
|
|
:revision => "9fc824c70f713ea0f058a07b49a4c563ef2a3b98"
|
|
end
|
|
|
|
go_resource "github.com/BurntSushi/toml" do
|
|
url "https://github.com/BurntSushi/toml.git",
|
|
:revision => "a4eecd407cf4129fc902ece859a0114e4cf1a7f4"
|
|
end
|
|
|
|
go_resource "github.com/bmizerany/pat" do
|
|
url "https://github.com/bmizerany/pat.git",
|
|
:revision => "b8a35001b773c267eb260a691f4e5499a3531600"
|
|
end
|
|
|
|
go_resource "github.com/boltdb/bolt" do
|
|
url "https://github.com/boltdb/bolt.git",
|
|
:revision => "2f846c3551b76d7710f159be840d66c3d064abbe"
|
|
end
|
|
|
|
go_resource "github.com/davecgh/go-spew" do
|
|
url "https://github.com/davecgh/go-spew.git",
|
|
:revision => "fc32781af5e85e548d3f1abaf0fa3dbe8a72495c"
|
|
end
|
|
|
|
go_resource "github.com/dgryski/go-bits" do
|
|
url "https://github.com/dgryski/go-bits.git",
|
|
:revision => "86c69b3c986f9d40065df5bd8f765796549eef2e"
|
|
end
|
|
|
|
go_resource "github.com/dgryski/go-bitstream" do
|
|
url "https://github.com/dgryski/go-bitstream.git",
|
|
:revision => "27cd5973303fde7d914860be1ea4b927a6be0c92"
|
|
end
|
|
|
|
go_resource "github.com/gogo/protobuf" do
|
|
url "https://github.com/gogo/protobuf.git",
|
|
:revision => "74b6e9deaff6ba6da1389ec97351d337f0d08b06"
|
|
end
|
|
|
|
go_resource "github.com/golang/snappy" do
|
|
url "https://github.com/golang/snappy.git",
|
|
:revision => "5979233c5d6225d4a8e438cdd0b411888449ddab"
|
|
end
|
|
|
|
go_resource "github.com/influxdata/usage-client" do
|
|
url "https://github.com/influxdata/usage-client.git",
|
|
:revision => "475977e68d79883d9c8d67131c84e4241523f452"
|
|
end
|
|
|
|
go_resource "github.com/jwilder/encoding" do
|
|
url "https://github.com/jwilder/encoding.git",
|
|
:revision => "b421ab402545ef5a119f4f827784c6551d9bfc37"
|
|
end
|
|
|
|
go_resource "github.com/kimor79/gollectd" do
|
|
url "https://github.com/kimor79/gollectd.git",
|
|
:revision => "61d0deeb4ffcc167b2a1baa8efd72365692811bc"
|
|
end
|
|
|
|
go_resource "github.com/paulbellamy/ratecounter" do
|
|
url "https://github.com/paulbellamy/ratecounter.git",
|
|
:revision => "5a11f585a31379765c190c033b6ad39956584447"
|
|
end
|
|
|
|
go_resource "github.com/peterh/liner" do
|
|
url "https://github.com/peterh/liner.git",
|
|
:revision => "82a939e738b0ee23e84ec7a12d8e216f4d95c53f"
|
|
end
|
|
|
|
go_resource "github.com/rakyll/statik" do
|
|
url "https://github.com/rakyll/statik.git",
|
|
:revision => "274df120e9065bdd08eb1120e0375e3dc1ae8465"
|
|
end
|
|
|
|
go_resource "golang.org/x/crypto" do
|
|
url "https://go.googlesource.com/crypto.git",
|
|
:revision => "1f22c0103821b9390939b6776727195525381532"
|
|
end
|
|
|
|
go_resource "gopkg.in/fatih/pool.v2" do
|
|
url "https://gopkg.in/fatih/pool.v2.git",
|
|
:revision => "cba550ebf9bce999a02e963296d4bc7a486cb715"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
influxdb_path = buildpath/"src/github.com/influxdata/influxdb"
|
|
influxdb_path.install Dir["*"]
|
|
revision = `git rev-parse HEAD`.strip
|
|
version = `git describe --tags`.strip
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
cd influxdb_path do
|
|
system "go", "install",
|
|
"-ldflags", "-X main.version=#{version} -X main.commit=#{revision} -X main.branch=master",
|
|
"./..."
|
|
end
|
|
|
|
inreplace influxdb_path/"etc/config.sample.toml" do |s|
|
|
s.gsub! "/var/lib/influxdb/data", "#{var}/influxdb/data"
|
|
s.gsub! "/var/lib/influxdb/meta", "#{var}/influxdb/meta"
|
|
s.gsub! "/var/lib/influxdb/wal", "#{var}/influxdb/wal"
|
|
end
|
|
|
|
bin.install "bin/influxd"
|
|
bin.install "bin/influx"
|
|
bin.install "bin/influx_tsm"
|
|
bin.install "bin/influx_stress"
|
|
etc.install influxdb_path/"etc/config.sample.toml" => "influxdb.conf"
|
|
|
|
(var/"influxdb/data").mkpath
|
|
(var/"influxdb/meta").mkpath
|
|
(var/"influxdb/wal").mkpath
|
|
end
|
|
|
|
plist_options :manual => "influxd -config #{HOMEBREW_PREFIX}/etc/influxdb.conf"
|
|
|
|
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>KeepAlive</key>
|
|
<dict>
|
|
<key>SuccessfulExit</key>
|
|
<false/>
|
|
</dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/influxd</string>
|
|
<string>-config</string>
|
|
<string>#{HOMEBREW_PREFIX}/etc/influxdb.conf</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{var}</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/influxdb.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/influxdb.log</string>
|
|
<key>SoftResourceLimits</key>
|
|
<dict>
|
|
<key>NumberOfFiles</key>
|
|
<integer>10240</integer>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"config.toml").write shell_output("influxd config")
|
|
inreplace testpath/"config.toml" do |s|
|
|
s.gsub! %r{/.*/.influxdb/data}, "#{testpath}/influxdb/data"
|
|
s.gsub! %r{/.*/.influxdb/meta}, "#{testpath}/influxdb/meta"
|
|
s.gsub! %r{/.*/.influxdb/wal}, "#{testpath}/influxdb/wal"
|
|
end
|
|
|
|
begin
|
|
pid = fork do
|
|
exec "#{bin}/influxd -config #{testpath}/config.toml"
|
|
end
|
|
sleep 1
|
|
output = shell_output("curl -Is localhost:8086/ping")
|
|
sleep 1
|
|
assert_match /X-Influxdb-Version:/, output
|
|
ensure
|
|
Process.kill("SIGINT", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|