Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Fork process into background #43

Open
richard4339 opened this issue Jun 9, 2014 · 7 comments
Open

Feature: Fork process into background #43

richard4339 opened this issue Jun 9, 2014 · 7 comments

Comments

@richard4339
Copy link

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.

@justinweiss
Copy link
Owner

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.

@richard4339
Copy link
Author

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.

@justinweiss
Copy link
Owner

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.

@richard4339
Copy link
Author

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 notifications@github.com
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
#43 (comment).

Richard
richard@mozor.net

@justinweiss
Copy link
Owner

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 notifications@github.com 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 notifications@github.com
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
#43 (comment).

Richard
richard@mozor.net

Reply to this email directly or view it on GitHub #43 (comment).

@jamsi
Copy link

jamsi commented Mar 20, 2017

(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"]

@justinweiss
Copy link
Owner

justinweiss commented Mar 21, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants