Comments (16)
@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.
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.
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.
Rails quick walkthrough: http://code.dblock.org/2015/11/28/writing-a-slack-bot-running-on-rails-with-react.html
from slack-ruby-bot.
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.
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.
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.
Will do. Found (and fixed) another Passenger issue so I'll document that too.
from slack-ruby-bot.
👍
from slack-ruby-bot.
@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.
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.
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.
I'll set up an example with deployment instructions for passenger + apache/nginx
from slack-ruby-bot.
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.
@boncey care to contribute some docs?
from slack-ruby-bot.
Closing via #214
from slack-ruby-bot.
Related Issues (20)
- Getting lots of 429 rate limit errors on https://slack.com/api/rtm.start calls HOT 7
- Graceful shutdown HOT 1
- Testing other code execution inside a command HOT 8
- Deployment tutorial needs update HOT 2
- DMing self produces Sorry @Slackbot, I don't understand that command! HOT 1
- Migration to non-legacy bots HOT 6
- Consider splitting RSpec shared behaviours and development dependencies HOT 4
- Where can i find more info on the client.say method? HOT 7
- Remove support for Giphy
- Extract attachments text
- without mention in channel bot can't reply HOT 1
- Upload a file? HOT 1
- Pongbot does not run on linux mint 19 HOT 4
- Testing for two outputs from a command HOT 5
- When a command is posted in thread, its again posted as direct message automatically HOT 4
- is there an example for how to implement a conversational bot using slack-ruby-bot? HOT 1
- Missing concurrency - Add faye-websocket to your gemfile -- It's already in my Gemfile HOT 1
- Clarification of MIGRATION.md HOT 8
- Is this repo really legacy, there is still a use case? HOT 3
- Repeated 429 (ratelimited) errors from slack HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-ruby-bot.