2 years ago
hi all,
Is there a way to input console commands for my deployment, like you could with a regular node.js project locally?
the goal of what i'm doing is to be able to execute events via a console command at runtime.
18 Replies
2 years ago
ya, you can connect to the container's console via railway ssh
(make sure you have the latest cli installed)
awesome, thank you.
I'm currently trying to test this using the following, but it doesn't seem to be working. I'm inputting "test" into the terminal after successfully connecting to the interactive shell
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on('line', (message) => {
console.log(`Input received: ${message}`);
})Is there a step I'm missing here to have this work with ssh? This works as expected when I test locally.
2 years ago
You might have to spawn that interactive cli in the ssh cli after connecting to the container
That sounds a bit beyond the scope of my current knowledge, is there any resource you could direct me to so that I can try figure that out?
2 years ago
you just run your node app's cli after connecting to the container
2 years ago
I'm not sure of your workflow, though personally if I had to make this then I'd have two entrypoints in my app
the main entrypoint, which is my actual application, then a second cli entrypoint that I can run myself, like node cli.js
2 years ago
-# I could be fully wrong here, I've never done this before since I've never needed to make an interactive CLI for a production application hosted elsewhere
2 years ago
np!!
This does seem to work, though i'll have to figure out how/if i can integrate it with my existing project (for anyone who finds this via search)
2 years ago
yea true, that is the only issue with this approach though I can't think of another way to tackle this
2 years ago
(again though I've never done this before so there could be better ways but this is what I'd do personally)
2 years ago
hosting a CLI application on a web hosting platform is definitely not what railway ssh is intended to be used for
2 years ago
sometimes you gotta swat flies with a sledgehammer
2 years ago
sometimes you gotta swat flies with a sledgehammer
2 years ago
feel free to mark as solved fragly
2 years ago
!s
Status changed to Solved dev • over 1 year ago