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
Project ID:
N/A
N/A
You might find these helpful:
- Is it possible to turn a deployment, service or project off so it doesn't use any resources?
⚠️ experimental feature
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
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.
then you want a test bot and a prod bot
If I remove a deployment, do I basically have to push a dummy commit to the GitHub repo to redeploy?
yes
^
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
you should, ruining tests with the main (production) bot token is big bad
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 botlol
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
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 waywhat's
RAILWAY_ENVIRONMENT
?
is that something in env?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
)Ah okay gotcha
I just hate messing with token stuff, but I suppose I will go ahead and do that
Thank you guys :)
npp
i can run my bot locally and on railway, the code handles token switching by itself, the above was pseudo code
oh okay
Right so you just hotswap the token when running locally?
Yeah that's not that difficult really then
yep basically, super easy, way easier than checking for a file
yea fair point
I'll keep my file though
disk access go brrr
hehe
Discord permissions are just insanely annoying to fiddle with
Or I'm just dumb
wdyym, it's just checkboxes
por qué no los dos
Yeah but I always forget which permissions are necessary for my bot
So I just check admin usually lol
fair, normally I just make the bot admin when it's like a dedicated bot for a server
yea
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