unicorn

nginx strips last-modified and if-modified-since headers but my rails app needs them

本秂侑毒 提交于 2020-01-15 09:34:08
问题 My Rails 3.2 app uses — via #stale? — If-Modified-Since HTTP header in the request and Last-Modified header in the response to decide whether it should generate some data dynamically. This works extremely well in development (whether using webrick or unicorn_rails) as curl -D headers.txt shows that if the correct If-Modified-Since value is provided a 304 response is sent, while the Last-Modified header is otherwise sent along the request data. Unfortunately once deployed behind nginx, neither

how to make rails+unicorn logger thread safe?

走远了吗. 提交于 2020-01-13 19:12:27
问题 We've been using unicorn to deploy our application. Everything went fine except for the production.log file, which turned out to be unreadable because the way unicorn was designed. Every instance of unicorn wrote to the same file, causing all the lines spaghetti'ed together. So is there a way to tell the logger to log independently across multiple unicorn instances? 回答1: edit your unicorn.conf.rb , and change the after_fork block to something like: after_fork do |server, worker| filepath = "#

What's wrong with my rackup file?

≯℡__Kan透↙ 提交于 2020-01-13 09:47:10
问题 When i attempt to start my unicorn server I've got the next stack trace: Can't understand what's wrong with rackup file? Why it is not readable? sites@bck:~/fatfreecrm$ /home/sites/.rvm/gems/ruby-1.9.2-p180@fatfreecrm/bin/unicorn_rails -E -D production -c /home/sites/fatfreecrm/config/unicorn.rb /home/sites/.rvm/gems/ruby-1.9.2-p180@fatfreecrm/gems/unicorn-3.7.0/lib/unicorn/configurator.rb:600:in `parse_rackup_file': rackup file (production) not readable (ArgumentError) from /home/sites/.rvm

Unicorn do not close DB connections

人走茶凉 提交于 2020-01-13 00:52:08
问题 I am using rails 3.2 + unicorn + postgres DB and i have a question - how does unicorn handle DB connections ? How I understand: unicorn master process forks X child process. each child process setup DB connection– close in before_fork, establish connection in after_fork. we use connection per process(if we use rails DB connection pooling, we create Y(from database.yml) DB connections per process) - i.e. If process is working(It always works until we not kill it) we keep connection opened and

How can I tell unicorn to understand Heroku's signals?

ぃ、小莉子 提交于 2020-01-12 07:26:07
问题 Perhaps you've seen this... 2012-03-07T15:36:25+00:00 heroku[web.1]: Stopping process with SIGTERM 2012-03-07T15:36:36+00:00 heroku[web.1]: Stopping process with SIGKILL 2012-03-07T15:36:36+00:00 heroku[web.1]: Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM 2012-03-07T15:36:38+00:00 heroku[web.1]: Process exited with status 137 This is a well known problem when running unicorn on heroku... heroku uses SIGTERM for graceful shutdown unicorn uses SIGTERM for

How is rails session shared among unicorn workers?

元气小坏坏 提交于 2020-01-06 03:41:31
问题 I am using unicorn as rails server, I have configured five workers for it. I was not sure if this would affect user session, so I did a little experiment: puts "------" puts session[:session_id] puts "session obj: #{session.hash}" puts "pid: #{Process.pid}" This is the result ------ 69db720b6620288416ae4ba6f921dfb8 session obj: -4054823339922854099 pid: 4396 ------ 69db720b6620288416ae4ba6f921dfb8 session obj: 4220002746750993661 pid: 4527 ------ 69db720b6620288416ae4ba6f921dfb8 session obj:

Rails Deployment with Nginx and Unicorn giving 504 gateway timeout error

此生再无相见时 提交于 2020-01-06 01:58:13
问题 My Nginx server is not running properly on VPS i did all the settings correctly, According to rails cast VPS Deployment still I am getting the error 504 Gateway timeout error Nginx Log request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in" 2014/07/26 11:33:58 [error] 6935#0: *10 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080

Unicorns eat up MySQL connections not respecting the pool size - Rails

荒凉一梦 提交于 2020-01-05 02:57:37
问题 I run 4 Unicorn processes for my Rails app and they eat up all the available MySQL connections causing it to collapse with 'too many connections' error. Today I had to reboot my DB instance 4 times. =( Processes $ ps ax | grep [u]ni 21618 ? Sl 0:15 unicorn master -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21632 ? Sl 0:20 unicorn worker[0] -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21636 ? Sl 0:14 unicorn worker[1] -D -c /home/deployer/apps

Thin server QUERY_STRING is longer than the (1024 * 10) allowed length

帅比萌擦擦* 提交于 2020-01-04 05:25:25
问题 How can I increase the maximum allowed value for QUERY_STRING using either thin , puma , or unicorn web servers in Rails? I'm attempting to make a POST request to my Rails API that exceeds the limit, and just need to increase the server's maximum threshold Specific error on POST: Invalid request: HTTP element QUERY_STRING is longer than the (1024 * 10) allowed length. I only came across this question in one other place (HTTP query string length with thin web server) and I couldn't quite make

rails environment mongoid connection issue

梦想的初衷 提交于 2020-01-02 06:28:31
问题 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