diff --git a/common/src/address.rs b/common/src/address.rs index b7476d6ff4..9180442929 100644 --- a/common/src/address.rs +++ b/common/src/address.rs @@ -46,6 +46,7 @@ pub const DNS_HTTP_PORT: u16 = 5353; pub const SLED_AGENT_PORT: u16 = 12345; pub const COCKROACH_PORT: u16 = 32221; +pub const COCKROACH_ADMIN_PORT: u16 = 32222; pub const CRUCIBLE_PORT: u16 = 32345; pub const CLICKHOUSE_PORT: u16 = 8123; pub const CLICKHOUSE_KEEPER_PORT: u16 = 9181; diff --git a/package-manifest.toml b/package-manifest.toml index b4df7c1507..bffd5be7dc 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -232,7 +232,7 @@ source.type = "local" source.rust.binary_names = ["cockroach-admin"] source.rust.release = true source.paths = [ - { from = "smf/cockroach-admin/manifest.xml", to = "/opt/oxide/lib/svc/cockroach-admin/manifest.xml" }, + { from = "smf/cockroach-admin/manifest.xml", to = "/var/svc/manifest/site/cockroach-admin/manifest.xml" }, { from = "smf/cockroach-admin/config.toml", to = "/opt/oxide/lib/svc/cockroach-admin/config.toml" }, { from = "smf/cockroach-admin/method_script.sh", to = "/opt/oxide/lib/svc/manifest/cockroach-admin.sh" }, ] diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index ff10d4aed7..421fec8c40 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -61,7 +61,7 @@ use illumos_utils::{execute, PFEXEC}; use internal_dns::resolver::Resolver; use itertools::Itertools; use nexus_config::{ConfigDropshotWithTls, DeploymentConfig}; -use omicron_common::address::BOOTSTRAP_ARTIFACT_PORT; +use omicron_common::address::{BOOTSTRAP_ARTIFACT_PORT, COCKROACH_ADMIN_PORT}; use omicron_common::address::CLICKHOUSE_KEEPER_PORT; use omicron_common::address::CLICKHOUSE_PORT; use omicron_common::address::COCKROACH_PORT; @@ -1694,25 +1694,29 @@ impl ServiceManager { return Err(Error::SledAgentNotReady); }; - let address = SocketAddr::new( + let crdb_address = SocketAddr::new( IpAddr::V6(*underlay_address), COCKROACH_PORT, ); - let listen_addr = &address.ip().to_string(); - let listen_port = &address.port().to_string(); + let admin_address = SocketAddr::new( + IpAddr::V6(*underlay_address), + COCKROACH_ADMIN_PORT, + ); + let crdb_listen_addr = &crdb_address.ip().to_string(); + let crdb_listen_port = &crdb_address.port().to_string(); let nw_setup_service = Self::zone_network_setup_install( &info.underlay_address, &installed_zone, - listen_addr, + crdb_listen_addr, )?; let dns_service = Self::dns_install(info, None, &None).await?; // Configure the CockroachDB service. let cockroachdb_config = PropertyGroupBuilder::new("config") - .add_property("listen_addr", "astring", listen_addr) - .add_property("listen_port", "astring", listen_port) + .add_property("listen_addr", "astring", crdb_listen_addr) + .add_property("listen_port", "astring", crdb_listen_port) .add_property("store", "astring", "/data"); let cockroachdb_service = ServiceBuilder::new("oxide/cockroachdb").add_instance( @@ -1720,10 +1724,30 @@ impl ServiceManager { .add_property_group(cockroachdb_config), ); + // Configure the Omicron cockroach-admin service. + let cockroach_admin_config = + PropertyGroupBuilder::new("config") + .add_property( + "cockroach_address", + "astring", + &crdb_address.to_string(), + ) + .add_property( + "http_address", + "astring", + &admin_address.to_string(), + ); + let cockroach_admin_service = + ServiceBuilder::new("oxide/cockroach-admin").add_instance( + ServiceInstanceBuilder::new("default") + .add_property_group(cockroach_admin_config), + ); + let profile = ProfileBuilder::new("omicron") .add_service(nw_setup_service) .add_service(disabled_ssh_service) .add_service(cockroachdb_service) + .add_service(cockroach_admin_service) .add_service(dns_service) .add_service(enabled_dns_client_service); profile diff --git a/smf/cockroach-admin/method_script.sh b/smf/cockroach-admin/method_script.sh old mode 100644 new mode 100755 index 4b3bfd1580..c5f924223d --- a/smf/cockroach-admin/method_script.sh +++ b/smf/cockroach-admin/method_script.sh @@ -10,6 +10,7 @@ COCKROACH_ADDR="$(svcprop -c -p config/cockroach_address "${SMF_FMRI}")" HTTP_ADDR="$(svcprop -c -p config/http_address "${SMF_FMRI}")" args=( + 'run' '--config-file-path' "/opt/oxide/lib/svc/cockroach-admin/config.toml" '--path-to-cockroach-binary' "/opt/oxide/cockroachdb/bin/cockroach" '--cockroach-address' "$COCKROACH_ADDR"