R
Railway17mo ago
echan

is there any way to indefinitely suspend a service?

Without removing a deployment, I just want to turn off a service to test it locally (the deployment would interfere with it if I test local). I don't see an option to do this. Am I missing something?
32 Replies
Percy
Percy17mo ago
Project ID: N/A
echan
echan17mo ago
N/A
Percy
Percy17mo ago
Brody
Brody17mo ago
there is no such feature, only removing deployment but i will say if your local tests can interfere with the app running on railway, youre doing something wrong
echan
echan17mo ago
It's a discord bot. The only way I can test is by it connecting with Discord's API, so both of them have real effects.
Brody
Brody17mo ago
then you want a test bot and a prod bot
echan
echan17mo ago
If I remove a deployment, do I basically have to push a dummy commit to the GitHub repo to redeploy?
Brody
Brody17mo ago
yes ^
echan
echan17mo ago
In that case I'd have to set up a whole new bot and its token, which is definitely the best practice but I'm too lazy for that haha But I suppose I should
Brody
Brody17mo ago
you should, ruining tests with the main (production) bot token is big bad
Fragly
Fragly17mo ago
I recommend this too here's a good way to do it, or at least how I do it so i have a bat file which basically starts the bot in my bot i have the bot check for a certain file which I've .gitignored if it finds it i know it's running locally, so I then switch out the bot token with my test bot token otherwise if it can't find it ( it's running from railway ) then i use the main bot's token so running the bat file will run it on my test bot and running the same command on railway ( npm start ) will run the test bot
Brody
Brody17mo ago
lol
Fragly
Fragly17mo ago
idk if this is standard, and idk if there's a better way but that's how I do it and it works for me
Brody
Brody17mo ago
in my bots code i check RAILWAY_ENVIRONMENT == "production" if so it will use the production token, otherwise it will use local token fragly is kinda doing the same thing, but in a very round-about way
Fragly
Fragly17mo ago
what's RAILWAY_ENVIRONMENT? is that something in env?
Fragly
Fragly17mo ago
dang that's neat, the reason I'm not doing something like that btw is because I might want to host the main bot locally in that case I just remove the file ( named dev )
echan
echan17mo ago
Ah okay gotcha I just hate messing with token stuff, but I suppose I will go ahead and do that Thank you guys :)
Fragly
Fragly17mo ago
npp
Brody
Brody17mo ago
i can run my bot locally and on railway, the code handles token switching by itself, the above was pseudo code
Fragly
Fragly17mo ago
oh okay
echan
echan17mo ago
Right so you just hotswap the token when running locally? Yeah that's not that difficult really then
Brody
Brody17mo ago
yep basically, super easy, way easier than checking for a file
Fragly
Fragly17mo ago
yea fair point I'll keep my file though sunglas
Brody
Brody17mo ago
disk access go brrr
Fragly
Fragly17mo ago
hehe
echan
echan17mo ago
Discord permissions are just insanely annoying to fiddle with Or I'm just dumb
Fragly
Fragly17mo ago
wdyym, it's just checkboxes
Brody
Brody17mo ago
por qué no los dos
echan
echan17mo ago
Yeah but I always forget which permissions are necessary for my bot So I just check admin usually lol
Fragly
Fragly17mo ago
fair, normally I just make the bot admin when it's like a dedicated bot for a server yea
Adam
Adam17mo ago
Hopping in here to say that it is possible, remove the latest deployment and turn off the branch trigger in settings New deployments won't be made if the branch trigger is off