Skip to content

Commit

Permalink
Fix clickhouse-admin after split into two servers
Browse files Browse the repository at this point in the history
These changes allow properly building and deploying
clickhouse cluster nodes via reconfigurator.
  • Loading branch information
andrewjstone committed Oct 21, 2024
1 parent ca63e9f commit 79713cb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
10 changes: 6 additions & 4 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ source.paths = [
{ from = "out/clickhouse", to = "/opt/oxide/clickhouse_server" },
{ from = "smf/clickhouse_server/manifest.xml", to = "/var/svc/manifest/site/clickhouse_server/manifest.xml" },
{ from = "smf/clickhouse_server/method_script.sh", to = "/opt/oxide/lib/svc/manifest/clickhouse_server.sh" },
{ from = "smf/clickhouse-admin-server", to = "/var/svc/manifest/site/clickhouse-admin-server" },
]
output.type = "zone"
output.intermediate_only = true
Expand Down Expand Up @@ -237,6 +238,7 @@ source.paths = [
{ from = "out/clickhouse", to = "/opt/oxide/clickhouse_keeper" },
{ from = "smf/clickhouse_keeper/manifest.xml", to = "/var/svc/manifest/site/clickhouse_keeper/manifest.xml" },
{ from = "smf/clickhouse_keeper/method_script.sh", to = "/opt/oxide/lib/svc/manifest/clickhouse_keeper.sh" },
{ from = "smf/clickhouse-admin-keeper", to = "/var/svc/manifest/site/clickhouse-admin-keeper" },
]
output.type = "zone"
output.intermediate_only = true
Expand All @@ -248,10 +250,10 @@ only_for_targets.image = "standard"
source.type = "local"
source.rust.binary_names = ["clickhouse-admin-keeper", "clickhouse-admin-server"]
source.rust.release = true
source.paths = [
{ from = "smf/clickhouse-admin-keeper", to = "/var/svc/manifest/site/clickhouse-admin-keeper" },
{ from = "smf/clickhouse-admin-server", to = "/var/svc/manifest/site/clickhouse-admin-server" },
]
# We specifically put the smf manifests with their corresponding container zones
# so that both servers aren't started simultaneously
# See [package.clickhouse_keeper_svc] and [package.clickhouse_server_svc]
source.paths = []
output.type = "zone"
output.intermediate_only = true

Expand Down
24 changes: 13 additions & 11 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ const IPV6_UNSPECIFIED: IpAddr = IpAddr::V6(Ipv6Addr::UNSPECIFIED);
const COCKROACH: &str = "/opt/oxide/cockroachdb/bin/cockroach";

const CLICKHOUSE_SERVER_BINARY: &str =
"/opt/oxide//opt/oxide/clickhouse_server/clickhouse";
"/opt/oxide/clickhouse_server/clickhouse";
const CLICKHOUSE_KEEPER_BINARY: &str =
"/opt/oxide//opt/oxide/clickhouse_keeper/clickhouse";
const CLICKHOUSE_BINARY: &str = "/opt/oxide//opt/oxide/clickhouse/clickhouse";
"/opt/oxide/clickhouse_keeper/clickhouse";
const CLICKHOUSE_BINARY: &str = "/opt/oxide/clickhouse/clickhouse";

pub const SWITCH_ZONE_BASEBOARD_FILE: &str = "/opt/oxide/baseboard.json";

Expand Down Expand Up @@ -1687,10 +1687,11 @@ impl ServiceManager {
CLICKHOUSE_SERVER_BINARY,
);
let clickhouse_admin_service =
ServiceBuilder::new("oxide/clickhouse-admin").add_instance(
ServiceInstanceBuilder::new("default")
.add_property_group(clickhouse_admin_config),
);
ServiceBuilder::new("oxide/clickhouse-admin-server")
.add_instance(
ServiceInstanceBuilder::new("default")
.add_property_group(clickhouse_admin_config),
);

let profile = ProfileBuilder::new("omicron")
.add_service(nw_setup_service)
Expand Down Expand Up @@ -1762,10 +1763,11 @@ impl ServiceManager {
CLICKHOUSE_KEEPER_BINARY,
);
let clickhouse_admin_service =
ServiceBuilder::new("oxide/clickhouse-admin").add_instance(
ServiceInstanceBuilder::new("default")
.add_property_group(clickhouse_admin_config),
);
ServiceBuilder::new("oxide/clickhouse-admin-keeper")
.add_instance(
ServiceInstanceBuilder::new("default")
.add_property_group(clickhouse_admin_config),
);

let profile = ProfileBuilder::new("omicron")
.add_service(nw_setup_service)
Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse-admin-keeper/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</dependency>

<exec_method type='method' name='start'
exec='ctrun -l child -o noorphan,regent /opt/oxide/clickhouse-admin-keeper/bin/clickhouse-admin-keeper run --config /var/svc/manifest/site/clickhouse-admin-keeper/config.toml --http-address %{config/http_address} --listen-address %{config/ch_address} --binary-path %{config/ch_binary} &amp;'
exec='ctrun -l child -o noorphan,regent /opt/oxide/omicron-clickhouse-admin/bin/clickhouse-admin-keeper run --config /var/svc/manifest/site/clickhouse-admin-keeper/config.toml --http-address %{config/http_address} --listen-address %{config/ch_address} --binary-path %{config/ch_binary} &amp;'
timeout_seconds='0' />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds='0' />

Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse-admin-server/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</dependency>

<exec_method type='method' name='start'
exec='ctrun -l child -o noorphan,regent /opt/oxide/clickhouse-admin-server/bin/clickhouse-admin-server run --config /var/svc/manifest/site/clickhouse-admin-server/config.toml -http-address %{config/http_address} --listen-address %{config/ch_address} --binary-path %{config/ch_binary} &amp;'
exec='ctrun -l child -o noorphan,regent /opt/oxide/omicron-clickhouse-admin/bin/clickhouse-admin-server run --config /var/svc/manifest/site/clickhouse-admin-server/config.toml --http-address %{config/http_address} --listen-address %{config/ch_address} --binary-path %{config/ch_binary} &amp;'
timeout_seconds='0' />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds='0' />

Expand Down
4 changes: 2 additions & 2 deletions smf/clickhouse_keeper/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<service_fmri value='svc:/oxide/zone-network-setup:default' />
</dependency>

<dependency name='clickhouse-admin' grouping='require_all' restart_on='none'
<dependency name='clickhouse-admin-keeper' grouping='require_all' restart_on='none'
type='service'>
<service_fmri value='svc:/oxide/clickhouse-admin:default' />
<service_fmri value='svc:/oxide/clickhouse-admin-keeper:default' />
</dependency>

<exec_method type='method' name='start'
Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse_keeper/method_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set -o pipefail
# Otherwise, it does not automatically detect the configuration files, nor does
# it append them when necessary
cd /opt/oxide/clickhouse_keeper/
exec ./clickhouse keeper &
exec /opt/oxide/clickhouse_keeper/clickhouse keeper --config /opt/oxide/clickhouse_keeper/keeper_config.xml &
4 changes: 2 additions & 2 deletions smf/clickhouse_server/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<service_fmri value='svc:/oxide/zone-network-setup:default' />
</dependency>

<dependency name='clickhouse-admin' grouping='require_all' restart_on='none'
<dependency name='clickhouse-admin-server' grouping='require_all' restart_on='none'
type='service'>
<service_fmri value='svc:/oxide/clickhouse-admin:default' />
<service_fmri value='svc:/oxide/clickhouse-admin-server:default' />
</dependency>

<exec_method type='method' name='start'
Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse_server/method_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set -o pipefail
# Otherwise, it does not automatically detect the configuration files, nor does
# it append them when necessary
cd /opt/oxide/clickhouse_server/
exec ./clickhouse server &
exec /opt/oxide/clickhouse_server/clickhouse server --config /opt/oxide/clickhouse_server/config.d/replica-server-config.xml &

0 comments on commit 79713cb

Please sign in to comment.