Skip to content

Commit 681fbc8

Browse files
committed
chore: replace hub-embed with proxy to 127.0.0.1:5080 for /ui/ path in dev
1 parent b748722 commit 681fbc8

File tree

12 files changed

+114
-302
lines changed

12 files changed

+114
-302
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 4 deletions
Large diffs are not rendered by default.

docker/dev-full/frontend-hub/entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ cd /app
99
yarn install
1010

1111
# Start dev server
12+
#
13+
# Set base to /ui since this is where the UI is hosted in the dev server
1214
cd /app/frontend/apps/hub
13-
yarn dev --host 0.0.0.0 --port 5080
15+
yarn dev --base=/ui

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"access_kind": "development"
66
},
77
"ui": {
8+
"enable": true,
9+
"proxy_origin": "http://frontend-hub:5080",
810
"public_origin_regex": ".*"
911
},
1012
"guard": {

frontend/apps/hub/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ export default defineConfig({
4646
process.env.DEBUG_BUNDLE ? visualizer() : null,
4747
],
4848
server: {
49+
host: "0.0.0.0",
4950
port: 5080,
51+
allowedHosts: true,
52+
// Listen on a different port since we don't proxy WebSockets on /ui
53+
hmr: {
54+
port: 5080,
55+
host: "127.0.0.1"
56+
}
5057
},
5158
preview: {
5259
port: 5080,

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ pub struct Ui {
732732
///
733733
/// If disabled, the UI can be hosted separately.
734734
pub enable: Option<bool>,
735+
/// Origin to proxy UI requests to. This should be the server serving the actula files fro the
736+
/// frontend.
737+
///
738+
/// This is frequently either Vite for a development setup or Nginx for a simple setup.
739+
pub proxy_origin: Option<Url>,
735740
/// The origin URL for the UI.
736741
pub public_origin: Option<Url>,
737742
/// Regular expression to match valid UI origins.
@@ -743,6 +748,12 @@ impl Ui {
743748
self.enable.unwrap_or(true)
744749
}
745750

751+
pub fn proxy_origin(&self) -> Url {
752+
self.proxy_origin
753+
.clone()
754+
.unwrap_or_else(|| Url::parse(&format!("http://127.0.0.1:5080")).unwrap())
755+
}
756+
746757
pub fn public_origin(&self) -> Url {
747758
self.public_origin.clone().unwrap_or_else(|| {
748759
Url::parse(&format!(

packages/common/hub-embed/Cargo.toml

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/common/hub-embed/build.rs

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/common/hub-embed/src/lib.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/core/api/ui/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ tracing = "0.1"
3030
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "json", "ansi"] }
3131
url = "2.2.2"
3232
uuid = { version = "1", features = ["v4"] }
33-
rivet-hub-embed.workspace = true
34-
mime_guess = "2.0.5"
3533
rivet-config.workspace = true
3634
global-error.workspace = true
35+
reqwest = { version = "0.12", default-features = false, features = ["json"] }

0 commit comments

Comments
 (0)