capistrano / rbenv

Idiomatic rbenv support for Capistrano 3.x
MIT License
203 stars 60 forks source link

Why is capistrano unable to find rake? #95

Closed asfarley closed 3 years ago

asfarley commented 3 years ago

I have a project deployed with Capistrano, and I recently upgraded the server from Ubuntu 18.04 to 20.04 when all this pain started.

Basically: it looks like Capistrano is unable to find rake, but I can execute the same command if I log in over SSH. cap production deploy is failing at the precompile step:

00:07 deploy:assets:precompile
      01 /home/deploy/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 bundler: failed to load command: rake (/var/www/framelinker/shared/bundle/ruby/2.6.0/bin/rake)
      01 Gem::Exception: can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile?

I've posted the same issue on the Capistrano repo, rbenv repo, reddit, and serverfault, but the responses haven't led me to a solution so far.

I understand this might be my fault, not a bug, so I'm just looking for some help with how to diagnose this.

asfarley commented 3 years ago

Logging into the server and manually executing the following fixed/gave me a workaround for this issue:

/home/deploy/.rbenv/bin/rbenv exec gem update --system

I'm not sure how to roll this into my CI/ansible/capistrano stuff, but at least my server is working again.