Is there a way to connect to server via cli and then run some scripts like heroku has heroku run

We want to manually run an npm script in our code on live deployment is there a way to do that in CLI. On heroku we had option to use heroku run.
10 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Faraz
Faraz3y ago
Might be possible depending on the script using railway run with the CLI.
Muhammad Farhan Tahir
its npm script that we want to run. We have a script that indexes our data to algolia which we sometimes manually run via cli. could you please link to railway run docs?
Faraz
Faraz3y ago
https://docs.railway.app/reference/cli-api#run Just make sure you're in the right environment/project etc.
Muhammad Farhan Tahir
So I have to first connect project locally and then give flag for environment right?
Faraz
Faraz3y ago
Yep, railway link PROJECT_ID and then I think you can simply do railway environment to switch environments. That way, you don't need to attach the flag. railway status to check where you're at.
Muhammad Farhan Tahir
Ok, let me try a test. How to select which repo to run against?
Faraz
Faraz3y ago
What do you mean? I am assuming you have the repo cloned locally and are running all the commands in that directory.
Muhammad Farhan Tahir
noted I have cloned. Awesome, CLI app is really great, it asked me about the repo I want to run as services to select which environment I want to pick. In short less friction. I am really enjoying it. Thanks for the help!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server