Skip to content

Commit b4a61a7

Browse files
committed
feat: add runners to pb protocol
1 parent bb8ccd5 commit b4a61a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4734
-4588
lines changed

Cargo.toml

Lines changed: 4 additions & 7 deletions
Large diffs are not rendered by default.

docker/dev-full/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ services:
131131
restart: unless-stopped
132132
command: /usr/bin/rivet-guard
133133
environment:
134-
- RUST_LOG=debug
134+
# - RUST_LOG=debug
135135
- RUST_BACKTRACE=1
136136
- RUST_LOG_ANSI_COLOR=1
137137
- RIVET_OTEL_ENABLED=1
138138
- RIVET_OTEL_SAMPLER_RATIO=1
139139
- RIVET_SERVICE_NAME=rivet-guard
140140
- RIVET_OTEL_ENDPOINT=http://otel-collector:4317
141-
# - RUST_LOG=debug,hyper=info
142141
stop_grace_period: 0s
143142
ports:
144143
# HTTP

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"client": {
33
"runner": {
4-
"flavor": "isolate",
4+
"flavor": "multi",
55
// Enables running in non-privileged Docker containers
66
"use_mounts": false
77
},

docker/universal/Dockerfile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ RUN \
4747
--mount=type=cache,target=/root/.cache,id=universal-user-cache \
4848
--mount=type=cache,target=/root/.npm,id=universal-user-npm \
4949
--mount=type=cache,target=/root/.yarn,id=universal-user-yarn \
50-
RUSTFLAGS="--cfg tokio_unstable" RIVET_BUILD_HUB=0 cargo build --bin rivet-server --bin rivet-edge-server --bin rivet-guard --bin rivet-client --bin rivet-isolate-v8-runner --bin rivet-container-runner && \
50+
RUSTFLAGS="--cfg tokio_unstable" RIVET_BUILD_HUB=0 cargo build --bin rivet-server --bin rivet-edge-server --bin rivet-guard --bin rivet-client --bin rivet-container-runner && \
5151
# cargo install --locked tokio-console && \
5252
mkdir /app/dist/ && \
53-
cp target/debug/rivet-server target/debug/rivet-edge-server target/debug/rivet-guard target/debug/rivet-client target/debug/rivet-isolate-v8-runner target/debug/rivet-container-runner /app/dist/
53+
cp target/debug/rivet-server target/debug/rivet-edge-server target/debug/rivet-guard target/debug/rivet-client target/debug/rivet-container-runner /app/dist/
5454

5555
# MARK: Server (full, base)
5656
FROM debian:12.9-slim AS server-full-base
@@ -122,19 +122,9 @@ RUN apt-get update -y && \
122122

123123
# MARK: Runner (Full)
124124
FROM --platform=linux/amd64 base-runner AS client-full
125-
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-isolate-v8-runner /app/dist/rivet-container-runner /usr/local/bin/
125+
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-container-runner /usr/local/bin/
126126
ENTRYPOINT ["/usr/bin/tini", "--", "rivet-client"]
127127

128-
# MARK: Runner (Isolate V8)
129-
FROM --platform=linux/amd64 base-runner AS isolate-v8-runner
130-
COPY --from=builder /app/dist/rivet-isolate-v8-runner /usr/local/bin/
131-
ENTRYPOINT ["rivet-client"]
132-
133-
# MARK: Runner (Container)
134-
FROM --platform=linux/amd64 base-runner AS container-runner
135-
COPY --from=builder /app/dist/rivet-container-runner /usr/local/bin/
136-
ENTRYPOINT ["rivet-client"]
137-
138128
# MARK: Monlith
139129
FROM --platform=linux/amd64 debian:12.9-slim AS monolith
140130
ENV DEBIAN_FRONTEND=noninteractive
@@ -175,7 +165,7 @@ COPY ./docker/monolith/rivet-client /etc/rivet-client
175165

176166
# === Copy Build Artifacts ===
177167
COPY --from=builder /app/dist/rivet-server /usr/local/bin/
178-
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-isolate-v8-runner /app/dist/rivet-container-runner /usr/local/bin/
168+
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-container-runner /usr/local/bin/
179169

180170
VOLUME ["/data"]
181171

examples/system-test-actor/tests/client.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ async function run() {
4949
guard: {},
5050
},
5151
},
52+
http2: {
53+
protocol: "http",
54+
internalPort: 8085,
55+
routing: {
56+
guard: {},
57+
},
58+
},
5259
udp: {
5360
protocol: "udp",
5461
// internalPort: 80,

packages/common/fdb-util/src/keys.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ pub const SQLITE: usize = 44;
4646
pub const INTERNAL: usize = 45;
4747
pub const METADATA: usize = 46;
4848
pub const COMPRESSED_DATA: usize = 47;
49+
pub const RUNNERS_BY_REMAINING_SLOTS: usize = 48;
50+
pub const REMAINING_SLOTS: usize = 49;
51+
pub const TOTAL_SLOTS: usize = 50;
4952

5053
// Directories with fdbrs must use string paths instead of tuples
5154
pub mod dir {
@@ -103,6 +106,8 @@ pub fn key_from_str(key: &str) -> Option<usize> {
103106
"sqlite" => Some(SQLITE),
104107
"internal" => Some(INTERNAL),
105108
"metadata" => Some(METADATA),
109+
"compressed_data" => Some(COMPRESSED_DATA),
110+
"runners_by_remaining_slots" => Some(RUNNERS_BY_REMAINING_SLOTS),
106111
_ => None,
107112
}
108113
}

packages/common/hub-embed/build.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
use std::{env, fs, path::Path, path::PathBuf, process::Command};
22

33
fn main() -> Result<(), Box<dyn std::error::Error>> {
4-
// Check if yarn is installed
5-
let yarn_check = Command::new("yarn").arg("--version").status();
6-
assert!(
7-
yarn_check.is_ok() && yarn_check.unwrap().success(),
8-
"yarn is not installed, please install yarn to build this project"
9-
);
10-
114
// Get the output directory from the cargo environment variable
125
let target_dir = env::var("OUT_DIR")?;
136
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;
@@ -18,10 +11,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1811
fs::remove_dir_all(out_dir)?;
1912
}
2013

14+
let project_root = PathBuf::from(manifest_dir.clone()).join("../../..");
15+
let hub_path = project_root.join("frontend/apps/hub");
16+
17+
// Build hub
2118
if std::env::var("RIVET_BUILD_HUB").map_or(false, |x| x == "1") {
22-
// Build hub
23-
let project_root = PathBuf::from(manifest_dir.clone()).join("../../..");
24-
let hub_path = project_root.join("frontend/apps/hub");
19+
// Check if yarn is installed
20+
let yarn_check = Command::new("yarn").arg("--version").status();
21+
assert!(
22+
yarn_check.is_ok() && yarn_check.unwrap().success(),
23+
"yarn is not installed, please install yarn to build this project"
24+
);
2525

2626
println!("Running yarn install");
2727
let output = Command::new("yarn")
@@ -42,21 +42,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4242
println!("stdout:\n{}", String::from_utf8_lossy(&output.stdout));
4343
println!("stderr:\n{}", String::from_utf8_lossy(&output.stderr));
4444
assert!(output.status.success(), "hub build failed");
45-
46-
// Copy dist directory to out_dir
47-
let dist_path = hub_path.join("dist");
48-
fs_extra::dir::copy(
49-
dist_path.clone(),
50-
out_dir,
51-
&fs_extra::dir::CopyOptions::new().content_only(true),
52-
)?;
53-
54-
println!("cargo:rerun-if-changed={}", hub_path.display());
55-
println!("cargo:rerun-if-env-changed=FONTAWESOME_PACKAGE_TOKEN");
56-
} else {
57-
// Create empty dist dir
58-
std::fs::create_dir_all(out_dir)?;
5945
}
46+
47+
// Copy dist directory to out_dir
48+
let dist_path = hub_path.join("dist");
49+
fs_extra::dir::copy(
50+
dist_path.clone(),
51+
out_dir,
52+
&fs_extra::dir::CopyOptions::new().content_only(true),
53+
)?;
54+
55+
println!("cargo:rerun-if-changed={}", hub_path.display());
56+
println!("cargo:rerun-if-env-changed=FONTAWESOME_PACKAGE_TOKEN");
6057

6158
// Set the path in the env
6259
println!("cargo:rustc-env=HUB_PATH={}", out_dir.display());

packages/core/api/actor/src/route/builds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ pub async fn create_build(
361361
.compression
362362
.map(ApiInto::api_into)
363363
.unwrap_or(build::types::BuildCompression::None),
364+
allocation_type: build::types::BuildAllocationType::Single,
365+
allocation_total_slots: 1,
364366
})
365367
.await?;
366368

packages/core/services/build/db/build/migrations/20250508204859_alloc_type.down.sql

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE builds
2+
ADD allocation_type INT NOT NULL DEFAULT 0,
3+
ADD allocation_total_slots INT NOT NULL DEFAULT 1;

0 commit comments

Comments
 (0)