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 =)
Related
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>'
I'm working on a rails project. With command "bundle exec rails s" I can fire up a local server, however, "bundle exec rails c" throws the following errors:
/Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/commands.rb:33:in `<module:Spring>'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/commands.rb:4:in `<top (required)>'
from /Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application.rb:77:in `preload'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application.rb:143:in `serve'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application.rb:131:in `block in run'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application.rb:125:in `loop'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application.rb:125:in `run'
from /Users/wh026399/healthelife_web/vendor/bundle/gems/spring-1.6.2/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/wh026399/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Ruby version: 2.2.2
Rails version: 4.2.5
gem version: 2.5.2
Bundler version: 1.11.2
[UPDATE]: it turns out that commenting out "spring" in Gemfile will solve this issue.
Okay, I came across this after having the same problem as poster. His update suggesting that removing spring from the Gemfile helped me get on the right track. The problem for me was that I had introduced a new environment variables, but spring didn't pick it up. When you remove spring from the Gemfile, it prevents your app from using the spring process, but it doesn't actually stop the spring process so adding it back, doing bundle install, or anything else will still leave you with the same spring process running.
To see if this is likely your issue, you can check bin/spring status and see if spring is running in the background, and if it has been running for a while.
Solution (at least for me): restart spring
bin/spring stop
rails c
Have you tried gem update --system? You may need an updated version of rubygems.
if you use rvm set the default ruby version using following, so it will pickup the correct ruby version. you probably needs to run bundle install/gem install rails -v 4.2.5 after setting the default
rvm --default 2.2.2
I'm receiving this error when trying to run any rails or rake command.
/Library/Ruby/Gems/2.0.0/gems/xray-rails-0.1.17/lib/xray-rails.rb:5:in `require_relative': cannot load such file -- /Library/Ruby/Gems/2.0.0/gems/xray-rails-0.1.17/lib/xray/middleware (LoadError)
from /Library/Ruby/Gems/2.0.0/gems/xray-rails-0.1.17/lib/xray-rails.rb:5:in `<top (required)>'
Looks like not only experienced this. Here is same issue.
I suggest you to downgrade xray-rails to 0.1.16 or try to figure out by yourself whats going on and why middleware not loaded.
I am unable to any rake tasks within my Rails project. Any attempt to do so results in the following error, stating that it cannot locate an rspec file for ci_reporter:
rake aborted!
LoadError: cannot load such file -- ci/reporter/rake/rspec
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/blake/workspaces/ruby/minestatus/Rakefile:6:in `<top (required)>'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `eval'
I have made the following attempts to reset my environment to a working state:
Installing the newest ci_reporter gem from github
Deleting Gemfile.lock and re-running bundle install
Reinstalling Ruby 2.0.0 using rvm
Unfortunately none of the above things have helped me solve this issue. I am able to run rake tasks in other Rails projects, but not in this one. Rake tasks used to run just fine, and I'm not sure what changes I could've made to break things. Does anyone have an idea of what I can do to get rake tasks to run properly again?
I set myself the task of upgrading my app from rails 3.1 to rails 3.2.6 on my local mac book air lion dev environment. I followed this guide and ruby is upgraded, and all of my gems seemed to install and rails -v gives the answer of rails 3.2.6. If I run any rails commands though, e.g. rails c to start the console, I get this:
MacBook-Air:myapp bob$ rails c
/Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `require': cannot load such file -- ./pubnub.rb (LoadError)
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/bob/work/myapp/config/application.rb:13:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Yes I do use pubnub in my app - it's always been working fine so I don't suspect it necessarily is the problem.
The application.rb line 13 (might be not be relevant) is
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
I do precompile assets before deploying.
The /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1 file is present and I opened it fine.
Does anyone know whats going on / is it pubnub specific or something else? I'm not sure how to troubleshoot further and googling hasn't brought anything up so far.
Thanks,
Dave
I don't see the file pubnub-ruby.rb in the repo for that gem. Try running $ bundle install or $ gem update pubnub-ruby.