File tree Expand file tree Collapse file tree
common/config/src/config/server/rivet
core/services/cluster/src/workflows/server/install/install_scripts/components/rivet
edge/infra/guard/server/src/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -841,10 +841,20 @@ 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+
853+ impl Edge {
854+ /// u16 used in the `Id` type for actors
855+ pub fn datacenter_label ( & self ) -> u16 {
856+ // Read first 2 bytes
857+ let bytes = self . datacenter_id . as_bytes ( ) ;
858+ u16:: from_be_bytes ( [ bytes[ 0 ] , bytes[ 1 ] ] )
859+ }
860+ }
Original file line number Diff line number Diff 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 ( ) ,
Original file line number Diff line number Diff 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 ( )
Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ use service_discovery::ServiceDiscovery;
1010use url:: Url ;
1111use 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) ]
1815pub 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
You can’t perform that action at this time.
0 commit comments