Tag: 独角兽

服务器Ruby on Rails + unicorn + nginx停止响应

我的服务器Rails工作正常,但在没有请求的10分钟后,它的响应是一个糟糕的网关。 我真的认为我的配置是有序的,但它不起作用。 我没有更多的想法发生了什么。 我的配置: unicorn.rb: @dir = File.expand_path(File.dirname(__FILE__)) + “/..” worker_processes 2 working_directory @dir timeout 10 listen File.join(‘/tmp/nutrimais.sock’) listen File.join(‘/tmp/nutrimais_2.sock’) preload_app true# if ENV[‘RAILS_ENV’] != ‘development’ GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true check_client_connection false before_fork do |server, worker| Signal.trap ‘TERM’ do puts ‘Unicorn master intercepting TERM and sending myself QUIT instead’ Process.kill ‘QUIT’, Process.pid end defined?(ActiveRecord::Base) […]

如何让unicorn在路径下运行Rails 3.0应用程序?

我正在从Passenger迁移到Unicorn,而使用Passenger,我曾经使用RailsBaseURI选项运行我的Rails 3.0应用程序,例如使用’/ blah’为所有URL添加前缀。 在Unicorn下运行相同的应用程序时,我将’–path / blah’传递给unicorn_rails,但服务器仍然提供http:// server:3000 / etc / etc ,而不是http:// server:3000 / blah / etc / etc – 我看到一些资产是通过/ blah /请求的(比如JS文件,等等),但各种链接在它们之前仍然没有’/ blah /’。 所以 – 总结一下 – 如何让Unicorn在/ blah下安装我的应用程序,以便所有请求都以’/ blah’为前缀,并且所有链接和资产都是以’/ blah /’为前缀创建的? 谢谢

AWS框上的Unicorn工作人员超时

我正在尝试在AWS盒子上设置一个Unicorn,但是工作人员只是保持计时,我不知道为什么。 我正在使用Ubuntu Server 14.04 LTS AMI,安装标准Ruby on Rails安装所需的一切。 使用rails new,我生成一个空的应用程序,第一次尝试访问它似乎很快,但在此之后,工作人员只是持续超时并永远服务于网页。 加载标准WEBrick服务器没有这个问题,几乎立即加载页面。 我试过回滚几个版本的ruby和独角兽没有运气。 VM中本地不会发生此行为。 以下是在调试模式下运行的服务器的日志 我,[2014-11-04T18:30:13.290599#17134]信息 – :收听addr = 0.0.0.0:5000 fd = 10 I,[2014-11-04T18:30:13.362993#17134]信息 – :主过程就绪 I,[2014-11-04T18:30:13.363098#17137] INFO – :worker = 0 ready I,[2014-11-04T18:30:13.365175#17140] INFO – :worker = 1 ready I,[2014-11-04T18:30:13.365314#17142] INFO – :worker = 2 ready /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443中的exception’LoadError’ – 无法加载此类文件 – rails / application_helper.rb /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352中的exception’LoadError’ – […]

Unicorn Rails – 在生产模式下启动时占用100%的CPU

我们正在使用Unicorn_Rails + nginx。 它在我的系统中的开发模式和生产模式下运行良好(4GB Ram,Intel(R)Core(TM)2 Duo CPU P8600 @ 2.40GHz)我可以在本地系统中启动10个工作人员但是无法启动超过2个生产中的任何情况有时它都可以工作,但需要等待15-20 mts启动unicorn_rails时始终需要99.6%的CPU 英特尔(R)Xeon(R)CPU E5507 @ 2.27GHz,但它挂在亚马逊(m1.small实例)1.73 GB RAM 我发现没有人谈论在任何地方使用unicorn_rails的慢启动…

独角兽与Ruby 2.4.1引起奇怪的崩溃

我正在从Ruby 2.3.1升级到Ruby 2.4.1,因此Unicorn似乎与新版本不兼容。 我得到以下错误。 我正在使用Unicorn 5.1.0并尝试使用Unicorn 5.3.1无济于事。 我是否需要使用不同的lib而不是XCode Tools进行编译? 在使用foreman start和Procfile foreman start服务器时,我立即收到错误: 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 config/unicorn.rb 如果我使用简单的bin/rails s似乎开始并运行良好,我为什么我认为它是特定于Unicorn。 objc[40847]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. objc[40846]: +[__NSPlaceholderDictionary initialize] […]

sidekiq不处理工作,工作陷入队列

我有一个简单的应用程序,与twitter流api,sidekiq,独角兽和sinatra一起使用。 一切顺利,而不是……工作根本没有得到处理。 他们陷入了排队(我知道来自sidekiq网页用户界面)。 这是我的代码: Procfile: sidekiq: bundle exec sidekiq -C config/sidekiq.yml -e development -r ./lib/tweet_streamer.rb unicorn: bundle exec unicorn -c config/unicorn.rb redis: redis-stable/src/redis-server 配置/ unicorn.rb: listen 5000, :tcp_nopush => true timeout 30 preload_app true GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_fork do |server, worker| end after_fork do |server, worker| end tweet_streamer.rb: require_relative “../config/tweetstream” require_relative “workers” class […]

在OSX Startup上启动独角兽

我目前正在osx lion下使用rvm和unicorn进行服务器管理。 我也使用gemset。 所以为了启动我的服务器我做以下事情: cd /xyz/project unicorn -c /xyz/project/config/unicorn.rb -E production 现在我希望这台服务器在我的电脑启动时启动。 我读了一些关于将一个plist文件添加到~/Library/LaunchAgents/并使用launchctl激活它的launchctl但我不知道在这个plist文件中写什么来启动我的服务器。 有任何想法吗? 我认为这很困难,因为gem需要通过cd进入这个目录来激活。 谢谢你的帮助。

我如何告诉独角兽了解Heroku的信号?

也许你已经看到了…… 2012-03-07T15:36:25 + 00:00 heroku [web.1]:使用SIGTERM停止进程 2012-03-07T15:36:36 + 00:00 heroku [web.1]:使用SIGKILL停止进程 2012-03-07T15:36:36 + 00:00 heroku [web.1]:错误R12(退出超时) – >进程无法在SIGTERM的10秒内退出 2012-03-07T15:36:38 + 00:00 heroku [web.1]:进程退出状态为137 在heroku上运行独角兽时,这是一个众所周知的问题… heroku使用SIGTERM进行正常关闭 unicorn使用SIGTERM进行快速关机 我可以告诉heroku发送SIGQUIT吗? 或者我可以告诉独角兽将SIGTERM视为优雅关闭吗?

当我进行捆绑安装时,我收到了kgio gem的gem安装错误

我在我的Gemfile中添加了独角兽,之后当我进行捆绑安装时,我收到了这个错误 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 options: –with-opt-dir –with-opt-include –without-opt-include=${opt-dir}/include –with-opt-lib –without-opt-lib=${opt-dir}/lib […]

Unicorn Memory Usage几乎填满了所有RAM

这里基本上有3个问题: 1)Unicorn似乎正在稳步填满所有RAM,导致我手动删除工人。 2)Unicorn似乎因某种原因产生了额外的工人,尽管我已经指定了固定数量的工人(其中7人)。 这部分导致RAM累积,这也导致我手动删除工作人员。 3)在我的情况下,零停机部署是不可靠的。 有时它会接收更改,有时我会获得网关超时。 每次部署都会变得非常紧张。 我真的不喜欢使用Monit,因为它可以杀死工人而无需等待工人完成他们的请求。 那么,这是正常的吗? 使用Unicorn部署的其他人是否有同样的问题,RAM只会无法控制地增长? 而且,工人产生的工人数量与工人数量不一致? 另一种选择是独角兽工人杀手,我会在读完Unicorn Eating Memory后尝试。 微小的更新: 因此,New Relic告诉我内存几乎达到了95%。 所以我不得不杀死一名工人。 有趣的是,杀死那个工人会使记忆大量减少,如下图所示。 那是怎么回事? 作为参考,这是我的unicorn.rb和unicorn_init.sh 。 希望有人告诉我某处有错误。 unicorn.rb root = “/home/deployer/apps/myapp/current” working_directory root pid “#{root}/tmp/pids/unicorn.pid” stderr_path “#{root}/log/unicorn.stderr.log” stdout_path “#{root}/log/unicorn.log” listen “/tmp/unicorn.myapp.sock” worker_processes 7 timeout 30 preload_app true before_exec do |_| ENV[“BUNDLE_GEMFILE”] = ‘/home/deployer/apps/myapp/current/Gemfile’ end before_fork do |server, worker| # […]