Skip to content

Commit

Permalink
Add 23.12
Browse files Browse the repository at this point in the history
  • Loading branch information
brookemckim committed Jan 10, 2024
1 parent 7954b21 commit 4170816
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions Formula/clickhouse@23.12.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
class ClickhouseAT2312 < Formula
desc "Free analytics DBMS for big data with SQL interface"
homepage "https://clickhouse.com"
license "Apache-2.0"

sha256 "30bcae2490fb5d9cdfd52ba9b25c4ad12efacc8882a6676a6a994e651c5aedee"
url "https://github.com/ClickHouse/ClickHouse/releases/download/v23.12.2.59-stable/clickhouse-macos-aarch64",

Check failure on line 7 in Formula/clickhouse@23.12.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos, monterey, arm64)

FormulaAudit/ComponentsOrder: `url` (line 7) should be put before `sha256` (line 6)
verified: "github.com/ClickHouse/ClickHouse/"

livecheck do
url :url
regex(/^v?(\d+(?:\.\d+)+[._-](lts|stable))$/i)
end

Check failure on line 14 in Formula/clickhouse@23.12.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos, monterey, arm64)

Layout/TrailingWhitespace: Trailing whitespace detected.
def install
system "chmod +x ./clickhouse-macos-aarch64"

Check failure on line 16 in Formula/clickhouse@23.12.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos, monterey, arm64)

Homebrew/ShellCommands: Separate `system` commands into `"chmod", "+x", "./clickhouse-macos-aarch64"`
system "./clickhouse-macos-aarch64", "install", "--prefix", HOMEBREW_PREFIX, "--binary-path", prefix/"bin", "--user", "", "--group", ""

Check failure on line 17 in Formula/clickhouse@23.12.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos, monterey, arm64)

Layout/LineLength: Line is too long. [139/118]

# Relax the permissions when packaging.
Dir.glob([
etc/"clickhouse-server/**/*",
var/"run/clickhouse-server/**/*",
var/"log/clickhouse-server/**/*",
]) do |file|
chmod 0664, file
chmod "a+x", file if File.directory?(file)
end
end

def post_install
# WORKAROUND: .../log/ dir is not bottled, looks like.
mkdir_p var/"log/clickhouse-server"

# Fix the permissions when deploying.
Dir.glob([
etc/"clickhouse-server/**/*",
var/"run/clickhouse-server/**/*",
var/"log/clickhouse-server/**/*",
]) do |file|
chmod 0640, file
chmod "ug+x", file if File.directory?(file)
end

# Make sure the data directories are initialized.
system opt_bin/"clickhouse", "start", "--prefix", HOMEBREW_PREFIX, "--binary-path", opt_bin, "--user", ""
system opt_bin/"clickhouse", "stop", "--prefix", HOMEBREW_PREFIX
end

def caveats
<<~EOS
If you intend to run ClickHouse server:
- Familiarize yourself with the usage recommendations:
https://clickhouse.com/docs/en/operations/tips/
- Increase the maximum number of open files limit in the system:
macOS: https://clickhouse.com/docs/en/development/build-osx/#caveats
Linux: man limits.conf
- Set the 'net_admin', 'ipc_lock', and 'sys_nice' capabilities on #{opt_bin}/clickhouse binary. If the capabilities are not set the taskstats accounting will be disabled. You can enable taskstats accounting by setting those capabilities manually later.
Linux: sudo setcap 'cap_net_admin,cap_ipc_lock,cap_sys_nice+ep' #{opt_bin}/clickhouse
- By default, the pre-configured 'default' user has an empty password. Consider setting a real password for it:
https://clickhouse.com/docs/en/operations/settings/settings-users/
- By default, ClickHouse server is configured to listen for local connections only. Adjust 'listen_host' configuration parameter to allow wider range of addresses for incoming connections:
https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/#server_configuration_parameters-listen_host
EOS
end

service do
run [
opt_bin/"clickhouse", "server",
"--config-file", etc/"clickhouse-server/config.xml",
"--pid-file", var/"run/clickhouse-server/clickhouse-server.pid"
]
keep_alive true
run_type :immediate
process_type :standard
root_dir var
working_dir var
log_path var/"log/clickhouse-server/stdout.log"
error_log_path var/"log/clickhouse-server/stderr.log"
end

test do
assert_match "Denis Glazachev",
shell_output("#{bin}/clickhouse local --query 'SELECT * FROM system.contributors FORMAT TabSeparated'")
end
end

0 comments on commit 4170816

Please sign in to comment.