Skip to content

Commit 8173510

Browse files
BrewTestBotdaeho-ro
authored andcommitted
influxdb 3.3.0
Signed-off-by: Rui Chen <[email protected]>
1 parent d6bef8f commit 8173510

File tree

2 files changed

+35
-95
lines changed

2 files changed

+35
-95
lines changed
File renamed without changes.

Formula/i/influxdb.rb

Lines changed: 35 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
class Influxdb < Formula
22
desc "Time series, events, and metrics database"
33
homepage "https://influxdata.com/time-series-platform/influxdb/"
4-
# When bumping to 3.x, update license stanza to `license any_of: ["Apache-2.0", "MIT"]`
5-
# Ref: https://github.com/influxdata/influxdb/blob/main/Cargo.toml#L124
64
url "https://github.com/influxdata/influxdb.git",
7-
tag: "v2.7.12",
8-
revision: "ec9dcde5d6f0e1c4d15ff2332127987a42ca30fc"
9-
license "MIT"
10-
head "https://github.com/influxdata/influxdb.git", branch: "main-2.x"
5+
tag: "v3.3.0",
6+
revision: "02d7ee1e6fec5b62debbe862881562e451624de6"
7+
license any_of: ["Apache-2.0", "MIT"]
8+
head "https://github.com/influxdata/influxdb.git", branch: "main"
119

1210
# There can be a notable gap between when a version is tagged and a
1311
# corresponding release is created, so we check releases instead of the Git
@@ -29,113 +27,55 @@ class Influxdb < Formula
2927
sha256 cellar: :any_skip_relocation, x86_64_linux: "6c5c653142f61b7a1abee3d66add075b163341e0908579a192a6217197e3853d"
3028
end
3129

32-
depends_on "breezy" => :build
33-
depends_on "go" => :build
3430
depends_on "pkgconf" => :build
3531
depends_on "protobuf" => :build
3632
depends_on "rust" => :build
33+
depends_on "[email protected]"
3734

38-
# NOTE: The version here is specified in the go.mod of influxdb.
39-
# If you're upgrading to a newer influxdb version, check to see if this needs upgraded too.
40-
resource "pkg-config-wrapper" do
41-
url "https://github.com/influxdata/pkg-config/archive/refs/tags/v0.2.14.tar.gz"
42-
sha256 "465d2fb3fc6dab9aca60e3ee3ca623ea346f3544d53082505645f81a7c4cd6d3"
35+
uses_from_macos "llvm" => :build
4336

44-
livecheck do
45-
url "https://raw.githubusercontent.com/influxdata/influxdb/v#{LATEST_VERSION}/go.mod"
46-
regex(/pkg-config\s+v?(\d+(?:\.\d+)+)/i)
47-
end
48-
end
49-
50-
# NOTE: The version/URL here is specified in scripts/fetch-ui-assets.sh in influxdb.
51-
# If you're upgrading to a newer influxdb version, check to see if this needs upgraded too.
52-
resource "ui-assets" do
53-
url "https://github.com/influxdata/ui/releases/download/OSS-v2.7.12/build.tar.gz"
54-
sha256 "682f8660c6b160a918f4631a791c76da1437c62de47d6a5a4cb0bd6a3a8e6800"
55-
56-
livecheck do
57-
url "https://raw.githubusercontent.com/influxdata/influxdb/v#{LATEST_VERSION}/scripts/fetch-ui-assets.sh"
58-
regex(/UI_RELEASE=["']?OSS[._-]v?(\d+(?:\.\d+)+)["']?$/i)
59-
end
37+
on_linux do
38+
depends_on "lld" => :build
6039
end
6140

6241
def install
63-
# Set up the influxdata pkg-config wrapper to enable just-in-time compilation & linking
64-
# of the Rust components in the server.
65-
resource("pkg-config-wrapper").stage do
66-
system "go", "build", *std_go_args(output: buildpath/"bootstrap/pkg-config")
42+
py = Formula["[email protected]"].opt_bin/"python3"
43+
ENV["PYO3_PYTHON"] = py
44+
ENV["PYTHON_SYS_EXECUTABLE"] = py
45+
46+
# Configure rpath to locate Python framework at runtime
47+
if OS.mac?
48+
fwk_dir = Formula["[email protected]"].opt_frameworks/"Python3.framework/Versions/3.13"
49+
ENV.append "RUSTFLAGS", "-C link-arg=-Wl,-rpath,#{fwk_dir}"
6750
end
68-
ENV.prepend_path "PATH", buildpath/"bootstrap"
69-
70-
# Extract pre-build UI resources to the location expected by go-bindata.
71-
resource("ui-assets").stage(buildpath/"static/data/build")
72-
# Embed UI files into the Go source code.
73-
system "make", "generate-web-assets"
74-
75-
# Build the server.
76-
ldflags = %W[
77-
-s -w
78-
-X main.version=#{version}
79-
-X main.commit=#{Utils.git_short_head(length: 10)}
80-
-X main.date=#{time.iso8601}
81-
]
82-
tags = %w[
83-
assets
84-
sqlite_foreign_keys
85-
sqlite_json
86-
]
87-
88-
system "go", "build", *std_go_args(output: bin/"influxd", ldflags:, tags:), "./cmd/influxd"
8951

90-
data = var/"lib/influxdb2"
91-
data.mkpath
92-
93-
# Generate default config file.
94-
config = buildpath/"config.yml"
95-
config.write Utils.safe_popen_read(bin/"influxd", "print-config",
96-
"--bolt-path=#{data}/influxdb.bolt",
97-
"--engine-path=#{data}/engine")
98-
(etc/"influxdb2").install config
99-
100-
# Create directory for DB stdout+stderr logs.
101-
(var/"log/influxdb2").mkpath
102-
end
103-
104-
def caveats
105-
<<~EOS
106-
This formula does not contain command-line interface; to install it, run:
107-
brew install influxdb-cli
108-
EOS
52+
system "cargo", "install", *std_cargo_args(path: "influxdb3")
10953
end
11054

11155
service do
112-
run opt_bin/"influxd"
56+
run opt_bin/"influxdb3"
11357
keep_alive true
11458
working_dir HOMEBREW_PREFIX
115-
log_path var/"log/influxdb2/influxd_output.log"
116-
error_log_path var/"log/influxdb2/influxd_output.log"
117-
environment_variables INFLUXD_CONFIG_PATH: etc/"influxdb2/config.yml"
59+
log_path var/"log/influxdb3/influxd_output.log"
60+
error_log_path var/"log/influxdb3/influxd_output.log"
11861
end
11962

12063
test do
121-
influxd_port = free_port
122-
influx_host = "http://localhost:#{influxd_port}"
123-
ENV["INFLUX_HOST"] = influx_host
124-
125-
influxd = fork do
126-
exec "#{bin}/influxd", "--bolt-path=#{testpath}/influxd.bolt",
127-
"--engine-path=#{testpath}/engine",
128-
"--http-bind-address=:#{influxd_port}",
129-
"--log-level=error"
130-
end
131-
sleep 30
132-
133-
# Check that the server has properly bundled UI assets and serves them as HTML.
134-
curl_output = shell_output("curl --silent --head #{influx_host}")
135-
assert_match "200 OK", curl_output
136-
assert_match "text/html", curl_output
64+
port = free_port
65+
host = "http://localhost:#{port}"
66+
pid = spawn bin/"influxdb3", "serve",
67+
"--node-id", "node1",
68+
"--object-store", "file",
69+
"--data-dir", testpath/"influxdb_data",
70+
"--http-bind", "0.0.0.0:#{port}"
71+
72+
sleep 5
73+
sleep 5 if OS.mac? && Hardware::CPU.intel?
74+
75+
curl_output = shell_output("curl --silent --head #{host}")
76+
assert_match "401 Unauthorized", curl_output
13777
ensure
138-
Process.kill("TERM", influxd)
139-
Process.wait influxd
78+
Process.kill "TERM", pid
79+
Process.wait pid
14080
end
14181
end

0 commit comments

Comments
 (0)