unicorn

Stream console output through HTTP (with Ruby)

走远了吗. 提交于 2019-11-30 00:37:51
I am trying to run some commands remotely and SSH'ing in to the machine is not an option. What I am trying to do is setup a Sinatra app that runs some specific commands and streams the output through HTTP. The sample action looks like this: get "/log" do `tail -f some.log` end 1 As far as I've read, I need to use Unicorn (or Mongrel) because Thin does not support streaming data 2 I think I need to pipe the commands output through some kind of IO ruby object I almost know how to do (1) but have no idea how to achieve (2). If you're on a synchronous server (i.e. Mongrel, Unicorn, not Thin), you

bundler incorrectly trying to install “development” and “test” group gems in production

折月煮酒 提交于 2019-11-29 21:00:18
I have a small web app, which uses a bunch of gems. Some of them are only used for test and development environments. Now, when I try to start unicorn on the production server using the following command, it fails. unicorn_rails -E production -D -c config/unicorn.rb The error I see in the log files is: Refreshing Gem list Could not find gem 'spork (>= 0.9.0.rc2, runtime)' in any of the gem sources listed in your Gemfile. Try running `bundle install`. I've pasted my gemfile below: source 'http://rubygems.org' gem 'rails', '3.0.1' gem 'unicorn' gem 'mongoid', '>= 2.0.0.beta.19' gem 'devise' gem

Puma Cluster configuration on Heroku

巧了我就是萌 提交于 2019-11-29 20:30:33
I need some help with my configuration of Puma (Multi-Thread+Multi-Core Server) on my RoR4 Heroku app. The Heroku docs on that are not quite up-to-date. I followed this one: Concurrency and Database Connections for the configuration, which does not mention the configuration for a Cluster, so I had to use both types together (threaded and multicore). My current configuration: ./Procfile web: bundle exec puma -p $PORT -C config/puma.rb ./config/puma.rb environment production threads 0,16 workers 4 preload_app! on_worker_boot do ActiveRecord::Base.connection_pool.disconnect! ActiveSupport.on_load

Why does Unicorn need to be deployed together with Nginx?

烂漫一生 提交于 2019-11-29 19:01:19
I would like to know the difference between Nginx and Unicorn. As far as I understand, Nginx is a web server while Unicorn is a Ruby HTTP server. Since both Nginx and Unicorn can handle HTTP requests, what is the need to use the combination of Nginx and Unicorn for RoR applications? Pratik Nginx Unicorn Refer to unicorn on github for more information. Nginx is a pure web server that's intended for serving up static content and/or redirecting the request to another socket to handle the request. Unicorn is a Rack web server and only intended to host a 'Rack App' which is usually generating

rails unicorn install error with kgio 2.8.0

放肆的年华 提交于 2019-11-29 17:32:30
i am trying to add unicorn to one of my rails apps on heroku - i've added the unicorn config file and the unicorm gem to the gemfile but when i try to bundle install on my windows dev machine i get: An error occurred while installing kgio (2.8.0), and Bundler cannot continue. i tried 'gem install kgio -v "2.8.0' and get similar errors. i am running ruby 1.9.3p125. One of the posts said something about it only running in a Unix [nonwindows] environment. i guess i really only need it running on heroku on my production system. any suggestions? 来源: https://stackoverflow.com/questions/17388631

How to start rails server in production mode using unicorn and config file?

。_饼干妹妹 提交于 2019-11-29 16:43:34
问题 I add Gem 'unicorn' to Gemfile and call rails server unicorn -e production , but I get a load error. Then I add Gem 'unicorn_rails' , then call rails server unicorn -e production , but I can't find the socket file. So I am considering if it doesn't use the config/unicorn.rb file as the configuration? So I call unicorn_rails -c config/unicorn.rb -E production -D , but I get another error text file busy . So now I am stuck in this matter, could you help me? :) 回答1: It should be something looks

Re-source .bashrc when restarting unicorn?

夙愿已清 提交于 2019-11-29 12:45:13
I have some ENV variables that are sourced for the deploy user. (Similar to what Heroku recommends , but without using Heroku.) My rails app depends on these for certain functions, for example, in application.rb: config.action_mailer.default_url_options = { host: ENV['MY_HOST'] } This is necessary because we have several staging hosts. Each host has MY_HOST defined to its correct hostname in .bashrc like so: export MY_HOST="staging3.example.com" This allows us to only use one rails staging environment, but still have each host's correct hostname used for testing, sending email, etc since this

`<module:Templates>': uninitialized constant Tilt::CompileSite (NameError) using Sinatra / Unicorn

混江龙づ霸主 提交于 2019-11-29 11:38:21
I'm new in the Ruby world. I created my first app using Sinatra, and I'm having some trouble on my production server. When I run unicorn -c randmovie_unicorn.rb on my local machine, it works just fine. But in production, I get this error: <module:Templates>': uninitialized constant Tilt::CompileSite (NameError) In my randmovie_unicorn.rb file: preload_app true working_directory "./" listen 8006 worker_processes 2 timeout 30 I'm not using HAML or anything similar. Could somebody help me with that? Thanks! I think it's a bug in tilt 2.0.0 or in sinatra. Specify tilt version in your Gemfile: gem

Unicorn fails to start on Vagrant box due to Errno::EPERM

点点圈 提交于 2019-11-29 09:33:29
问题 When I run the following command to start Unicorn for a Sinatra app on my Vagrant box(ubuntu-12.04.2-server-i386) sudo unicorn -c unicorn.rb -E development -D -l 0.0.0.0:8080 I get the following error in the Unicorn logs. I, [2013-05-05T19:15:15.538805 #2357] INFO -- : listening on addr=0.0.0.0:8080 fd=5 F, [2013-05-05T19:15:15.541673 #2357] FATAL -- : error adding listener addr=/home/vagrant/tmp/myapp/sockets/unicorn.sock /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems

Unicorn triggers mongoid error during assets precompile

邮差的信 提交于 2019-11-29 06:20:53
I have a rails app using Mongoid 3 running on Heroku. I've just updated it to use Unicorn. When I try to deploy it to Heroku I get the following error : Running: rake assets:precompile rake aborted! undefined method `match' for nil:NilClass /tmp/build_3nnbzpfmnjpns/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.21/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize' The full stacktrace can be found at http://pastebin.com/8YcJHEmS But if I remove Unicorn from my Gemfile, the assets compilation succeeds. Looking into the Mongoid code, I can see that the error happens when the mongoid.yml file is