Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy when bundled version of Rake does not match installed version #31

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

rolftimmermans
Copy link

I'm trying to deploy an application that uses Bundler. I'm able to install all required gems by doing a bundle install in the post_setup_script. Unfortunately, regardless of my installed bundle, rake deploy:post_setup fails.

You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2.
Using bundle exec may solve this.

This is a common problem when different applications on the same server have different bundled versions of rake. The solution as suggested is to use bundle exec rake instead of rake. Unfortunately there seems no way to make Whiskey Disk perform the command bundle exec rake deploy:post_setup instead of rake deploy:post_setup.

I'm struggling to work around this limitation. In my opinion it would be great if:

  1. Whiskey Disk allows setting the rake command to something else, in this case bundle exec rake; or

  2. Whiskey Disk checks for a Gemfile, and if it is present executes bundle exec rake instead of rake. This can be accomplished with something like:

    if [ -f Gemfile ]; then rake_cmd="bundle exec rake"; else rake_cmd="rake"; fi; $rake_cmd

I would be happy to write a patch for either solution. Please share what you think is the best approach for Whisky Disk; or perhaps a different solution entirely.

@rick
Copy link
Member

rick commented Nov 7, 2011

Currently I'm of the opinion that rvm and bundler are both doing the wrong thing by forcing any application or tool which uses binaries in their environments to begin wrapping or prefixing all calls with "bundle exec" and "rvm exec" (and sometimes both).

I generally oppose modifying a general purpose tool to work around defects in poorly designed software. I've seen a couple of requests wanting a custom rake re-definition, but I'm aware of many users of both bundler and rvm who seem to be getting by without such a feature. I'm not clear what the difference is in these usage models so I'm hesitant to add features to whiskey disk to support a minority use case that I'm not convinced is a "good" use case.

For what it's worth, I'm more inclined to support your usage #1 than your usage #2. Introspecting into the behavior of a tool like bundler from afar seems a recipe for headaches, or at least breakage, especially given the track-record of bundler development.

I welcome more input on this topic, certainly.

@rolftimmermans
Copy link
Author

Thank you very much for your input. Let me highlight why this is an important feature to have. The problem is that deployment of one or more Bundler-enabled applications to the same server has a very high chance of introducing dependencies on different versions of Rake. If this happens, it is impossible to use Whiskey Disk in a sane way. The only alternative that I can see is to add relative paths to the $PATH environment variable on the server and use Bundler's bin stubs to create local executables. Relative paths are very dangerous though, and this should probably never be done on a production server.

To make these kinds of deployments work, there should be some way to make Whiskey Disk Bundler aware. I agree with your preference for option 1.

I've attached two commits. One implements the feature (+ tests), the other adds the configuration option to the documentation. It would be great if this feature can make it into Whiskey Disk, especially since Bundler is used in Rails 3 applications by default.

@rick
Copy link
Member

rick commented Nov 8, 2011

Rolf -- thanks for the code. In researching it a bit more, I believe the reason most people don't hit this issue is that most people aren't using different versions of rake for different projects (which allows them to perform bundler incantations in the Rakefile without using 'bundle exec').

I'll do some additional work with this and land it as soon as I can (I would prefer to use the config filter chain to handle the defaulting, and I may want to go ahead and test it more thoroughly via the integration suite).

Thanks!

@rolftimmermans
Copy link
Author

Thank you, Rick! You're quite right -- dependencies on different versions of Rake is a problem that has started to (re)appear the last couple of months now that Rake has seen some incremental updates.

@lantins
Copy link

lantins commented Nov 23, 2011

+1

I've bumped into this problem before and managed to fudge on by, but it keeps happening more and more.

@slipstreamstudio
Copy link

+1

1 similar comment
@costi
Copy link

costi commented Jan 11, 2013

+1

@jesse-sge
Copy link

I merged this in a while back to https://github.com/jesseadams/whisk in efforts to keep things caught up until the original author has time to revisit this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants