Skip to content

Commit d26363d

Browse files
committed
fix(guard): use intercom_address for guard service discovery
1 parent 94a55e5 commit d26363d

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker/dev-full/rivet-edge-server/config.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"cluster_id": "11ca8960-acab-4963-909c-99d72af3e1cb",
99
"datacenter_id": "f288913c-735d-4188-bf9b-2fcf6eac7b9c",
1010
"server_id": "174aca2a-98b7-462c-9ad9-3835094a9a10",
11-
"intercom_endpoint": "http://rivet-server:8081"
11+
"intercom_address": "http://rivet-server:8081"
1212
},
1313
"guard": {
1414
// TLS not configured for local development

docker/dev-full/rivet-guard/config.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"cluster_id": "11ca8960-acab-4963-909c-99d72af3e1cb",
2121
"datacenter_id": "f288913c-735d-4188-bf9b-2fcf6eac7b9c",
2222
"server_id": "174aca2a-98b7-462c-9ad9-3835094a9a10",
23-
"intercom_endpoint": "http://rivet-server:8081"
23+
"intercom_address": "http://rivet-server:8081"
2424
},
2525
"guard": {
2626
// TLS not configured for local development

packages/common/config/src/config/server/rivet/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,10 +841,12 @@ pub struct Edge {
841841
pub cluster_id: Uuid,
842842
pub datacenter_id: Uuid,
843843
pub server_id: Uuid,
844-
pub intercom_endpoint: Url,
844+
/// Url of the core cluster.
845+
pub intercom_address: Url,
845846
/// This API address will be used if there are no worker servers listed in the cluster package
846847
#[serde(default)]
847848
pub api_lan_address: Option<(String, u16)>,
848849
#[serde(default)]
849850
pub redirect_logs_dir: Option<PathBuf>,
850851
}
852+

packages/core/services/cluster/src/workflows/server/install/install_scripts/components/rivet/guard.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn configure(config: &rivet_config::Config) -> GlobalResult<String> {
5858
datacenter_id: Uuid::nil(),
5959
server_id: Uuid::nil(),
6060
api_lan_address: None,
61-
intercom_endpoint: Url::parse(&format!("http://127.0.0.1:{TUNNEL_API_EDGE_PORT}"))?,
61+
intercom_address: Url::parse(&format!("http://127.0.0.1:{TUNNEL_API_EDGE_PORT}"))?,
6262
redirect_logs_dir: Some(PathBuf::from("/var/log/rivet-guard")),
6363
}),
6464
status: server_config.rivet.status.clone(),

packages/core/services/cluster/src/workflows/server/install/install_scripts/components/rivet/worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn configure(config: &rivet_config::Config) -> GlobalResult<String> {
7272
datacenter_id: Uuid::nil(),
7373
server_id: Uuid::nil(),
7474
api_lan_address: None,
75-
intercom_endpoint: Url::parse(&format!("http://127.0.0.1:{TUNNEL_API_EDGE_PORT}"))?,
75+
intercom_address: Url::parse(&format!("http://127.0.0.1:{TUNNEL_API_EDGE_PORT}"))?,
7676
redirect_logs_dir: Some(PathBuf::from("/var/log/rivet-edge-server")),
7777
}),
7878
..Default::default()

packages/edge/infra/guard/server/src/routing/api.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ use service_discovery::ServiceDiscovery;
1010
use url::Url;
1111
use uuid::Uuid;
1212

13-
// TODO: Copied from cluster/src/workflows/server/install/install_scripts/components/rivet/mod.rs
14-
const TUNNEL_API_EDGE_PORT: u16 = 5010;
15-
1613
/// Route requests to the API service
1714
#[tracing::instrument(skip_all)]
1815
pub async fn route_api_request(
@@ -46,7 +43,8 @@ pub async fn route_api_request(
4643

4744
// NOTE: We use service discovery instead of server::list or datacenter::server_discovery because cache is not
4845
// shared between edge-edge or edge-core. SD requests the core which has a single cache.
49-
let url = Url::parse(&format!("http://127.0.0.1:{TUNNEL_API_EDGE_PORT}/provision/datacenters/{dc_id}/servers?pools=worker"))?;
46+
let edge = ctx.config().server()?.rivet.edge()?;
47+
let url = Url::parse(&format!("{}provision/datacenters/{dc_id}/servers?pools=worker", edge.intercom_address))?;
5048
let sd = ServiceDiscovery::new(url);
5149
let servers = sd.fetch().await?;
5250

packages/edge/services/pegboard/src/workflows/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ async fn publish_registered(ctx: &ActivityCtx, input: &PublishRegisteredInput) -
510510

511511
let config = Configuration {
512512
client: rivet_pools::reqwest::client().await?,
513-
base_path: util::url::to_string_without_slash(&edge.intercom_endpoint),
513+
base_path: util::url::to_string_without_slash(&edge.intercom_address),
514514
bearer_access_token: Some(token),
515515
..Default::default()
516516
};

0 commit comments

Comments
 (0)