To solve my problem, which is discussed in "will_paginate error in production undefined method 'paginate'", I tried running:
script/rails runner -e production
and:
bundle exec script/rails runner -e production
on the server like suggested in this github issue: https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158
But I get the following error:
bundler: command not found: script/rails
Install missing gem executables with `bundle install`
Bundle install doesn't help. Any suggestions?
I'm using: Ruby 2.0.0p247, Rails 4.0.0, Ubuntu 12.10 LTS, Unicorn, Capistrano
Try this instead:
bundle exec rails runner -e production.
Use bin/rails runner for rails4 (when the bin/rails file exists)
Related
Im trying to reach the production env console. I think rbenv is messing with me.
When i run rails console production i get the old:
Usage:
rails new APP_PATH [options]
So i figure, it doesn't recognize my dir as an rails app because of the versions so I run. So the rails -v tells me:
deploy#webb-labb2:~/prognoser/current$ rails -v
Rails 5.1.0
Which is the wrong version of the app.
And the bundle exec rails -v command gives me:
deploy#webb-labb2:~/prognoser/current$ bundle exec rails -v
Rails 4.2.8
Which is the correct version. But the:
deploy#webb-labb2:~/prognoser/current$ bundle exec rails console production
Still gives me the old:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH]
I ran
$ bundle exec rake rails:update:bin
that did the trick. And I had to add a boot file to the shared/config directory.
I'm having a hard time running rails runner (in rails version 4.2.6).
Each of the following commands throw the error "config.eager_load is set to nil" even though this value is properly set in all environment files.
bin/rails runner -e "MyClass.my_method"
bundle exec rails runner =e "MyClass.my_method"
bin/rails runner -e "MyClass.my_method" RAILS_ENV=development
bundle exec rails runner =e "MyClass.my_method" RAILS_ENV=development
RAILS_ENV=development bin/rails runner -e "MyClass.my_method"
RAILS_ENV=development bundle exec rails runner -e "MyClass.my_method"
What's the proper way to run rails runner?
Here's the docs on the proper way to run runner: http://guides.rubyonrails.org/command_line.html#rails-runner this implies it might be
bin/rails runner -e development "MyClass.my_method"
Note: I always recommend reading all the Rails Guides, If you haven't yet - they are one the best ways to level up on Rails. :)
This is the error I encounter during rake.
The Easy Project cannot start because the Redmine is not migrated!
Please run bundle exec rake db:migrate RAILS_ENV=production and than
bundle exec rake easyproject:install RAILS_ENV=production rake
aborted!
I try to run the command stated and it doesn't work.
Do I need to install something? Because the bundle install is successful.
I thought running the bundle install after giving me the project will do.
The first developer used Linux, but im on Windows.
Already resolved. I used these ffg commands:
bundle exec rake generate_secret_token
set RAILS_ENV=production
bundle exec rake db:migrate
I cant figure how to start Delayed Jobs on a dedicated Ubuntu server.
It works fine on my localhost but when I run on my server
sudo RAILS_ENV=production bin/delayed_job restart
I get
sudo: bin/delayed_job: command not found
On top of that, if I run the "rake jobs:work RAILS_ENV=production" command Im getting the following error:
PG::FeatureNotSupported: ERROR: SELECT FOR UPDATE/SHARE is not allowed in subqueries
Apparently theres an issue with my psql version.
Is there any way I can get the script to work? Any effective Capistrano recipes available? All ive found on the web are old recipes for Rails 3 and older versions of capistrano.
Thanks in advance.
EDIT:
I have already bundled install the daemons gem and generated "delayed_job:active_record" on my local machine, then proceded to cap deploy which bundle installed and migrated in the production server.
The bin/delayed_job file exists in the server yet it fails with command not found.
And add this to config/environment.rb:
ENV['RAILS_ENV'] ||= 'production'
Then at your production server:
RAILS_ENV=production rake db:migrate
RAILS_ENV=test production generate delayed_job:active_record && RAILS_ENV=production rake db:migrate
Now after you do that:
RAILS_ENV=production script/delayed_job start
As for Capistrano error you are facing, please try to add the command like:
run "cd #{current_path}; #{sudo} RACK_ENV=production bundle exec #{current_path}/bin/delayed_job start"
You must run this on target server:
bundle exec rails generate delayed_job
So I am attempting to get a capistrano deployment setup with an nginx/unicorn server, using RVM.
The deploy works, but when I attempt to interact with unicorn via capistrano i get an error like:
[~/source/quibbler/config]
$ cap unicorn:start
* executing `unicorn:start'
* executing "cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D"
servers: ["wwwtestvm.whf.app"]
[wwwtestvm.whf.app] executing command
** [out :: wwwtestvm.whf.app] Could not find rake-0.9.2 in any of the sources
command finished in 553ms
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290#quibbler' -c 'cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D'" on wwwtestvm.whf.app
I have searched the interwebs all night and can not find the solution. If I copy paste the command into my shell it works so I am 99% sure it has to do with the RVM environment not being correct.
I have created a gist of my deploy and unicorn configs:
https://gist.github.com/1375736#file_deploy.rb
https://gist.github.com/1375736#file_unicorn_production.rb
Any help or guidance would be appreciated.
Thanks to sannankhalid answer on this other question i was able to resolve it.
Short answer: add rake to your Gemfile, make sure you run bundle install so your Gemfile.lock gets updated, then deploy to your server, ayay!