Repository navigation
feat(railway): set Service CPU and memory limits - #2203
Open
husseinraoouf wants to merge 1 commit into
Open
husseinraoouf wants to merge 1 commit into
husseinraoouf wants to merge 1 commit into
Conversation
`Railway.Service` takes a `limits: { cpu, memoryBytes }` prop and exposes the
observed value as a `limits` attribute. Reconcile writes
`services[id].deploy.limitOverride.containers` with `environmentPatchCommit`,
the same path `region` uses, and only for fields that differ. Omitting the prop
leaves the current limits alone, and omitted fields keep their value. The patch
commit redeploys the service, so reconcile needs no extra deploy.
Fixes alchemy-run#2202
Co-Authored-By: Claude Opus 5.5 <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.
Railway.Servicecan now declare per-replica resource limits, the dashboard's Resource Limits setting.services[id].deploy.limitOverride.containerswithenvironmentPatchCommitunderwithEnvironmentConfigLock, the same pathregionuses. It patches only the fields that differ, then waits until the config reflects them (bounded, failing withServiceLimitsNotApplied).limitsleaves the current limits untouched, and omitting a field keeps that field's value.readreports the observed value as the newlimitsattribute.ServiceRegion.tsnow exports itsreadEnvironmentConfigandenvironmentPatchCommithelpers so both modules share them.Testing
test/Railway/ServiceLimits.test.tscovers the pure helpers: reading the override, patching only differing fields, and leaving matching limits alone. It passes, as doesServiceRegion.test.ts.Service.test.ts: set a service's resource limits and change them. Create ({ cpu: 1, memoryBytes: 1e9 }) and update ({ memoryBytes: 2e9 }, keepingcpu: 1) passed their assertions, the environment config showed the new override, and the deployment reachedSUCCESS. The finalstack.destroy()failed withNot Authorized, because the account I tested with can't runserviceDelete(see Railway.Service delete removes the service from every environment #2179), so cleanup still needs a run with delete rights.tsc -b packages/alchemy/tsconfig.json, which builds the referenceddistilledprojects first, exits 0 with no errors.Fixes #2202
🤖 Generated with Claude Code