-
Notifications
You must be signed in to change notification settings - Fork 130
Allow changing service source in railway environment new
#702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Allow changing service source in railway environment new
#702
Conversation
coffee-cup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the usecase for this functionality. And having it tied to the railway environment new behaviour does not make sense imo. I think this would make more sense as a new command all together. This would keep the commands have a single responsibility instead of a "god" command that can do multiple unrelated things
|
The use case here is so that users can create pseudo PR environments that have services that actually deploy from there PR branch |
|
I would like to see this merged. My use case involves deploying pull requests from GitHub Actions by copying the production environment. If the source action is added as its own command, the duplicated one will deploy first with the copied environment branch, and all start-up scripts will run for that branch. I want to deploy the current pull request branch instead. |
|
Thoughts on passing the config as JSON or something? The command |
|
What is unclear about the usage that is currently specified? I'm not sure if parsing the config as JSON would be much better though. |
|
btw: currently, due to staged changes not being available on the public API, if you change the source & variables for a service it will make 2 deployments. if staged changes were available on the public API, this could be done in one deployment. |
|
Glad that staged changes will be made public soon! I like the idea of being able to select what to configure a service. I'm going to add a multi-select for all the options that can be picked, so that more can be added in the future. |
|
hosmelq, that is correct, you cannot non-interactively enter a 2FA code, so destructive actions are not possible in CI flows. This is mentioned in our docs. You would need to manually clean these up after the fact. |
I should have a PR/demo soon. Ideally any config should be editable for the service (staged or applying right away) for both in an environment and when creating a new environment with |
|
I've started working on the multi-select functionality, currently with just service sources & variables. If you want it to be editable for an existing environment (whilst not making a new one), would you want a different command? Maybe And when you say any type of option, could you be more specific? The main things I could think of would be public networking stuff (generating domains, adding domains) but that can already be done through the |
|
By any type of option, I mean all build/deploy/networking/source config. For reference, the staged change/environment config schema is available here. |
|
Perfect. Have staged changes been made live on the public API? Most of the CLI side work has been done, and I can begin implementing those other options. |
|
Yes it is available. It is not super well documented though. We are using the staged changes and environment config APIs in a new claude code plugin we are working on. We have some docs there
Hopefully this should be a good start. For fetching the environment config, we are already doing this in the CLI for the |
|
@Milo123459 Can you please let me know what you are going to do with this command for staged changes. I have a few ideas for a |
|
My current implementation for the environment new command (which can then be used for the edit command) is that you select what you wish to configure in a multi-select, select services for each option, and then it pulls it all together and makes one API call to update all the services. Also, I think your idea of the config command is pretty similar to mine for railway environment edit. |
|
Yes they sound similar. I'd love if this worked non-interactively too. I'll wait for the
I want to be able to do things like |
|
Yeah, my version works fully non interactively :) Noted! I'm gonna add this to my TODOs. |
|
@coffee-cup has the claude MCP repo been taken down? The links you've sent aren't working anymore. |
|
Also- if applying an edit to an existing environment, and there are staged changes that aren't applied, interactively I'll prompt and show the changes and ask for confirmation to merge, but non-interactively should it merge the changes by default or not apply them at all, even the new ones? I suppose I could also fetch the current changes, remove them, apply the new changes then apply the old changes again in a new patch and not stage those. |


This allows changing service source in railway environment new to either a Docker image or a GitHub repo.
If a GitHub repo is provided, a branch must also be provided. No validation is performed on Docker images due to the many forms they can come in (e.g
ghcr.io/...., ubuntu, _/node:latestetc.Examples
railway environment new foo --duplicate bar --service-sources baz github nodejs/node/master- change the source of the servicebazto the GitHub repo nodejs/node/master. Note that a branch is requiredrailway environment new foo --duplicate bar -s baz docker ubuntu:latest- change the source to a docker image of ubuntu:latestIt also works fully interactively:
Screen.Recording.2025-11-26.at.13.48.07.mov
(note that the query for making a new environment seems to be slowing it down so much due to a change introduced waiting for the environment to be actually duplicated).
Validation is also provided for GitHub repos: