runbook icon indicating copy to clipboard operation
runbook copied to clipboard

Long running processes

Open pitosalas opened this issue 5 years ago • 5 comments

What's the right way to launch a process that is meant to keep on running? For example, my ruby program is a service that listens on a tcpip port until it is killed. If I start it with a simple command then the runbook blocks. If ^c the runbook then I think the service is left in limbo. This can't be right can it?

p.s. is there a gitter or slack channel on which I can more reasonably post these questions? I know you said it's ok but ...

pitosalas avatar Feb 09 '20 02:02 pitosalas

I'm happy to inform you that you've inspired me to set up a gitter chatroom: https://gitter.im/braintree/runbook?utm_source=share-link&utm_medium=link&utm_campaign=share-link

Is the intent to have the process run in parallel during the life of the runbook or to have the runbook start the process so it executes indefinitely? In the former case, using tmux_command is the preferred way to execute processes in parallel with the execution of the runbook. In the latter case, I would recommend using some sort of process manager to ensure your process continues to run and then to interact with your process manager to start or stop the process.

pblesi avatar Feb 11 '20 02:02 pblesi

See followup in Gitter!

pitosalas avatar Feb 11 '20 23:02 pitosalas

Reopening this question. I've set up systemctl to start up my service only to realize that my service needs to be given various tokens to run and that my go-to way of doing that was with environment variables... why in turn are not set up (obviously) when I start it with systemctl. So it seems like starting it via ssh / runback still might be a good idea. But now I am back to the question of a "long running process". Do you still recommend that I use something like systemctl and somehow give it that correct values for the environment variables?

pitosalas avatar Feb 20 '20 16:02 pitosalas

Yeah, I think systemctl is still the way to go. I would recommend creating configuration files in /etc/your_app. These files can contain your tokens, and you can upload the files using Runbook. Your long running process would read that file when it starts up.

pblesi avatar Feb 21 '20 03:02 pblesi

@pitosalas - were you able to try @pblesi's suggestion here?

coopergillan avatar Jan 28 '22 22:01 coopergillan