Code Monkey home page Code Monkey logo

Comments (16)

cybercrediators avatar cybercrediators commented on May 24, 2024 1

@boncey PassengerSpawnMethod smart won't work without PassengerPreStart. Tested it with nginx, apache and ruby 2.6.0/2.5.3.

from slack-ruby-bot.

awh-tokyo avatar awh-tokyo commented on May 24, 2024

Is there anything special that I'm supposed to do to make it work with Passenger? It works fine in my dev environment but won't stay signed on for more than 5 minutes in Passenger.

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

Do you have any more info, code to share? Where do you run this with Passenger and how is it started?

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

Rails quick walkthrough: http://code.dblock.org/2015/11/28/writing-a-slack-bot-running-on-rails-with-react.html

from slack-ruby-bot.

awh-tokyo avatar awh-tokyo commented on May 24, 2024

Basically I did the "Rails quick walkthrough" as you wrote in this commit: dblock/slack-bot-on-rails@a93877a Really nothing more fancy than that, my bot replies to only one command and I haven't even started on other stuff I need to make it do. Works beautifully in development (even reconnects after I wake my laptop up from sleep) but in production dies after a few minutes.

I'm using self-hosted Passenger with Apache. I'm thinking that maybe the non-commercial version doesn't want threads to run continually? I disabled the "Idle Pool Timeout", but that didn't help.

It's the only application running on the server; at this point I'm so frustrated that I might just throw out Passenger and use some other way to run the app.

from slack-ruby-bot.

awh-tokyo avatar awh-tokyo commented on May 24, 2024

Sorry to answer my own question, but I thought I'd put down the solution to help anybody else who's trying to get this working with Passenger.

Basically, by default, the thread will run in the preloader process, which automatically gets killed if you haven't forked a new process in 5 minutes.

To keep the preloader process running, set PassengerMaxPreloaderIdleTime to 0.

You can also arrange for the thread to run in the child process, but you'd probably have to make sure that only one child process runs the thread, even if more than one is forked. And you'd also have to make sure that child process didn't get killed off (by default they also get killed off after 5 minutes unless it's the only child process).

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

I am not familiar with Passenger, where is all this set? Would you be so kind to contribute a pull request into maybe https://github.com/dblock/slack-ruby-bot/blob/master/DEPLOYMENT.md or another piece of documentation explaining what one has to do with Passenger? Thx.

from slack-ruby-bot.

awh-tokyo avatar awh-tokyo commented on May 24, 2024

Will do. Found (and fixed) another Passenger issue so I'll document that too.

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

👍

from slack-ruby-bot.

iambanklee avatar iambanklee commented on May 24, 2024

@awh-tokyo I had the same issue with Passenger and setting PassengerMaxPreloaderIdleTime to 0 just made it easier - also curious what's the another issue with Passenger?

from slack-ruby-bot.

cybercrediators avatar cybercrediators commented on May 24, 2024

I know this issue is about 2 years old, but since there is no tutorial, maybe some people still want to know wether it's possible to deploy their bot to a self-hosted production environment(?) without rails.

Just change puma to passenger in your Gemfile and change the Procfile accordingly to web: bundle exec passenger start. Deploying the bot is now pretty much the walkthrough on the passenger homepage, but you have to add the following (empty) folders to your project public/, tmp/, log/. Furthermore you have to set the passenger_max_preloader_idle_time 0; mentioned above, the passenger_pre_start option, because otherwise you have to request the page first in order to start the bot process and at least on one deployment I had to set passenger_startup_file + type. To maintain the bot, there are logs in your nginx error.log, or you can check passenger-status --verbose for more information about requests etc.

server {
  listen 80;
  server_name example.com;
  root /var/www/bot/public;
  passenger_enabled on;
  passenger_max_preloader_idle_time 0;
  passenger_startup_file config.ru;
  passenger_app_type rack;
}

passenger_pre_start http://example.com:80/;

All in all, it works pretty good and it's easy to deploy it, but as I said earlier, maybe some people want to know an out of the box instruction for it, because there is still only the heroku tutorial available.

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

Would love it if someone PRed a working example into https://github.com/slack-ruby/slack-ruby-bot/tree/master/examples

from slack-ruby-bot.

cybercrediators avatar cybercrediators commented on May 24, 2024

I'll set up an example with deployment instructions for passenger + apache/nginx

from slack-ruby-bot.

boncey avatar boncey commented on May 24, 2024

I had this problem also for a Sinatra app and the settings here fixed it for me.
I added them to my Apache config.

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

@boncey care to contribute some docs?

from slack-ruby-bot.

dblock avatar dblock commented on May 24, 2024

Closing via #214

from slack-ruby-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.