Skip to content

Create Railway database with its volume attached before the first deployment - #4712

Open
infomiho wants to merge 1 commit into
miho/fix-railway-deploymentfrom
miho/railway-deploy-grace
Open

Create Railway database with its volume attached before the first deployment#4712
infomiho wants to merge 1 commit into
miho/fix-railway-deploymentfrom
miho/railway-deploy-grace

Conversation

@infomiho

@infomiho infomiho commented Aug 13, 2026

Copy link
Copy Markdown
Member

Description

  • railway add --image starts deploying immediately, before the volume attaches. The first deployment crashes and our wait logic could catch that crash and abort.
  • Now we create the service empty, attach the volume, and only then set the image and deploy (via railway api). One deployment, volume attached from the start.
  • Bumps the minimum Railway CLI to 5.28.0, which added railway api.
  • The Railway CLI has no way to create a service with a volume attached, and no combination of its commands achieves this without going directly to the API. Submitted an issue with Railway about this: Allow pinning the database image to an explicit version railwayapp/cli#1101

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

@infomiho
infomiho marked this pull request as ready for review August 13, 2026 18:14
@infomiho
infomiho requested a review from a team as a code owner August 13, 2026 18:14
@infomiho
infomiho requested review from FranjoMindek and removed request for a team August 13, 2026 18:14
@infomiho
infomiho temporarily deployed to fly-deploy-test August 13, 2026 18:19 — with GitHub Actions Inactive
@infomiho
infomiho deployed to railway-deploy-test August 13, 2026 18:19 — with GitHub Actions Active
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wasp.sh/spec

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/spec@4712

@wasp.sh/wasp-cli

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli@4712

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-arm64-unknown@4712

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-x64-unknown@4712

@wasp.sh/wasp-cli-linux-arm64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-arm64-glibc@4712

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-glibc@4712

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-musl@4712

commit: 687b28c

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Reviewed the Railway database deployment wait behavior introduced by this PR.

  • Transient failure graceFAILED and CRASHED statuses must now persist for 30 seconds before aborting database setup, allowing Railway's replacement deployment to take over after volume attachment.
  • Recovery and timeout behavior — A non-failure status resets the grace period, SUCCESS still returns immediately, and the existing five-minute deadline remains the final bound.
  • Scope and verification — The helper is used only by database setup; 37 Railway-focused tests and the deploy package TypeScript build pass.

Pullfrog  | View workflow run | Using GPT Sol𝕏

@infomiho infomiho changed the title Tolerate transient crash while waiting for Railway database deployment Create Railway database with its volume attached before the first deployment Aug 13, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new deployment sequence can target an environment other than the one where Railway attached the database volume.

Reviewed changes Reviewed the new volume-first Railway database setup added since the prior Pullfrog review.

  • Replaced the transient-failure grace — Created the database service without an image, attached its volume, then set the image and explicitly started its first deployment.
  • Routed the environment through setup — Extracted an environment ID from Railway project status and passed it to serviceInstanceUpdate and serviceInstanceDeployV2.
  • Updated the CLI contract and coverage — Raised the minimum and CI-pinned Railway CLI version to 5.28.0 and added command-ordering and cleanup tests.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT Sol𝕏

Comment thread waspc/data/packages/deploy/src/providers/railway/railwayProject/RailwayProject.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

No new issues were introduced by 03903d9; the existing linked-environment targeting finding remains open and still needs to be addressed.

Reviewed changes Reviewed the command-plumbing refactor pushed after the previous Pullfrog review.

  • Reused one Railway command — Constructed the cwd-bound railwayCli command once per database operation and threaded it through the setup helpers.
  • Simplified helper contracts — Replaced repeated executable and project-directory option objects with the existing Command abstraction.
  • Preserved behavior and verification — Kept command ordering and cleanup behavior unchanged; all 38 Railway-focused tests and the deploy package TypeScript build pass.

Pullfrog  | Fix it ➔View workflow run | Using GPT Sol𝕏

@infomiho
infomiho force-pushed the miho/railway-deploy-grace branch from 03903d9 to 0a24573 Compare August 13, 2026 20:42
@infomiho
infomiho temporarily deployed to fly-deploy-test August 13, 2026 20:58 — with GitHub Actions Inactive
@infomiho
infomiho deployed to railway-deploy-test August 13, 2026 20:58 — with GitHub Actions Active
@infomiho

Copy link
Copy Markdown
Member Author

Not ready for a review yet

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Reviewed the Railway database creation changes through the final code-review restructuring.

  • Selected the linked environment — Replaced positional environment selection with railway environment list --json and its explicit isLinked marker.
  • Separated service-instance operations — Moved image updates and deployment starts into focused Railway service-instance helpers while preserving volume-first ordering and cleanup.
  • Strengthened contracts and coverage — Tightened API response schemas and added a regression test that selects the linked environment even when it is not first; all 42 Railway-focused tests and the deploy package TypeScript build pass.

Pullfrog  | View workflow run | Using GPT Sol𝕏

@infomiho
infomiho force-pushed the miho/railway-deploy-grace branch from 4ec33f8 to 712d63a Compare August 14, 2026 07:09

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest commit removes regression coverage for both defects this PR addresses.

Reviewed changes Reviewed the changes in 4ec33f834 since the prior Pullfrog review.

  • Restored the grouped image contract — Reintroduced imageSpec for database creation and explicitly typed the Railway service instance passed to the API helpers.
  • Pruned and consolidated tests — Removed schema and linked-environment tests and folded the database setup assertions into one looser test.
  • Verified the current tree — All 34 Railway-focused tests pass, and the deploy package TypeScript build succeeds.

⚠️ Linked-environment selection no longer has regression coverage

Deleting railwayEnvironment/cli.test.ts leaves no test that getLinkedEnvironmentId selects the isLinked environment when it is not first, or rejects a response with no linked environment. This removes the regression test for the environment-targeting bug fixed after the prior review.

Technical details
# Restore linked-environment behavior coverage

## Affected sites
- `waspc/data/packages/deploy/src/providers/railway/railwayEnvironment/cli.ts:17` — the linked-environment selection and error paths no longer have direct coverage.

## Required outcome
- A focused test must fail if selection returns to positional environment ordering or stops rejecting an unlinked directory.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT Sol𝕏

@infomiho
infomiho temporarily deployed to fly-deploy-test August 14, 2026 07:14 — with GitHub Actions Inactive
@infomiho
infomiho deployed to railway-deploy-test August 14, 2026 07:14 — with GitHub Actions Active
@infomiho
infomiho force-pushed the miho/railway-deploy-grace branch from 712d63a to 687b28c Compare August 14, 2026 07:21
@infomiho
infomiho temporarily deployed to fly-deploy-test August 14, 2026 07:44 — with GitHub Actions Inactive
@infomiho
infomiho deployed to railway-deploy-test August 14, 2026 07:44 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant