R
Railway16mo ago
ethan

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
Percy16mo ago
Project ID: N/A
ethan
ethan16mo ago
N/A
Percy
Percy16mo ago
Brody
Brody16mo 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
ethan
ethan16mo 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
Brody16mo ago
then you want a test bot and a prod bot
ethan
ethan16mo ago
If I remove a deployment, do I basically have to push a dummy commit to the GitHub repo to redeploy?
Brody
Brody16mo ago
yes ^
ethan
ethan16mo 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
Brody16mo ago
you should, ruining tests with the main (production) bot token is big bad
Fragly
Fragly16mo 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
Brody16mo ago
lol
Fragly
Fragly16mo 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
Brody16mo 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
Fragly16mo ago
what's RAILWAY_ENVIRONMENT? is that something in env?
Fragly
Fragly16mo 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 )
ethan
ethan16mo 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
Fragly16mo ago
npp
Brody
Brody16mo ago
i can run my bot locally and on railway, the code handles token switching by itself, the above was pseudo code
Fragly
Fragly16mo ago
oh okay
ethan
ethan16mo ago
Right so you just hotswap the token when running locally? Yeah that's not that difficult really then
Brody
Brody16mo ago
yep basically, super easy, way easier than checking for a file
Fragly
Fragly16mo ago
yea fair point I'll keep my file though sunglas
Brody
Brody16mo ago
disk access go brrr
Fragly
Fragly16mo ago
hehe
ethan
ethan16mo ago
Discord permissions are just insanely annoying to fiddle with Or I'm just dumb
Fragly
Fragly16mo ago
wdyym, it's just checkboxes
Brody
Brody16mo ago
por qué no los dos
ethan
ethan16mo ago
Yeah but I always forget which permissions are necessary for my bot So I just check admin usually lol
Fragly
Fragly16mo ago
fair, normally I just make the bot admin when it's like a dedicated bot for a server yea
Adam
Adam16mo 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