diff --git a/packages/api/provision/src/route/datacenters.rs b/packages/api/provision/src/route/datacenters.rs index 2dc647acca..534c929faf 100644 --- a/packages/api/provision/src/route/datacenters.rs +++ b/packages/api/provision/src/route/datacenters.rs @@ -45,15 +45,11 @@ pub async fn servers( _watch_index: WatchIndexQuery, query: ServerFilterQuery, ) -> GlobalResult { - ctx.auth().server()?; - // Find server based on public ip let servers_res = ctx .op(cluster::ops::server::list::Input { filter: cluster::types::Filter { - pool_types: query - .pools - .is_empty() + pool_types: (!query.pools.is_empty()) .then(|| query.pools.into_iter().map(ApiInto::api_into).collect()), ..Default::default() }, diff --git a/packages/api/provision/src/route/mod.rs b/packages/api/provision/src/route/mod.rs index b3d6739303..e5c0b9873d 100644 --- a/packages/api/provision/src/route/mod.rs +++ b/packages/api/provision/src/route/mod.rs @@ -19,6 +19,7 @@ define_router! { GET: datacenters::servers( query: datacenters::ServerFilterQuery, internal_endpoint: true, + opt_auth: true, ), }, diff --git a/packages/infra/client/isolate-v8-runner/README.md b/packages/infra/client/isolate-v8-runner/README.md index 902f484d20..6458169a5c 100644 --- a/packages/infra/client/isolate-v8-runner/README.md +++ b/packages/infra/client/isolate-v8-runner/README.md @@ -1,4 +1,4 @@ -# v8-isolate-runner +# isolate-v8-runner This crate is used to run JavaScript on the pegboard servers themselves. This takes care of log shipping, rate limiting logs, and more. diff --git a/packages/infra/client/manager/src/actor/setup.rs b/packages/infra/client/manager/src/actor/setup.rs index f4aae292e2..b82479caec 100644 --- a/packages/infra/client/manager/src/actor/setup.rs +++ b/packages/infra/client/manager/src/actor/setup.rs @@ -329,7 +329,7 @@ impl Actor { ) -> Result<()> { let actor_path = ctx.actor_path(self.actor_id); - // TODO: Use schema in v8-isolate-runner (don't import v8-isolate-runner because its fat) + // TODO: Use schema in isolate-v8-runner (don't import isolate-v8-runner because its fat) let config = json!({ "resources": { "memory": self.config.resources.memory, diff --git a/packages/infra/client/manager/src/ctx.rs b/packages/infra/client/manager/src/ctx.rs index c62ce1ed20..2a23557ff2 100644 --- a/packages/infra/client/manager/src/ctx.rs +++ b/packages/infra/client/manager/src/ctx.rs @@ -349,7 +349,7 @@ impl Ctx { let working_path = self.isolate_runner_path(); - // TODO: Use schema in v8-isolate-runner (don't import v8-isolate-runner because its fat) + // TODO: Use schema in isolate-v8-runner (don't import isolate-v8-runner because its fat) let config = json!({ "actors_path": self.actors_path(), "fdb_cluster_path": self.fdb_cluster_path(), diff --git a/packages/infra/client/manager/src/utils.rs b/packages/infra/client/manager/src/utils.rs index b098c99a45..9d18f4002a 100644 --- a/packages/infra/client/manager/src/utils.rs +++ b/packages/infra/client/manager/src/utils.rs @@ -226,6 +226,11 @@ pub async fn init_sqlite_schema(pool: &SqlitePool) -> Result<()> { pub async fn init_fdb_config(config: &Config) -> Result<()> { let ips = match &config.client.cluster.foundationdb { FoundationDb::Dynamic { fetch_endpoint } => { + #[derive(Deserialize)] + struct Response { + servers: Vec, + } + #[derive(Deserialize)] struct Server { vlan_ip: Option, @@ -234,8 +239,9 @@ pub async fn init_fdb_config(config: &Config) -> Result<()> { reqwest::get(fetch_endpoint.clone()) .await? .error_for_status()? - .json::>() + .json::() .await? + .servers .into_iter() .filter_map(|server| server.vlan_ip) .map(|vlan_ip| SocketAddr::V4(SocketAddrV4::new(vlan_ip, 4500))) diff --git a/packages/infra/client/manager/tests/common.rs b/packages/infra/client/manager/tests/common.rs index 59128544bd..9f85b95d0d 100644 --- a/packages/infra/client/manager/tests/common.rs +++ b/packages/infra/client/manager/tests/common.rs @@ -187,7 +187,7 @@ pub async fn init_client(gen_path: &Path, working_path: &Path) -> Config { .await .unwrap(); tokio::fs::copy( - v8_isolate_runner_path(gen_path), + isolate_v8_runner_path(gen_path), &isolate_runner_binary_path, ) .await @@ -408,7 +408,7 @@ async fn build_runner(gen_path: &Path, variant: &str) { .arg(if variant == "container" { container_runner_path(gen_path) } else { - v8_isolate_runner_path(gen_path) + isolate_v8_runner_path(gen_path) }) .status() .await @@ -580,7 +580,7 @@ pub fn container_runner_path(gen_path: &Path) -> PathBuf { gen_path.join("pegboard-container-runner").to_path_buf() } -pub fn v8_isolate_runner_path(gen_path: &Path) -> PathBuf { +pub fn isolate_v8_runner_path(gen_path: &Path) -> PathBuf { gen_path.join("pegboard-isolate-v8-runner").to_path_buf() } diff --git a/packages/services/cluster/src/workflows/server/install/install_scripts/components/pegboard.rs b/packages/services/cluster/src/workflows/server/install/install_scripts/components/pegboard.rs index 5e5e855833..d2825bc134 100644 --- a/packages/services/cluster/src/workflows/server/install/install_scripts/components/pegboard.rs +++ b/packages/services/cluster/src/workflows/server/install/install_scripts/components/pegboard.rs @@ -21,7 +21,7 @@ pub async fn install( provision_config.container_runner_binary_url.as_ref(), ) .replace( - "__V8_ISOLATE_BINARY_URL__", + "__ISOLATE_V8_RUNNER_BINARY_URL__", provision_config.isolate_runner_binary_url.as_ref(), )) } diff --git a/packages/services/cluster/src/workflows/server/install/install_scripts/components/vector.rs b/packages/services/cluster/src/workflows/server/install/install_scripts/components/vector.rs index 0cbcc5a5a3..87477bf187 100644 --- a/packages/services/cluster/src/workflows/server/install/install_scripts/components/vector.rs +++ b/packages/services/cluster/src/workflows/server/install/install_scripts/components/vector.rs @@ -97,17 +97,17 @@ pub fn configure(config: &Config, pool_type: PoolType) -> GlobalResult { ), }); - config_json["sources"]["pegboard_v8_isolate_runner"] = json!({ + config_json["sources"]["pegboard_isolate_v8_runner"] = json!({ "type": "file", "include": ["/var/lib/rivet-client/runner/log"] }); - config_json["transforms"]["pegboard_v8_isolate_runner_add_meta"] = json!({ + config_json["transforms"]["pegboard_isolate_v8_runner_add_meta"] = json!({ "type": "remap", - "inputs": ["pegboard_v8_isolate_runner"], + "inputs": ["pegboard_isolate_v8_runner"], "source": formatdoc!( r#" - .source = "pegboard_v8_isolate_runner" + .source = "pegboard_isolate_v8_runner" .client_id = "___SERVER_ID___" .server_id = "___SERVER_ID___" @@ -144,7 +144,7 @@ pub fn configure(config: &Config, pool_type: PoolType) -> GlobalResult { let inputs = unwrap!(config_json["sinks"]["vector_sink"]["inputs"].as_array_mut()); inputs.push(json!("pegboard_manager_add_meta")); - inputs.push(json!("pegboard_v8_isolate_runner_add_meta")); + inputs.push(json!("pegboard_isolate_v8_runner_add_meta")); inputs.push(json!("pegboard_container_runner_add_meta")); } _ => {} diff --git a/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_configure.sh b/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_configure.sh index 731d8488a2..29327441e4 100644 --- a/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_configure.sh +++ b/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_configure.sh @@ -11,7 +11,7 @@ cat << 'EOF' > /etc/rivet-client/config.json "pegboard_endpoint": "__PEGBOARD_ENDPOINT__", "foundationdb": { "dynamic": { - "fetch_endpoint": "__TUNNEL_API_EDGE_API__/provision/datacenters/___DATACENTER_ID___/servers?pool=fdb" + "fetch_endpoint": "__TUNNEL_API_EDGE_API__/provision/datacenters/___DATACENTER_ID___/servers?pools=fdb" } } }, @@ -28,7 +28,7 @@ cat << 'EOF' > /etc/rivet-client/config.json }, "reserved_resources": { "cpu": 0, - "reserved_memory": "__RESERVED_MEMORY__" + "memory": "__RESERVED_MEMORY__" }, "vector": { "address": "127.0.0.1:5021" @@ -335,7 +335,7 @@ After=network-online.target setup_pegboard_networking.service ConditionPathExists=/etc/rivet-client/ [Service] -ExecStart=/usr/bin/rivet-client -c /etc/rivet-client/config.json +ExecStart=/usr/local/bin/rivet-client -c /etc/rivet-client/config.json Restart=always RestartSec=2 TasksMax=infinity diff --git a/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_install.sh b/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_install.sh index a879c73468..c4dce85252 100644 --- a/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_install.sh +++ b/packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_install.sh @@ -7,7 +7,7 @@ EOF sysctl --system -mkdir -p /etc/rivet-client +mkdir -p /etc/rivet-client /var/lib/rivet-client curl -Lf -o /usr/local/bin/rivet-client "__PEGBOARD_MANAGER_BINARY_URL__" chmod +x /usr/local/bin/rivet-client @@ -18,6 +18,6 @@ if [ "__FLAVOR__" = "container" ]; then fi if [ "__FLAVOR__" = "isolate" ]; then - curl -Lf -o /usr/local/bin/rivet-isolate-v8-runner "__V8_ISOLATE_BINARY_URL__" + curl -Lf -o /usr/local/bin/rivet-isolate-v8-runner "__ISOLATE_V8_RUNNER_BINARY_URL__" chmod +x /usr/local/bin/rivet-isolate-v8-runner fi diff --git a/packages/services/cluster/standalone/metrics-publish/src/lib.rs b/packages/services/cluster/standalone/metrics-publish/src/lib.rs index 33f12d9bf7..1e547923a3 100644 --- a/packages/services/cluster/standalone/metrics-publish/src/lib.rs +++ b/packages/services/cluster/standalone/metrics-publish/src/lib.rs @@ -28,6 +28,7 @@ struct ServerRow { is_tainted: bool, } +#[derive(Debug)] struct Server { datacenter_id: Uuid, pool_type: PoolType, @@ -136,7 +137,7 @@ fn insert_metrics(dc: &Datacenter, servers: &[Server]) -> GlobalResult<()> { pool_type, servers_in_dc .clone() - .filter(|s| matches!(s.pool_type, pool_type)) + .filter(|s| &s.pool_type == pool_type) .collect::>(), ) }) diff --git a/packages/services/ds/src/workers/drain_all.rs b/packages/services/ds/src/workers/drain_all.rs index 62eab84d97..e78704538d 100644 --- a/packages/services/ds/src/workers/drain_all.rs +++ b/packages/services/ds/src/workers/drain_all.rs @@ -31,9 +31,9 @@ async fn worker(ctx: &OperationContext) -> GlobalRe JOIN db_ds.servers_pegboard AS spb ON s.server_id = spb.server_id JOIN db_pegboard.actors AS a - ON spb.pegboard_actor_id = co.actor_id + ON spb.pegboard_actor_id = a.actor_id WHERE - co.client_id = $1 AND + a.client_id = $1 AND s.destroy_ts IS NULL ", pegboard_client_id,