RVM Gemset - Bundler & Capistrano in Production

后端 未结 1 1315
半阙折子戏
半阙折子戏 2021-01-31 05:23

I\'m deploying a rails app to a VPS with capistrano, bundler and rvm. Here is part of my deploy.rb

$:.unshift(File.expand_path(\'./lib\', ENV[\'rvm_path\']))
re         


        
相关标签:
1条回答
  • 2021-01-31 05:52

    I use RVM in development and production as well. However, while I use gemsets in development to separate gems between my rails projects, I only use RVM to install rubies on my production VPS and let Bundler handle the versions of my gems.

    Using the bundler integration via require "bundler/capistrano" automatically sets some things up for bundler. You can see the code behind this in Bundlers Github page. The basic settings are so that bundle executes this command:

    bundle install --gemfile Gemfile --path shared/bundle --deployment --quiet --without development test
    

    As you can see, the --deployment and --path flags are given, which tells Bundler to bundle your gems with your application in the shared/bundle directory, and only use the versions specified in your Gemfile.lock (i.e. the versions that are working in development). Since the bundle directory is shared between deployments, I find it comparable to using RVM gemsets for each application, just easier.

    If you still want to put gems in separate gemsets I'd recommend this tutorial from Darcy Laycock for further reading.

    0 讨论(0)
提交回复
热议问题