1
1
class Influxdb < Formula
2
2
desc "Time series, events, and metrics database"
3
3
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
6
4
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"
11
9
12
10
# There can be a notable gap between when a version is tagged and a
13
11
# corresponding release is created, so we check releases instead of the Git
@@ -21,121 +19,63 @@ class Influxdb < Formula
21
19
end
22
20
23
21
bottle do
24
- sha256 cellar : :any_skip_relocation , arm64_sequoia : "23d65d552476d6a5c9a10d741f202fead045809782f0eeb25ac146f92b6ae59f "
25
- sha256 cellar : :any_skip_relocation , arm64_sonoma : "7a6b817054743d4ad428dc1f7b02a0b22b8f5c575173e3b2e8f16f6cfd9f7702 "
26
- sha256 cellar : :any_skip_relocation , arm64_ventura : "402fdde18259f92fb63ae902a4c90619ff1ab3fdd6dd08961742b69906b05f7c "
27
- sha256 cellar : :any_skip_relocation , sonoma : "f67c158257908b8c36ce0334d46eb7c43255fa27e126fa5f043153f3946fb95a "
28
- sha256 cellar : :any_skip_relocation , ventura : "a716620cb960f36e308239eee5f7277f29070fb3e8e13246cea44e30c4ace5c5 "
29
- sha256 cellar : :any_skip_relocation , x86_64_linux : "6c5c653142f61b7a1abee3d66add075b163341e0908579a192a6217197e3853d "
22
+ sha256 cellar : :any , arm64_sequoia : "416be7fb38774a10def2430255af879d6b4984fb8c2e854eb42bb67ad1a0a4f7 "
23
+ sha256 cellar : :any , arm64_sonoma : "4a7e12857673b72901dc8b7c84be825307a0ca2a4efca7138bfe98bb5f239408 "
24
+ sha256 cellar : :any , arm64_ventura : "7b1e1b623ba3df946ec5f22670050521e53fe855a177baa86f84adb47e9eb843 "
25
+ sha256 cellar : :any , sonoma : "cefb83b398867939665527a5ccac218f3de86c75b6d981b7ee85467617c4a7b1 "
26
+ sha256 cellar : :any , ventura : "1e0e88a164a06638e6141eb6e9fc0612aeaaf3d58db0fcb039327aa461d98186 "
27
+ sha256 cellar : :any_skip_relocation , x86_64_linux : "7be9eaef36f170a8df003fcba7922d0f8a388f1e7dee9e8d98adc9e5d03e8114 "
30
28
end
31
29
32
- depends_on "breezy" => :build
33
- depends_on "go" => :build
34
30
depends_on "pkgconf" => :build
35
31
depends_on "protobuf" => :build
36
32
depends_on "rust" => :build
33
+
37
34
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
43
36
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
60
39
end
61
40
62
41
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 } "
67
50
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"
89
51
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" )
109
53
end
110
54
111
55
service do
112
- run opt_bin /"influxd "
56
+ run opt_bin /"influxdb3 "
113
57
keep_alive true
114
58
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"
118
61
end
119
62
120
63
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
137
77
ensure
138
- Process . kill ( "TERM" , influxd )
139
- Process . wait influxd
78
+ Process . kill "TERM" , pid
79
+ Process . wait pid
140
80
end
141
81
end
0 commit comments