cap stopped working missing bin file - rvm

capistrano was working fine, I don't know what I changed, but now I get this:
(cap3, rails4, using capistrano-rvm)
$ cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_rails_env
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
DEBUG [954551b1] Running ~/.rvm/bin/rvm version as myuser#myip
DEBUG [954551b1] Command: ~/.rvm/bin/rvm version
DEBUG [954551b1] bash: /opt/myuser/.rvm/bin/rvm: No such file or directory
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as myuser#myip: rvm exit status: 127
rvm stdout: Nothing written
rvm stderr: bash: /opt/myuser/.rvm/bin/rvm: No such file or directory
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
SSHKit::Command::Failed: rvm exit status: 127
rvm stdout: Nothing written
rvm stderr: bash: /opt/myuser/.rvm/bin/rvm: No such file or directory
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/command.rb:95:in `exit_status='
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:179:in `block in _execute'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:77:in `capture'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/joelnylund/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
At some point I did install a new ruby, but that seemed to work fine, rvm works fine on the server:
$ which rvm
/usr/local/rvm/bin/rvm
and:
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]
I have tried adding to deploy.rb :
set :rvm_type, 'system' set :rvm_bin_path, '/usr/local/rvm/bin/'
Any ideas?

Related

invalid byte sequence in US-ASCII during assets:precompile

I can no longer deploy my app because of an UTF error, here is the trace :
/srv/outils/www/railsapp/releases/20140414151455$ cd -- /srv/outils/www/railsapp/releases/20140414151455 && RAILS_ENV=prodtest RAILS_GROUPS=assets bundle exec rake assets:precompile --trace
rake aborted!
rake aborted!
invalid byte sequence in US-ASCII
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:16:in `block in trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `map'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:340:in `trace'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:187:in `display_error_message'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:174:in `rescue in standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `load'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
The LANG variable is set to fr_FR.UTF-8.
What bother me is that which ruby gives me :
/home/admin/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
I installed a rvm gem and now i have exactly the same error with the correct RVM path.
I tried :
Adding #encoding UTF-8 everywhere
Added :
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
Checked $LANG on my server
Removed any éè etc.. from my previous commits
EDIT : Migrated from ruby 1.9.3 to 2.1
Where to go now to investigate this problem?

rake assets precompile aborted with rails 3.2.11

I have to run rake assets:precompile command before deploying in rackspace server, recently upgraded rails version from 3.2.9 to 3.2.11 due to the security patch and Upgraded JSON GEM.
I get the following error and rake abort.
$> rake assets:precompile --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Command failed with status (): [/usr/local/rvm/rubies/ruby-1.9.3-p385/bin/...]
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/lib/rake /file_utils.rb:53:in `block in create_shell_runner'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/lib/rake/file_utils.rb:45:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/lib/rake/file_utils.rb:45:in `sh'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.11/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.11/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p385#global/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
Any solution for this ?
May be memory issue?
Try upgrading the RAM in VPS

Unicorn with Foreman - Socket Already Used Error

I want to control the unicorn process with in foreman procfile. Here is my Procfile
web: bundle exec unicorn -c config/unicorn/local.rb -E local
thinking_sphinx: bundle exec rake ts:start
delayed_job: ./script/delayed_job start
delayed_delta: ./script/delayed_delta start
mail_receiver: ./scripts/mail_receiver_runner start
Here is my unicorn config.
app_path = /home/deploy/apps/local.myapp.com/myapp/current
worker_processes 1
preload_app false
timeout 180
listen "#{app_path}/tmp/pids/unicorn.sock", backlog: 1024
pid "#{app_path}/tmp/pids/unicorn.pid"
working_directory app_path
stderr_path "log/unicorn.log"
stdout_path "log/unicorn.log"
When I start it with cap foreman:start it is raising these errors:
adding listener failed addr=/home/deploy/apps/local.myapp.com/myapp/current/tmp/pids/unicorn.sock (in use)
/home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `initialize': Address already in use - /home/deploy/apps/local.myapp.com/myapp/current/tmp/pids/unicorn.sock (Errno::EADDRINUSE)
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `new'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `bind_listen'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:228:in `listen'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `block in bind_new_listeners!'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `each'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `bind_new_listeners!'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:140:in `start'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn:121:in `<top (required)>'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
Is it related to unicorn or a configuration issue for foreman?
Removing this line from unicorn configuration sort out the issue.
pid "#{app_path}/tmp/pids/unicorn.pid"

Heroku run rake db:reset error

I am trying to reset my Heroku database. I am getting the following error:
** Invoke environment
** Execute db:abort_if_pending_migrations
rake aborted!
uninitialized constant Object::State
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/app/db/seeds.rb:9:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/engine.rb:520:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/engine.rb:520:in `load_seed'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib
Line 9 of seed.rb is State.create(name: 'Alaska', abbrev: 'AK' );
The model is defined.
Any help?
The rake db:reset task is not supported. Heroku apps do not have permission to drop and create databases. Use the heroku pg:reset command instead.

assets:precompile stack level too deep

I'm trying to have success on running the task rake assets:precompile but I have the following error
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
stack level too deep
(in .../app/assets/stylesheets/admin/scaffolds.css.scss)
.....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/diogui/.rvm/rubies/ruby-1.9.2-p320/...]
.....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
.....rvm/gems/ruby-1.9.2-p320#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
.....rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.1.1/lib/sprockets/assets.rake:9:in `ruby_rake_task'
....rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.1.1/lib/sprockets/assets.rake:17:in ` invoke_or_reboot_rake_task'
In my production.rb I have
config.serve_static_assets = false
config.assets.enabled = true
config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
Yes I have Sass 3.1.4
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
Does anybody have an idea what is the problem ? Or what am I missing ? Thanks :)
It turns out this is a documented issue with the sass-rails gem: https://github.com/rails/sass-rails/issues/78
It can apparently be solved by downgrading the sass-rails gem to 3.1.4 (if you're on Rails 3.1) or upgrading to 3.2.5 (if you're on Rails 3.2): "rake aborted! stack level too deep" while deploying to Heroku
This worked for me :)
Changing the ruby version to 2.3.0 did the trick.
This one saved my day.