2 years ago
I have a project where I have a postgres database and a service for my node js server.
When I type in the cli railway up, it brings up a service selection option (instead of selecting the only one relevant service) and it shows in the optional services, the postgres service - as if I could add my nodejs code to the postgres service - I don't want to know what happens if I select that by mistake
6 Replies
2 years ago
Just selecting it doesn't do anything until you run the up command, and even so, unless your code for some reason decides to write data to the specific directory that postgres writes it's data to you won't be subject to any data loss and you could simply re-deploy the database and be back.
As for why it's shown, because it's just another service, there really isn't anything that differentiates it from any other service in your project, besides maybe showing a data tab.
2 years ago
Hi @brody,
I'm see it when I'm running railway up and as such it can cause an error :(
I understand that you view it as just another service, from a railway engineer perspective - but from a DX experience I think that the use case of uploading nodejs to a postgres service is not a real use case - and leaving that option may cause errors.
To qoute you from a while ago - it's not ideal
https://discord.com/channels/713503345364697088/921233523719946260/1160573630145630260
I hope you'll tweek it - as I keep getting it wrong :(
2 years ago
I'll clarify - I do a lot of live coding demos, where I deploy to railway - that's why I'm running into the railway up select service issue almost on every deploy.
I understand that it's a special case - but still - remove friction from first deployment doesn't sound like a bad idea
2 years ago
I'd like to first clarify that I do not work for Railway.
Yes its not ideal that you can do it accidentally, but as they are actually just another service the same as your app's service there is no good way to differentiate them as of right now, and it would not make total sense to hide them outright by default, I've personally ran railway upon purpose while linked to a database many many times.
Is the issue here that you are simply selecting the wrong service when prompted to select the service?
2 years ago
Yes - because it's sorted by name, it's sometimes the first and sometimes the second. I'm sure that they know how to diffrenciate the two services
2 years ago
It's a dynamic detection, there isn't any config on the service itself to say if its a database, for example, I could name my source image "postgres-backup" and have it detect as a database service.
Either way, there are legitimate usecases for running railway up on a database service so it would not make sense to hide them by default.
I think its best just to simply select the service you want to use, and to not select the service you don't want to.