robut icon indicating copy to clipboard operation
robut copied to clipboard

Feature: Fork process into background

Open richard4339 opened this issue 10 years ago • 7 comments

Perhaps there's already a way to do this and I'm completely missing it, but I'd like to request a way to fork the process into the background. My goal is to put the bot in upstart or equivalent. Server hiccups cause him to disconnect, and seeing the process die would be helpful.

richard4339 avatar Jun 09 '14 19:06 richard4339

There isn't currently any built-in way. If you're going to put robut in upstart, don't you want it to run in the foreground anyway? It's my understanding that most modern process management (upstart, runit, etc.) prefers your apps run in the foreground instead of daemonizing. We currently run robut through runit, and it seems to work pretty well.

justinweiss avatar Jun 09 '14 21:06 justinweiss

You wouldn't expand on how you're doing it, would you?

To be honest, we're having less disconnection issues now, either from our VPS being much more stable or HipChat's servers being more stable. But I'd still love to automate it further.

richard4339 avatar Sep 27 '14 15:09 richard4339

Nothing too fancy. How experienced are you with runit?

For the most part, we just have an /etc/sv/robut/run file that runs robut normally.

justinweiss avatar Sep 29 '14 16:09 justinweiss

Honestly, I'm not the best with it. I'm still thinking of the irc days when the daemons had to write out a pid file for cron to look at. I was really of the impression that with the process running in the forefront it wouldn't necessarily work with one of the process managers. I'll have to dig more. It's sounding like it's far easier than I assumed.

On Monday, September 29, 2014, Justin Weiss [email protected] wrote:

Nothing too fancy. How experienced are you with runit?

For the most part, we just have an /etc/sv/robut/run file that runs robut normally.

— Reply to this email directly or view it on GitHub https://github.com/justinweiss/robut/issues/43#issuecomment-57184001.

Richard [email protected]

richard4339 avatar Sep 30 '14 03:09 richard4339

Ah, OK. Yeah, if you’re using a decent process manager, you should just have it run it in the foreground. I just saw a good article about this:

https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/ https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/

And this is a (kind of detailed) intro to runit:

https://rubyists.github.io/2011/05/02/runit-for-ruby-and-everything-else.html https://rubyists.github.io/2011/05/02/runit-for-ruby-and-everything-else.html

I can help answer specific questions, but I’m not good enough to write a complete guide to runit or anything :-)

On Sep 29, 2014, at 8:06 PM, Richard [email protected] wrote:

Honestly, I'm not the best with it. I'm still thinking of the irc days when the daemons had to write out a pid file for cron to look at. I was really of the impression that with the process running in the forefront it wouldn't necessarily work with one of the process managers. I'll have to dig more. It's sounding like it's far easier than I assumed.

On Monday, September 29, 2014, Justin Weiss [email protected] wrote:

Nothing too fancy. How experienced are you with runit?

For the most part, we just have an /etc/sv/robut/run file that runs robut normally.

— Reply to this email directly or view it on GitHub https://github.com/justinweiss/robut/issues/43#issuecomment-57184001.

Richard [email protected] — Reply to this email directly or view it on GitHub https://github.com/justinweiss/robut/issues/43#issuecomment-57261537.

justinweiss avatar Sep 30 '14 21:09 justinweiss

(old issue) but we've found success dockerizing our Robut bot and publishing to a Kubernetes cluster. Our Dockerfile looks like this


# Suppress apt-get warnings
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux

# Install VIM. Because you know. Editing a file is useful ..
RUN apt-get update && apt-get install -y --no-install-recommends vim

# Set working directory
ENV APP_HOME /app
WORKDIR /app

# Copy app to container
COPY . ./
RUN bundle install

# Default this image to start as "Site"
CMD ["robut", "Chatfile"]

jamsi avatar Mar 20 '17 22:03 jamsi

Awesome! These days, I’d do the exact same thing.

On Mar 20, 2017, at 3:10 PM, James Martin [email protected] wrote:

(old issue) but we've found success dockerizing our Robut bot and publishing to a Kubernetes cluster. Our Dockerfile looks like this

Suppress apt-get warnings

ENV DEBIAN_FRONTEND noninteractive ENV TERM linux

Install VIM. Because you know. Editing a file is useful as shit.

RUN apt-get update && apt-get install -y --no-install-recommends vim

Set working directory

ENV APP_HOME /app WORKDIR /app

Copy app to container

COPY . ./ RUN bundle install

Default this image to start as "Site"

CMD ["robut", "Chatfile"]``` — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justinweiss/robut/issues/43#issuecomment-287913963, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAD_Gpa-Bkv-JgAWWa94CakkisRy1Mpks5rnvlBgaJpZM4CCiV0.

justinweiss avatar Mar 21 '17 04:03 justinweiss