feat: add Rust environment#453
Merged
Merged
Conversation
Cargo workspace for the new Rust environment: - supervisor: implements the env contract on :8888 (healthz, specialize v1/v2), spawns the function binary once, reverse-proxies requests to it with a pooled streaming hyper client, and exits if the function process dies so fission replaces the pod. - fission-rust: SDK crate; serve(handler)/serve_router(Router) on FISSION_RUNTIME_PORT with panic-catching middleware. - template: crate the builder wraps around single-file functions. Part of #81 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Runtime: multi-stage rust:1.96-bookworm -> debian:bookworm-slim with the supervisor as entrypoint. - Builder: vendors the workspace and pre-compiles the template's dependency tree, so single-file builds only recompile the handler; builds are serialized with flock; deploy dir is created up front (the failure mode reported in #81). - Examples: single-file hello.rs (SDK) and a Cargo project echo function using plain axum against the FISSION_RUNTIME_PORT contract. - test/local_test.sh: cluster-free contract test covering both modes. Verified: docker builds, builder runs for both modes, runtime specializes and proxies both artifacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- e2e kind test covering single-file (poolmgr + newdeploy) and Cargo project (POST echo) functions - rust CI job with cargo test + cluster-free local test pre-step - skaffold rust profile, root Makefile targets, CI path filters - envconfig.json at 1.0.0 (regenerated environments.json) and README Closes #81 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- supervisor: lock-free ready flag on the proxy hot path (specialize keeps its own mutex); 400 instead of 500 for bad deploy packages to match the binary env; empty v2 filepath falls back to /userfunc/user; strip hop-by-hop headers both ways; env-var overrides for function port and v1 code path; drop unused url field and unused deps. - build.sh: binary paths now come from cargo --message-format=json instead of guessing target-dir layout; generated main.rs declares a module per user file so multi-module single-file packages actually compile; loud warning when the offline build falls back to network; multi-binary builds list --entrypoint choices in the build log. - fission-rust: FISSION_RUNTIME_HOST overrides the bind address for running function binaries standalone. - tests: local_test only kills processes that look like ours; e2e asserts the echoed JSON shape, not a substring of the request. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sanketsudake
added a commit
to fission/fission.io
that referenced
this pull request
Jun 8, 2026
* Add Rust environment to the catalog and docs - environments catalog: rust-env + rust-builder card (generated) - tools/environments.py: map rust-env -> Rust - new language guide content/en/docs/usage/languages/rust.md - supported-languages table + homepage language mentions - optimized rust logo Follows the merge of fission/environments#453 (rust-env + rust-builder images live on GHCR multi-arch). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(rust): clarify how to depend on the fission-rust SDK (pin git rev) Recommend pinning the fission-rust git dependency to a commit with rev for reproducible builds, and note the builder fetches it over the network at build time (builder egress required). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new Rust language environment (
rust-env/rust-builder), closing #81.Design
The builder compiles each function into a complete native HTTP server binary (axum 0.8 / tokio).
The runtime image runs a small Rust supervisor that implements the env contract on
:8888, spawns the function binary once at specialize, and reverse-proxies all requests to it over a pooled keep-alive connection — no per-request fork, no dynamic library loading (the FFI approach attempted in #81 is unsound because Rust has no stable ABI).Function authoring
--src hello.rs): one.rsfile withpub async fn handler(any axum handler signature); extra sibling module files supported. The builder wraps it in a pre-compiled template crate, so builds only recompile the handler.--src project.zip): any binary crate serving HTTP on$FISSION_RUNTIME_PORT— bring your own framework (axum/actix/rocket/warp). Multi-[[bin]]projects deploy all binaries and--entrypointselects one at specialize.fission-rustSDK crate (in-repo, vendored into the builder):fission_rust::serve(handler).Contract notes
/specializeloads from/userfunc/user; v2 handles file or directoryfilepath+functionName, with empty-filepath fallback like the binary env.binary/server.go); pre-specialize requests return 500 "Container not specialized".DEPLOY_PKGis created up front (the exact failure from Rust environment support #81).Testing
cargo test— 12 unit tests (binary resolution, specialize contract, port resolution)rust/test/local_test.sh— cluster-free contract test (specialize + proxy, both modes)rust/tests/test_rust_env.sh— kind e2e: single-file (poolmgr + newdeploy) and Cargo project (POST echo)Release
envconfig.jsonstarts at1.0.0; first merge publishesrust-env/rust-buildervia the GHCR gate. The fission.io site needs a sync for the new environment after merge.🤖 Generated with Claude Code