feat(railway): add Railway provider with core resources#1332
Open
Makisuo wants to merge 17 commits intoalchemy-run:mainfrom
Open
feat(railway): add Railway provider with core resources#1332Makisuo wants to merge 17 commits intoalchemy-run:mainfrom
Makisuo wants to merge 17 commits intoalchemy-run:mainfrom
Conversation
Add a new Railway cloud infrastructure provider with resources for:
- Project — create/update/delete with workspace auto-detection and adopt support
- Service — deploy from Docker images or GitHub repos with instance config
- Environment — isolated environments with immutable name (replace on change)
- Variable — bulk upsert/delete with Secret support and key tracking
- Volume — persistent storage with immutable mountPath and conditional deletion
- Domain — Railway-generated (*.up.railway.app) or custom domains
- TCPProxy — expose non-HTTP services with immutable applicationPort
Includes:
- GraphQL API client using safeFetch with Bearer token auth
- 7 test suites (all passing against live Railway API)
- Provider docs (index + 7 resource pages)
- Getting started guide
- Package.json export
```ts
import { Project, Service, Variable, Domain } from "alchemy/railway";
const project = await Project("my-app", { name: "my-app" });
const api = await Service("api", {
project,
source: { image: "node:20" },
startCommand: "node server.js",
});
await Variable("vars", {
project,
environment: project.defaultEnvironmentId,
service: api,
variables: { NODE_ENV: "production" },
});
const domain = await Domain("domain", {
service: api,
environment: project.defaultEnvironmentId,
});
```
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…pt fallback When alchemy state is lost or stale but the Railway service already exists, serviceCreate fails with "already exists". If adopt is enabled, catch this error and fall back to finding and adopting the existing service. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Railway API rejects serviceUpdate with the same name, returning "A service named X already exists in this project". Skip the mutation when the name hasn't actually changed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add serviceExists check in update path. If a service was deleted from Railway but alchemy state still references it, fall through to the create path instead of silently skipping.
Deleted/detached services are still queryable by ID via the Railway API but don't appear in the project's service list. Check the project's services instead to properly detect externally-deleted services.
The serviceExists check was added as a workaround for stale state but is not standard alchemy practice. The proper fix is to clear stale state rather than query Railway on every update. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
commit: |
Collaborator
|
Started working on getting all the tests passing so we can merge, but ran into a rate limit! Waiting on Railway to get it fixed. |
Collaborator
|
Hi @Makisuo, I'm having some trouble with test failures. Do these pass on your end? |
Author
let me double check, i had run them before and everything was passing. |
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
safeFetchwith Bearer token authRAILWAY_API_TOKEN)Resources
ProjectServiceEnvironmentVariableVolumeDomain*.up.railway.app) or custom domainsTCPProxyUsage