24 days ago
Hello,
I’m trying to provision/attach a Railway Volume to an existing service/resource that is currently disconnected and has zero environment instances.
The request is rejected with:
BAD_USER_INPUT
I do not want to retry by guessing different fields, so I’m trying to confirm the currently supported lifecycle/contract first.
Could someone clarify:
-
Can a Volume be provisioned directly for a service/resource that currently has zero environment instances?
-
Does an environment/service instance need to be materialized first before a Volume can be created or attached?
-
If so, what is the supported sequence for:
disconnected service → environment instance → volume → mount -
Is a 1 GB Volume supported in the
sforegion? -
Is a mount path such as
/var/lib/app-observervalid? -
When provisioning/attaching the Volume, is
skipDeploys=truesupported, or is a deployment required as part of creating/materializing the Volume instance? -
Are Volume creation, environment-instance creation, attachment, and service mount configuration separate operations in the current Railway API/CLI?
I’m specifically looking for the supported provisioning contract before making another attempt. I do not need anyone to make changes to the project.
Thanks.
11 Replies
24 days ago
The documented volumeCreate inputs are projectId, serviceId and mountPath, plus optional environmentId and region (Manage Volumes). A volume is created attached to a service in an environment, so the reliable sequence is to have that service applied in the target environment first. For a service with no source, you can apply it as an empty service, set its region under Settings > Scale > Regions and apply that, then create the volume. Applying an empty service or its settings does not start an application deployment.
sfo is not a region identifier. US West (California) is us-west2 (Regions), and the regions query lists the accepted values. Volumes also follow the region of the service they are attached to. A 1 GB volume is within your plan's 5 GB volume size limit.
/var/lib/app-observer is an absolute path, the same form as the documented mount paths such as /var/lib/postgresql/data.
skipDeploys and a size field are not among the documented volumeCreate inputs. Size can be set with sizeMB in Infrastructure as Code, and the mount path can be changed later with volumeInstanceUpdate. So volume creation (which includes the mount) and service/environment configuration are separate operations.
Status changed to Awaiting User Response Railway • 24 days ago
Railway
The documented `volumeCreate` inputs are `projectId`, `serviceId` and `mountPath`, plus optional `environmentId` and `region` ([Manage Volumes](https://docs.railway.com/integrations/api/manage-volumes)). A volume is created attached to a service in an environment, so the reliable sequence is to have that service applied in the target environment first. For a service with no source, you can apply it as an empty service, set its region under Settings > Scale > Regions and apply that, then create the volume. Applying an empty service or its settings does not start an application deployment. `sfo` is not a region identifier. US West (California) is `us-west2` ([Regions](https://docs.railway.com/deployments/regions)), and the `regions` query lists the accepted values. Volumes also follow the region of the service they are attached to. A 1 GB volume is within your plan's 5 GB volume size limit. `/var/lib/app-observer` is an absolute path, the same form as the documented mount paths such as `/var/lib/postgresql/data`. `skipDeploys` and a size field are not among the documented `volumeCreate` inputs. Size can be set with `sizeMB` in [Infrastructure as Code](https://docs.railway.com/infrastructure-as-code/reference), and the mount path can be changed later with `volumeInstanceUpdate`. So volume creation (which includes the mount) and service/environment configuration are separate operations.
24 days ago
Thanks — this clarified most of the contract. I cross-checked the guidance against the current Railway documentation and metadata.
Two specific questions remain before I make another attempt:
-
The target resource already exists, but currently has zero environment instances. What is the supported API/CLI operation to materialize/reuse that exact existing resource in the target environment so a Volume can be attached to it? I specifically need to preserve and reuse the existing resource rather than create another service.
-
The required Volume capacity is 1024 MB. Current plan metadata reports 5000 MB as both the default and maximum, while the documented
volumeCreateinput does not exposesizeMB.
What is the supported way to initialize the Volume at exactly 1024 MB for this existing-resource path?
If sizeMB: 1024 must be configured through Infrastructure as Code or an environment/service patch before Volume creation, could you please confirm the exact supported sequence?
I am looking for the supported lifecycle/contract only and do not want to experimentally retry production mutations.
Thanks.
Status changed to Awaiting Railway Response Railway • 24 days ago
24 days ago
For exactly 1024 MB, the path that sets size at creation is Infrastructure as Code: declare a volume(...) with sizeMB: 1024 and mount it on the service through volumeMounts, as shown in the IaC reference. railway config pull imports existing services, volumes and mounts, so pulling the project first lets your config refer to the service you already have instead of declaring a new one. volumeCreate has no size input. A volume made that way gets the plan default (5000 MB on your workspace), and resizing only grows a volume, so it can't be brought down to 1024 MB later. In IaC, lowering sizeMB is treated as destructive.
For your first question, we haven't been able to confirm which public API or CLI operation creates an instance of an existing service in an environment where it currently has none. We aren't going to guess at a mutation for a production change. What we can say is that a volume is always created attached to a service in a specific environment, so the service has to exist in that environment before the volume can be created. The dashboard's Deploy button applies staged changes, and applying settings on a service with no source doesn't start an application deployment.
Status changed to Awaiting User Response Railway • 24 days ago
24 days ago
Thanks. I pulled the existing Railway configuration and prepared the proposed IaC change without applying it.
Three safety questions remain before I can use this in production:
- Existing service identity / reuse
The existing target service has a stable Railway UUID, but the imported/planned configuration does not give me enough evidence that applying the configuration will reuse that exact existing service rather than create, replace, or otherwise rematerialize it.
What is the supported way to bind an IaC service declaration to an already-existing Railway service so its exact existing identity is preserved?
Is there a supported identity/import mechanism I should verify before applying?
- Volume mount deployment behavior
The planned volume mount reports:
deployEffect: deploy
Does applying a new volumeMount to an existing service trigger an application deployment/redeployment of that service?
If the service currently has zero instances, what exactly does deployEffect: deploy do?
I need to distinguish configuration materialization from starting/restarting an application workload.
claim: trueownership scope
The imported configuration contains claim: true alongside declarations that include existing resources such as PostgreSQL.
What exactly does claim: true claim/manage?
Does applying such a configuration make the IaC document authoritative for all declared/imported resources, potentially modifying or deleting resources that are omitted or differ from the current configuration?
What is the safest supported way to add one 1024 MB volume and mount while ensuring existing PostgreSQL and unrelated services remain completely untouched?
I am not looking to experimentally apply the configuration. I need the identity, deployment, and ownership semantics established before making the production change.
Thanks.
Status changed to Awaiting Railway Response Railway • 24 days ago
24 days ago
On identity: the IaC file has no service ID field. railway config pull writes services under their Railway names and leaves out internal IDs, and services are matched by those names. Use the plan as your check before applying. A reused service shows as a change, while a new one shows as + Create service <name>. You can review it with railway config plan --json. railway config plan --out railway-plan.json and then railway config apply --plan railway-plan.json applies exactly that reviewed change set, and the apply is refused if the environment changed after the plan.
On ownership: a file without a named partial manages the whole environment, so anything left out of it gets deleted. To narrow the scope, export a named partial (for example export const partial = "observer") from a file that declares only the target service and its volume(..., { sizeMB: 1024 }) mount. A named partial only deletes resources it owns, so Postgres and unrelated services are left alone. Its first apply claims the resources it declares, and railway config partials list shows that ownership (Multi-repo projects). The plan should list only the volume and the mount. If it shows variable deletes on that service, its env block needs preserve() entries.
We can't confirm what claim: true controls, or whether the mount's deploy effect starts a workload when the service has no instance in that environment. What we can confirm is that deployEffect describes that single change, and deployments are chosen based on what actually changes.
Status changed to Awaiting User Response Railway • 24 days ago
24 days ago
Thanks. The service-side architecture is now resolved: the existing service is the intended mount target, and no additional service is required.
One final identity question remains before I can safely apply the IaC plan.
An observer Volume already exists in the Railway project with its own existing Volume UUID. The named partial declares a 1024 MB volume and mount for the existing service, but the plan represents the volume operation as resource.create.
How does Railway IaC determine whether that volume declaration reuses/claims the already-existing Volume versus creating a new Volume?
Specifically:
- Can an existing Railway Volume be imported/claimed by a named partial while preserving its exact existing Volume UUID?
- If yes, what field/name/import mechanism establishes that identity?
- What should
railway config plan --jsonshow when the existing Volume will be reused rather than a new Volume created? - Does
resource.createalways mean a new Volume with a new UUID, or can it represent claiming/materializing an existing unowned Volume? - If an existing Volume cannot be claimed by the partial, what is the supported way to mount that exact existing Volume on an existing service without creating a replacement Volume?
I specifically need to avoid accidentally creating a second Volume or replacing the existing one.
I am only asking for the identity/materialization contract and will not apply the plan until this is established.
Thanks.
Status changed to Awaiting Railway Response Railway • 24 days ago
24 days ago
Treat resource.create on the volume as a new volume. It is not a safe signal that the existing observer volume will be reused, and we can't confirm that it ever represents claiming an existing one.
railway config pull imports existing volumes and service mounts into the configuration (IaC reference). To target the volume you already have, keep the volume(...) declaration exactly as pull wrote it, rather than authoring a new one, and reference that same declaration in your service's volumeMounts. We can't confirm the exact key the planner uses to match a volume to an existing one, so the plan is your check: a reuse should not contain any volume create, only the mount change on the service.
Also compare the existing volume's size with the partial's sizeMB: 1024. Decreasing sizeMB is treated as destructive, so if the existing volume is larger, keep the size that pull imported. A volume can be attached to only one service.
Status changed to Awaiting User Response Railway • 24 days ago
24 days ago
Thanks. I performed another read-only check based on your guidance.
The existing Volume is visible in the project inventory, but it has zero Volume instances.
Because of that:
railway config pulldoes not import a declaration for it;- no environment allocation is visible;
- its allocated region and capacity are unavailable;
- it is not attached to any service;
- authoring a Volume declaration causes the plan to show a new Volume create.
Could you please confirm:
- Does a project-level Volume with zero instances have any allocated Volume state that can actually be imported/reused?
- Is there a supported operation to materialize that exact existing Volume into an environment while preserving its existing identity and without creating a new Volume?
- If no zero-create reuse path exists, is the supported solution to create a new IaC-managed Volume with the required initial
sizeMB, region and mount? - Can that new Volume be created through a named partial that manages only the Volume and its mount on the existing service, leaving PostgreSQL and all unrelated resources untouched?
- What should be done with the old zero-instance project Volume afterward: may it safely remain unused, or should it eventually be removed?
I will not make any production mutation until the supported lifecycle is established.
Thanks.
Status changed to Awaiting Railway Response Railway • 24 days ago
24 days ago
We can't confirm that a volume with no instance in any environment has state that can be imported or reused. We also can't confirm any supported operation that brings that exact volume into an environment under its current identity. railway config pull only imports the project's current configuration, so a volume that isn't in the environment won't be written out, and a volume create in the plan is what we'd expect for your setup.
So yes, the path to use is a new IaC-managed volume. In a file that exports a named partial, declare a volume(...) with sizeMB: 1024 and the region you need, and mount it on the existing service through volumeMounts. A named partial only deletes resources it owns, and resources it doesn't declare are left alone, so PostgreSQL and unrelated services are not in its scope. Its first apply claims what the file declares. Run railway config plan --out railway-plan.json and check that it lists only the one volume create and the mount change on that service. Then apply that exact change set with railway config apply --plan railway-plan.json (Infrastructure as Code).
We can't confirm whether the old zero-instance volume holds anything or what removing it would affect. The new volume is created separately, so you don't need to decide what to do with the old one before making this change.
Status changed to Awaiting User Response Railway • 24 days ago
24 days ago
We executed one pinned named-partial IaC apply and stopped fail-closed because the resulting deployment did not match the reviewed commissioning assumptions. No retry was performed.
The apply successfully created the intended new 1024 MB volume in us-west2 and mounted it on the existing service. However, we need provider-level clarification on two effects before continuing.
1. Deployment image selection
Before the apply, the existing stopped GET-only deployment used one image digest. The volume-mount apply triggered a new deployment, but the new deployment used a different image digest even though the service identity and intended application configuration were preserved.
Could you clarify:
- When
volumeMountshas a deployment effect, does Railway rebuild/repackage the service rather than reuse the previous deployment image? - Can a pinned IaC plan guarantee reuse of an exact existing image digest?
- If exact digest reuse is not supported, what immutable source/build identity should be verified before and after the apply to prove that the resulting deployment contains the same approved application source?
- Is there a supported way to deploy an exact previously built image/deployment artifact while adding the volume mount?
2. Previous zero-instance Volume disposition
Before the apply, the project inventory contained an older disconnected Volume with zero instances. After applying the named partial that created the new IaC-managed Volume, that old zero-instance Volume no longer appears in complete project Volume inventory.
We issued no explicit delete, resize, attach, or replacement request for that old Volume.
Could you clarify:
- Can the first apply of a named partial reconcile/remove an existing unallocated zero-instance Volume that is not declared by that partial?
- Could such a zero-instance project Volume disappear through another normal Railway lifecycle or garbage-collection mechanism?
- Is there an audit/apply receipt or supported API/CLI view that can establish what happened to that Volume?
We do not need the old Volume restored at this point; we need to establish the actual provider behavior before approving a continuation.
The newly created Volume is being retained. The new application deployment has been stopped, and no further apply/restart will occur until these semantics are understood.
Thanks.
Status changed to Awaiting Railway Response Railway • 24 days ago
24 days ago
The deployment created by that apply was a fresh build from your GitHub source, not a reuse of the earlier image. It was built from the latest commit on the connected branch at the time of the apply, so a different image digest is what we'd expect. A volume-mount change selects the service for a new deployment. The IaC plan has no field for pinning an image digest, so a pinned plan pins the change set rather than the build artifact.
The immutable identity to compare is the commit hash shown on each deployment in the dashboard. If the pre-apply deployment and the new one show the same commit, they were built from the same source, even though the image digests differ.
For the old zero-instance volume, the activity we can see for your workspace around the apply shows the new deployment and the new volume being set up on that service, and no delete event for another volume. That doesn't establish what happened to the old volume. A named partial only deletes resources it owns, and on its first apply it claims only what the file declares.
Status changed to Awaiting User Response Railway • 24 days ago
17 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 17 days ago