Skip to content

Commit 9e9bc13

Browse files
committed
feat(rivetkit): download Engine and Services binaries on demand
1 parent a7f753c commit 9e9bc13

53 files changed

Lines changed: 2482 additions & 753 deletions

Some content is hidden

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

‎.claude/reference/dependencies.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
- For runtime-only dependencies, use dynamic loading so bundlers do not eagerly include them.
2323
- Build the module specifier from string parts (for example with `["pkg", "name"].join("-")` or `["@scope", "pkg"].join("/")`) instead of a single string literal.
2424
- Prefer this pattern for modules like `@rivetkit/rivetkit-napi/wrapper`, `sandboxed-node`, and `isolated-vm`.
25-
- The TypeScript registry's native envoy path dynamically loads `@rivetkit/rivetkit-napi` and `@rivetkit/engine-cli` so browser and serverless bundles do not eagerly pull native-only modules.
25+
- The TypeScript registry's native envoy path dynamically loads `@rivetkit/rivetkit-napi` so browser and serverless bundles do not eagerly pull native-only modules.
26+
- `rivetkit` does not depend on the Engine or Services binaries. `rivetkit-engine-process::download` fetches them on demand from releases.rivet.dev at exact pinned versions, verified against `SHA256SUMS`; bump `SERVICES_VERSION` in `rivetkit-core/src/services_process.rs` to move Services.
2627
- If loading by resolved file path, resolve first and then import via `pathToFileURL(...).href`.
2728

2829
## Version bumps

‎.github/workflows/publish.yaml‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ jobs:
279279
--build-arg BUILD_TARGET=${{ matrix.build_target }} \
280280
--build-arg BUILD_MODE=${{ steps.mode.outputs.build_mode }} \
281281
--build-arg BUILD_FRONTEND=${{ matrix.build_target == 'engine' && 'true' || 'false' }} \
282+
--build-arg RIVET_ENGINE_RELEASE_REF=${{ needs.context.outputs.trigger != 'release' && contains(needs.context.outputs.targets, 'engine') && needs.context.outputs.sha || '' }} \
282283
-f ${{ matrix.docker }} \
283284
-t builder-${{ matrix.build_target }}-${{ matrix.platform }} \
284285
--load \
@@ -596,19 +597,9 @@ jobs:
596597
- name: Finalize package versions for publish
597598
run: pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions --version ${{ needs.context.outputs.version }}
598599

599-
- name: Publish npm packages
600-
env:
601-
# setup-node provides a dummy token value; clear it so token-only
602-
# post-publish operations stay disabled for trusted publishing.
603-
NODE_AUTH_TOKEN: ""
604-
SKIP_WASM_BUILD: "1"
605-
run: |
606-
pnpm --filter=publish exec tsx src/ci/bin.ts publish-npm \
607-
--tag ${{ needs.context.outputs.npm_tag }} \
608-
--parallel 16 \
609-
--retries 3 \
610-
${{ needs.context.outputs.trigger == 'release' && '--release-mode' || '' }}
611-
600+
# RivetKit downloads the Engine from releases.rivet.dev on demand, so the
601+
# binaries must be published before npm. A failed upload stops the job
602+
# before any npm package can point at a missing Engine.
612603
- name: Generate engine checksum manifest
613604
if: contains(needs.context.outputs.targets, 'engine')
614605
run: |
@@ -635,6 +626,19 @@ jobs:
635626
--version ${{ needs.context.outputs.version }} \
636627
--latest ${{ needs.context.outputs.latest }}
637628
629+
- name: Publish npm packages
630+
env:
631+
# setup-node provides a dummy token value; clear it so token-only
632+
# post-publish operations stay disabled for trusted publishing.
633+
NODE_AUTH_TOKEN: ""
634+
SKIP_WASM_BUILD: "1"
635+
run: |
636+
pnpm --filter=publish exec tsx src/ci/bin.ts publish-npm \
637+
--tag ${{ needs.context.outputs.npm_tag }} \
638+
--parallel 16 \
639+
--retries 3 \
640+
${{ needs.context.outputs.trigger == 'release' && '--release-mode' || '' }}
641+
638642
# The Inspector UI lives in frontend/dist, outside the rivetkit-core
639643
# crate, so it must be built and staged into the crate before packaging.
640644
# Otherwise the published crate embeds the empty fallback and serves

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docker/build/darwin-arm64.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-osxcross:0e33ceb98
77

88
ARG BUILD_TARGET=engine
99
ARG BUILD_MODE=release
10+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
11+
ARG RIVET_ENGINE_RELEASE_REF=
1012
ARG BUILD_FRONTEND=false
1113
ARG VITE_APP_API_URL=__SAME__
1214
ARG VITE_FEATURE_FLAGS=

‎docker/build/darwin-x64.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-osxcross:0e33ceb98
77

88
ARG BUILD_TARGET=engine
99
ARG BUILD_MODE=release
10+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
11+
ARG RIVET_ENGINE_RELEASE_REF=
1012
ARG BUILD_FRONTEND=false
1113
ARG VITE_APP_API_URL=__SAME__
1214
ARG VITE_FEATURE_FLAGS=

‎docker/build/linux-arm64-gnu.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-linux-gnu:0e33ceb98
77

88
ARG BUILD_TARGET=engine
99
ARG BUILD_MODE=release
10+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
11+
ARG RIVET_ENGINE_RELEASE_REF=
1012
ARG BUILD_FRONTEND=false
1113
ARG VITE_APP_API_URL=__SAME__
1214
ARG VITE_FEATURE_FLAGS=

‎docker/build/linux-arm64-musl.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-linux-musl:0e33ceb98
77

88
ARG BUILD_TARGET=engine
99
ARG BUILD_MODE=release
10+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
11+
ARG RIVET_ENGINE_RELEASE_REF=
1012
ARG BUILD_FRONTEND=false
1113
ARG VITE_APP_API_URL=__SAME__
1214
ARG VITE_FEATURE_FLAGS=

‎docker/build/linux-x64-gnu.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-linux-gnu:0e33ceb98
1414

1515
ARG BUILD_TARGET=engine
1616
ARG BUILD_MODE=release
17+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
18+
ARG RIVET_ENGINE_RELEASE_REF=
1719
ARG BUILD_FRONTEND=false
1820
ARG VITE_APP_API_URL=__SAME__
1921
ARG VITE_FEATURE_FLAGS=

‎docker/build/linux-x64-musl.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM ghcr.io/rivet-dev/rivet/builder-base-linux-musl:0e33ceb98
77

88
ARG BUILD_TARGET=engine
99
ARG BUILD_MODE=release
10+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
11+
ARG RIVET_ENGINE_RELEASE_REF=
1012
ARG BUILD_FRONTEND=false
1113
ARG VITE_APP_API_URL=__SAME__
1214
ARG VITE_FEATURE_FLAGS=

‎docker/build/windows-x64.Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends nasm && \
1717

1818
ARG BUILD_TARGET=engine
1919
ARG BUILD_MODE=release
20+
# Publish commit whose Engine a preview rivetkit-napi build downloads. Empty for releases.
21+
ARG RIVET_ENGINE_RELEASE_REF=
2022
ARG BUILD_FRONTEND=false
2123
ARG VITE_APP_API_URL=__SAME__
2224
ARG VITE_FEATURE_FLAGS=

0 commit comments

Comments
 (0)