unicorn

How to configure nginx + Unicorn to avoid timeout errors?

心已入冬 提交于 2019-12-06 01:29:48
问题 I have a Rails (v3.2.13, Ruby 2.0.0) application running on nginx + Unicorn (Ubuntu 12.04). All is working well, except when an admin user is uploading users (thousands) via a CVS file. The problem is that I have set timeout to 30 seconds and the import process takes much more time. So, after 30 seconds I get an nginx 502 Bad Gateway page (Unicorn worker is killed). The obvious solution is to increase timeout, but I don't want this because it'll cause another problems (I guess), because it's

Upload with paperclip very slow (unicorn)

本秂侑毒 提交于 2019-12-05 15:27:19
Sitting here with a simple rails 3 app in which I have a simple Gallery model and each gallery has many images. The image model is extended with paperclip and with the following options has_attached_file :local, :styles => { :large => "800x800>", :medium => "300x300>", :thumb => "100x100#", :small => "60x60#" } In my galleries_controller I have the following action that is implemented in order to work with the jQuery-File-Upload plugin. thereby the json response. def add_image gallery = Gallery.find params[:id] image = gallery.images.new({:local => params[:local]}) if image.save render :json =

rails environment mongoid connection issue

ぐ巨炮叔叔 提交于 2019-12-05 13:18:18
I have rails app 3.2.17, deployed in staging environment with unicorn 4.6.3 monitored by bluepill 0.0.66 using mongid 3.1.5 When I deploy for staging environment all works find including active_record except mongoid queries with result with following error: Error during failsafe response: Problem: No configuration could be found for a session named 'default'. Summary: When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect. Resolution: Double check your

Cannot run Unicorn with Ruby 2.0

旧城冷巷雨未停 提交于 2019-12-05 13:13:06
On my ubuntu machine, I can run unicorn on ruby 1.9.3, however, it does not seem to work with ruby 2.0. Any idea why? root@dev:/home/karan# rvm use 1.9 Using /usr/local/rvm/gems/ruby-1.9.3-p429 root@dev:/home/karan# unicorn -v unicorn v4.6.3 root@dev:/home/karan# rvm use 2.0 Using /usr/local/rvm/gems/ruby-2.0.0-p195 root@dev:/home/karan# unicorn -v /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- unicorn/launcher (LoadError) from /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems

Websocket-rails doesn't work on production evironment with Nginx and Unicorn

落花浮王杯 提交于 2019-12-05 08:06:23
I have Rails 3.2 application with gem websocket-rails 0.7. On development machine, all work fine On production enviroment, I use Nginx/1.6 as proxy server and Unicorn as http server. Thin is used on standalone mode (following https://github.com/websocket-rails/websocket-rails/wiki/Standalone-Server-Mode ). nginx config: location /websocket { proxy_pass http://localhost:3001/websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } On backend side, I have the following code for send notification to clients WebsocketRails[:callback

Unicorn with Ruby 2.4.1 causing weird crash

喜欢而已 提交于 2019-12-05 06:00:03
I am upgrading from Ruby 2.3.1 to Ruby 2.4.1 and upon doing so Unicorn seems be incompatible with the new version. I get the errors below. I am using Unicorn 5.1.0 and have tried Unicorn 5.3.1 to no avail. Do I need to compile with a different lib instead of XCode Tools? I get the error immediately upon starting the server with foreman start and the Procfile: webpack: bin/webpack-dev-server gulp: gulp redis: ./scripts/start_redis_server.sh sidekiq: bundle exec sidekiq -C config/sidekiq.yml annotations_server: ./scripts/start_annotation_server.sh rails: bundle exec unicorn_rails -p 3000 -c

SSH and -bash: fork: Cannot allocate memory VPS Ubuntu

為{幸葍}努か 提交于 2019-12-05 05:31:10
I am hosting my Rails app on Ubuntu 12.04 VPS, Nginx + Unicorn, after deployment everything is fine, but few hours later, when I ssh to the VPS I get this message -bash: fork: Cannot allocate memory -bash: wait_for: No record of process 4201 -bash: wait_for: No record of process 4201 If I run any command, it would just return -bash: fork: Cannot allocate memory. Seems you have run out of memory. Many VPS servers are setup with no swap, so when you run out of memory, it will kill things off in a seemingly random manner. The easiest way to fix it is to get more memory provisioned to your VPS,

Rufus scheduler running multiple times with unicorn, fixed with :lockfile, but how to eliminate the error msg?

 ̄綄美尐妖づ 提交于 2019-12-05 02:26:09
scheduler = Rufus::Scheduler.new :lockfile => ".rufus-scheduler.lock" scheduler.every("60") do ... end Environment: Ubuntu, rails 4, rufus, unicorn, nginx Unicorn has multiple workers, so the above 'every' task will be executed multiple times every 60 seconds. According to the answer for this one: rufus scheduler running twice each time , I added :lockfile option, and it works! However, from the log, it seems that the 'every' task still tries to be called, resulting in a lot of error messages: E, [2014-05-09T01:59:47.496840 #2747] ERROR -- : cannot schedule, scheduler is down or shutting down

Unicorn vs Passenger Standalone behind nginx [closed]

拟墨画扇 提交于 2019-12-05 01:35:16
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm trying to decide between Unicorn and Phusion Passenger Standalone (formerly Phusion Passenger Lite). I want to host multiple apps on my server. I have nginx running and listening to port 80. I need a webapp server that I can proxy

I am getting this gem install error for kgio gem when i do a bundle install

◇◆丶佛笑我妖孽 提交于 2019-12-05 00:37:07
问题 I added unicorn to my Gemfile and after that when i do a bundle install I get this error em::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb checking for CLOCK_MONOTONIC in time.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration