Skip to content

Commit 72d2e18

Browse files
committed
feat: add runners to pb protocol
1 parent 81cf3fb commit 72d2e18

File tree

78 files changed

+5157
-4785
lines changed

Some content is hidden

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

78 files changed

+5157
-4785
lines changed

Cargo.toml

Lines changed: 1 addition & 4 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
@@ -133,14 +133,13 @@ services:
133133
restart: unless-stopped
134134
command: /usr/bin/rivet-guard
135135
environment:
136-
- RUST_LOG=debug
136+
# - RUST_LOG=debug
137137
- RUST_BACKTRACE=1
138138
- RUST_LOG_ANSI_COLOR=1
139139
- RIVET_OTEL_ENABLED=1
140140
- RIVET_OTEL_SAMPLER_RATIO=1
141141
- RIVET_SERVICE_NAME=rivet-guard
142142
- RIVET_OTEL_ENDPOINT=http://otel-collector:4317
143-
- RUST_LOG=debug,hyper=info
144143
stop_grace_period: 0s
145144
ports:
146145
# 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": "container",
4+
// Enables running in non-privileged Docker containers
55
"use_resource_constraints": false
66
},
77
"cluster": {

docker/universal/Dockerfile

Lines changed: 4 additions & 4 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
@@ -137,7 +137,7 @@ RUN apt-get install -y skopeo iproute2 runc && \
137137
mkdir -p /opt/cni/bin /opt/cni/config && \
138138
curl -L https://github.com/containernetworking/plugins/releases/download/v${CNI_PLUGINS_VERSION}/cni-plugins-linux-amd64-v${CNI_PLUGINS_VERSION}.tgz | \
139139
tar -xz -C /opt/cni/bin
140-
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-container-runner /usr/local/bin/
140+
COPY --from=builder /app/dist/rivet-container-runner /usr/local/bin/
141141
ENTRYPOINT ["/usr/bin/tini", "--", "rivet-client"]
142142

143143
# MARK: Monlith
@@ -180,7 +180,7 @@ COPY ./docker/monolith/rivet-client /etc/rivet-client
180180

181181
# === Copy Build Artifacts ===
182182
COPY --from=builder /app/dist/rivet-server /usr/local/bin/
183-
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-isolate-v8-runner /app/dist/rivet-container-runner /usr/local/bin/
183+
COPY --from=builder /app/dist/rivet-client /app/dist/rivet-container-runner /usr/local/bin/
184184

185185
VOLUME ["/data"]
186186

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ 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 RUNNER: usize = 48;
50+
pub const RUNNERS_BY_REMAINING_SLOTS: usize = 49;
51+
pub const REMAINING_SLOTS: usize = 50;
52+
pub const TOTAL_SLOTS: usize = 51;
53+
pub const IMAGE_ID: usize = 52;
4954

5055
// Directories with fdbrs must use string paths instead of tuples
5156
pub mod dir {
@@ -103,6 +108,12 @@ pub fn key_from_str(key: &str) -> Option<usize> {
103108
"sqlite" => Some(SQLITE),
104109
"internal" => Some(INTERNAL),
105110
"metadata" => Some(METADATA),
111+
"compressed_data" => Some(COMPRESSED_DATA),
112+
"runner" => Some(RUNNER),
113+
"runners_by_remaining_slots" => Some(RUNNERS_BY_REMAINING_SLOTS),
114+
"remaining_slots" => Some(REMAINING_SLOTS),
115+
"total_slots" => Some(TOTAL_SLOTS),
116+
"image_id" => Some(IMAGE_ID),
106117
_ => None,
107118
}
108119
}

packages/common/util/core/src/serde.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
fmt,
44
hash::{Hash, Hasher},
55
marker::PhantomData,
6-
ops::Deref,
6+
ops::{Deref, DerefMut},
77
};
88

99
use indexmap::IndexMap;
@@ -125,6 +125,10 @@ impl<K: Eq + Hash, V: Hash> HashableMap<K, V> {
125125
pub fn new() -> Self {
126126
HashableMap(IndexMap::new())
127127
}
128+
129+
pub fn with_capacity(capacity: usize) -> Self {
130+
HashableMap(IndexMap::with_capacity(capacity))
131+
}
128132
}
129133

130134
impl<K: Eq + Hash, V: Hash> Default for HashableMap<K, V> {
@@ -141,6 +145,12 @@ impl<K: Eq + Hash, V: Hash> Deref for HashableMap<K, V> {
141145
}
142146
}
143147

148+
impl<K: Eq + Hash, V: Hash> DerefMut for HashableMap<K, V> {
149+
fn deref_mut(&mut self) -> &mut Self::Target {
150+
&mut self.0
151+
}
152+
}
153+
144154
impl<K: Eq + Ord + Hash, V: Hash> Hash for HashableMap<K, V> {
145155
fn hash<H: Hasher>(&self, state: &mut H) {
146156
let mut kv = Vec::from_iter(&self.0);

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)