sidekiq doesn't pick up the configuration file in the default location - ruby-on-rails

Sidekiq failed to start with default configuration file in config/sidekiq.yml.
---
:pidfile: tmp/pids/sidekiq.pid
:logfile: log/sidekiq.log
While running the bundle exec sidekiq -d in a rails application root, it reports error:
You really should set a logfile if you're going to daemonize.
/home/canoe/.rvm/gems/ruby-2.0.0-p353#rails4/gems/sidekiq-2.17.2/lib/sidekiq/cli.rb:141:in `daemonize'
/home/canoe/.rvm/gems/ruby-2.0.0-p353#rails4/gems/sidekiq-2.17.2/lib/sidekiq/cli.rb:39:in `parse'
/home/canoe/.rvm/gems/ruby-2.0.0-p353#rails4/gems/sidekiq-2.17.2/bin/sidekiq:7:in `<top (required)>'
/home/canoe/.rvm/gems/ruby-2.0.0-p353#rails4/bin/sidekiq:23:in `load'
/home/canoe/.rvm/gems/ruby-2.0.0-p353#rails4/bin/sidekiq:23:in `<main>'
However, this should work according to the wiki since the config file is in the default path.
What's wrong here?

Ok. this was a bug in 2.17.2 , use 2.17.7 version. That's all.

Related

How to set puma to start on server start/reboot with capistrano?

I was going through puma upstart script and I tried to set it up on my server. But, after some trial and error I realized that I shouldn't be doing this manually and my deployment script i.e. capistrano should be doing this for me.
I google this but I could not much other than 2 lines on capistrano-puma:
For Jungle tasks (beta), these options exist:
set :puma_jungle_conf, '/etc/puma.conf'
set :puma_run_path, '/usr/local/bin/run-puma'
I am not sure how to use this and make capistrano do this rather than me manually doing it.
Work done so far:
I followed this blog- Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma and it works like a charm, except that I have to remember to run cap production puma:restart if I restart the server (or the puma process dies and I get cloudwatch alarms).
Following the official docs, I made a config file /etc/puma.conf:
/home/deploy/apps/<app_name>/current
but it is unable to find puma.rb- Naturally, as puma.rb is in
<app_name>/shared/puma.rb
and not in
<app_name>/current/config/puma.rb
The actual error I get in the logs:
/home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/dsl.rb:26:in `read': No such file or directory # rb_sysopen - config/puma.rb (Errno::ENOENT)
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/dsl.rb:26:in `_load_from'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/dsl.rb:9:in `load'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/configuration.rb:204:in `block in load'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/configuration.rb:201:in `each'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/configuration.rb:201:in `load'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/launcher.rb:62:in `initialize'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/cli.rb:65:in `new'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/lib/puma/cli.rb:65:in `initialize'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/bin/puma:8:in `new'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/gems/puma-3.4.0/bin/puma:8:in `<top (required)>'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/bin/puma:23:in `load'
from /home/deploy/apps/voggle/shared/bundle/ruby/2.2.0/bin/puma:23:in `<main>'

Error while running unicorn for Ruby on Rails

I am trying to run a Ruby on Rails app with nginx and unicorn. After setting up the unicorn configuration file 'unicorn.rb' when I try and execute this command
bundle exec unicorn -c config/unicorn.rb -D
It throws the following error:
/home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/configurator.rb:537:in `working_directory': config_file=config/unicorn.rb would not be accessible in working_directory=/home/vagrant/home (ArgumentError)
from config/unicorn.rb:3:in `reload'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/configurator.rb:72:in `instance_eval'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/configurator.rb:72:in `reload'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/configurator.rb:65:in `initialize'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/http_server.rb:76:in `new'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/lib/unicorn/http_server.rb:76:in `initialize'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/bin/unicorn:126:in `new'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/unicorn-5.0.0/bin/unicorn:126:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.2.1/bin/unicorn:23:in `load'
from /home/vagrant/.rvm/gems/ruby-2.2.1/bin/unicorn:23:in `<main>'
from /home/vagrant/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
from /home/vagrant/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
master failed to start, check stderr log for details
I am running inside an ubuntu-vagrant setup and my app is in the following directory:
/home/vagrant/home/my-app
And the configuration file(unicorn.rb) is in the following directory:
/home/vagrant/home/my-app/config
And the file(unicorn.rb) contains the following configurations:
working_directory "/home/vagrant/home/"
pid "/home/vagrant/home/temp/pids/unicorn.pid"
stderr_path "/home/vagrant/home/log/unicorn.log"
stdout_path "/home/vagrant/home/log/unicorn.log"
listen "/tmp/unicorn.expertiza.sock"
worker_processes 2
timeout 30
I dont understand where I am going wrong. Even the error statement doesnt make much sense. Can someone provide some assistance.

500 Internal Server Error with Rails Production

I recently uploaded some new files to my production server (and overriding the old ones) and am now getting 500 Internal Server Error. The server is running phusion passenger (even though I am not getting that error message anymore) and in my local test environment everything seems to be working fine.
Here is the site: http://www.pandonews.com/
When I looked in my apache log i see this error:
[ pid=3106 thr=140057117177664 file=ext/apache2/Hooks.cpp:884 time=2013-09-01 17:37:24.84 ]: Unexpected error in mod_passenger: Cannot spawn application '/var/www/feedme': The spawn server died unexpectedly, and restarting it failed.
Backtrace:
in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:742)
in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:312)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:585)
I have no idea what the problem is. It has been running fine up until now. I don't really know where to start in order to fix this. I tried running gem passenger install again but nothing happened.
Recent activities:
Installed pg gem (but removed it from gem file after deciding to stay with sqlite3 for now) the yml file should be ok...
Tried running bundle update on server and locally but it keeps hanging
Changed some javascript and css files...
Tried resetting the server with RAILS_ENV=production rake:db reset - no change!
EDIT:
when running rails s production i get the following error:
/home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- rack/handler/production (LoadError)
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `block in require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/handler.rb:63:in `try_require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/handler.rb:16:in `get'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/server.rb:272:in `server'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands/server.rb:59:in `start'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
EDIT2:
$ passenger-status
ERROR: Phusion Passenger doesn't seem to be running.
EDIT3:
Seems like it is running, still internal server error:
passenger start -a 0.0.0.0 -p 3000 -d -e production
=============== Phusion Passenger Standalone web server started ===============
PID file: /var/www/feedme/tmp/pids/passenger.3000.pid
Log file: /var/www/feedme/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/
Serving in the background as a daemon.
===============================================================================
otto#scraper:/var/www/feedme$ passenger status
Phusion Passenger Standalone is running on PID 18788, according to PID file /var/www/feedme/tmp/pids/passenger.3000.pid
otto#scraper:/var/www/feedme$
Did the following:
gem install passenger (no sudo or anything)
Find root: passenger-config –root
Give chmod to all from root until username folder: sudo chmod -R 777 /home/username/.rvm/gems/ruby-1.9.3-p392/gems/passenger-4.0.14 to every folder until /home/username/
passenger-install-apache2-module (without anything)
Take the code you are given paste it inside: /etc/apache2/httpd.conf
sudo service apache2 restart

Error when trying to run delayed_job in production

I am using delayed_job to send emails, everything works fine under development when starting the process using:
jobs:work
The problem comes on my shared host, under production, when I try and start the process using the "delayed_job" script (as detailed here)
script/delayed_job start staging
gives me the following error
/home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:237:in `require': no such file to load -- delayed/command (LoadError)
from /home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:237:in `require'
from /home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:636:in `new_constants_in'
from /home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/blog/applications/staging/blog/shared/bundle/ruby/1.8/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:237:in `require'
from script/delayed_job:4
Any ideas on how to resolve this please?
I am using Rails 3.1 on Ruby 1.8.7, with Phusion Passenger.
I would suggest using Capistrano for these kind of things.
Then you could simply put this in your deploy.rb file (or Capfile):
require 'delayed/recipes'
after "deploy:start", "delayed_job:start"
after "deploy:stop", "delayed_job:stop"
after "deploy:restart", "delayed_job:restart"
Certainly made it a lot easier for me =)

Trouble installing Rails App on MediaTemple?

I am having some trouble installing an app on MediaTemple's Grid Servers... I'm deploying with cap and github... everything seems to go ok with those, but the app won't start up. There seems to be a problem with my database.yml file? I've checked for space errors and those all look good.
Here is a copy of the console when I try and start from there:
XXXXXXXXX.com#n11:/home/65633/containers/rails/GDB/current$ script/server RAILS_ENV="production" --trace
** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
server: invalid option: --trace
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
config.gem: Unpacked gem geokit-1.4.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
Exiting
/home/65633/data/rubygems/gems/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/65633/data/rubygems/gems/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:53:in `establish_connection'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:392:in `initialize_database'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:139:in `process'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:112:in `send'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
from /nfs/c04/h03/mnt/65633/containers/rails/GDB/releases/20090830045026/config/environment.rb:15
from /home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
from /home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
... 24 levels...
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/commands/server.rb:49
from /home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
from /home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
from script/server:3
Here is the mongrel log:
** Daemonized, any open files are closed. Look at log/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:2017
** Starting Rails with production environment...
/home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require': /home/65633/containers/rails/GDB/releases/20090830060044/app/controllers/administration_controller.rb:159: syntax error, unexpected kEND, expecting $end (SyntaxError)
from /home/65633/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
from /home/65633/data/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
from /home/65633/data/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:262:in `require_or_load'
from /home/65633/data/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:221:in `depend_on'
from /home/65633/data/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:133:in `require_dependency'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:368:in `load_application_classes'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:367:in `each'
from /home/65633/data/rubygems/gems/gems/rails-2.2.2/lib/initializer.rb:367:in `load_application_classes'
... 17 levels...
from /home/65633/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
from /home/65633/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
from /home/65633/data/rubygems/gems/bin/mongrel_rails:19:in `load'
from /home/65633/data/rubygems/gems/bin/mongrel_rails:19
mtr start error
application started, but pid file was not found, check 'mtr status'
The command script/server RAILS_ENV="production" clearly doesn't start Mongrel with the development environment, as you can see from this log line from your first excerpt:
** Starting Rails with development environment...
Furthermore, if you try to run RAILS_ENV=production script/server, does the application start without any gem related errors? That's what I would check.
As for the error in the second logfile, I'm not really sure. What is in line 159 of your administration_controller.rb?

Resources