fix(rivetkit): support custom local engine ports#5208
Open
hami-sh wants to merge 1 commit into
Open
Conversation
Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019eaaa8-1aba-7182-8e71-fca10827c5e5
9dd2e4a to
592d827
Compare
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.
Summary
startEngine: trueto use an explicit localendpoint, so local engines can bind to non-default portsstartEnginewith remote endpointslocalhost:6420RIVET_ENDPOINTas the way to select the spawned local engine port whenRIVET_RUN_ENGINE=1User stories
startEnginebeing local-only; remote endpoints remain rejected when trying to spawn a local engine.Why this approach
RIVET_ENDPOINTkeeps the public surface small and avoids overloading generic appPORTvariables.RIVETKIT_STORAGE_PATH.Validation
git diff --checkpnpm --filter rivetkit run check-typespnpm --filter rivetkit run buildpnpm --filter @rivetkit/rivetkit-napi run build:forcecargo build -p rivet-engineexamples/hello-worldwithRIVET_RUN_ENGINE=1,RIVET_ENDPOINT=http://127.0.0.1:7654,RIVET_ENGINE_BINARY=/Users/hamish/Developer/rivet/target/debug/rivet-engine, and an isolatedRIVETKIT_STORAGE_PATHwhile another engine was already listening on 6420:lsofshowedrivet-enginelistening on127.0.0.1:7654,7655, and7664curl http://127.0.0.1:7654/healthreturned{"runtime":"engine","status":"ok","version":"2.3.0-rc.12"}rivetkit/clientcall to the hello-worldcounteractor returnedincrement 2andcount 2pnpm --filter rivetkit exec vitest run tests/registry-constructor.test.tspartially ran: the new tests passed, but the existing "reads config mutations made before the native registry is built" test is blocked in this checkout by missing@rivetkit/rivetkit-napi-darwin-arm64until the local NAPI artifact is built.Notes
rivet-dev/rivetwas denied for my GitHub account, so this PR is opened from thehami-sh/rivetfork.