简体   繁体   English

Rvm-Linux Ubuntu上的Capistrano集成

[英]Rvm - Capistrano integration on Linux Ubuntu

I am trying to properly use Capistrano and RVM in order to deploy my Ruby on Rails 3.2.2 application to the remote machine that is running Ubuntu 10.04 LTS. 我试图正确使用Capistrano和RVM,以便将Ruby on Rails 3.2.2应用程序部署到运行Ubuntu 10.04 LTS的远程计算机上。 I read the " How do I configure capistrano to use my rvm version of Ruby " question/answer and the " Using RVM rubies with Capistrano " official documentation, but I have still some issues relating to the Rvm - Capistrano integration . 我阅读了“ 如何配置capistrano以使用我的rvm版本的Ruby ”问题/答案和“ 使用Capistrano使用RVM红宝石 ”官方文档,但是仍然存在一些与Rvm-Capistrano集成有关的问题。

For example, relating to the integration via the rvm capistrano plugin (see the official documentation for more information), what I have to make exactly (since I didn't understand where and how to put the related code) ? 例如,关于通过rvm capistrano插件进行的集成 (有关更多信息,请参见官方文档), 我必须做些什么 (因为我不知道在哪里以及如何放置相关代码)

Or, relating to the integration via :default_environment (see the official documentation for more information), you should properly state the following code in the deploy.rb file: 或者,关于通过:default_environment进行的集成 (有关更多信息,请参见官方文档),您应该在deploy.rb文件中正确声明以下代码:

set :default_environment, {
  'PATH'         => "/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:/path/to/.rvm/ree-1.8.7-2009.10/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.8.7',
  'GEM_HOME'     => '/path/to/.rvm/gems/ree-1.8.7-2010.01',
  'GEM_PATH'     => '/path/to/.rvm/gems/ree-1.8.7-2010.01',
  'BUNDLE_PATH'  => '/path/to/.rvm/gems/ree-1.8.7-2010.01'  # If you are using bundler.
}

What those paths refer to? 这些路径指的是什么? How can I retrieve path values running Linux Ubuntu? 如何检索运行Linux Ubuntu的路径值?

And finally, what integration type do you advice to use? 最后,您建议使用哪种集成类型?

Firstly ensure that rvm installed on the machine. 首先确保在计算机上安装了rvm。

See RVM Installation Instructions or RVM on Ubuntu 10.04 if rvm isn't installed. 如果未安装rvm,请参见RVM安装说明Ubuntu 10.04上的RVM

Then find where rvm is installed to, this can be done either using the find or locate commands. 然后找到rvm的安装位置,可以使用findlocate命令完成。

Eg 例如

find / -iname *rvm

or 要么

locate rvm

In the output of these commands you will see something that looks like /somedirectory/someotherdirectory/.rvm/gees/somethingelse. 在这些命令的输出中,您将看到类似/somedirectory/someotherdirectory/.rvm/gees/somethingelse的内容。

The /somedirectory/someotherdirectory/ is what you would replace /path/to/ with in deploy.rb or replace ENV['rvm_path'] in the unshift command in the documentation of the first option at Using RVM rubies with Capistrano . /somedirectory/someotherdirectory/是您在deploy.rb /path/to/替换/path/to/或在Capistrano使用RVM红宝石的第一个选项的文档中的unshift命令中替换ENV['rvm_path']的内容。

The paths in the deploy.rb are deploy.rb中的路径是

/path/to/.rvm RVM Installation Path /path/to/.rvm RVM安装路径

'PATH' is the binary path that is used to call the rvm binary from. 'PATH'是用于从中调用rvm二进制文件的二进制路径。

See here for more information on PATH. 有关PATH的更多信息,请参见此处

GEM_HOME is the home directory of the Gem. GEM_HOME是Gem的主目录。

See here for more information on Gems. 有关宝石的更多信息,请参见此处

'GEM_PATH' is the PATH of the Gem. 'GEM_PATH'是宝石的路径。

'BUNDLE_PATH' is the PATH of the Bundle. 'BUNDLE_PATH'是捆绑包的路径。

See here for more information on Bundles and Bundler. 有关捆绑和捆扎机的更多信息,请参见此处

I have created example project for rvm/capistrano integration https://github.com/mpapis/ad 我已经创建了用于rvm / capistrano集成的示例项目https://github.com/mpapis/ad

and you can see how easy it was to create deployment script here https://github.com/mpapis/ad/blob/master/config/deploy.rb 并且您可以在这里看到创建部署脚本有多么容易https://github.com/mpapis/ad/blob/master/config/deploy.rb

most important is to visit the server before deployment and install the proper ruby. 最重要的是在部署之前访问服务器并安装正确的红宝石。

I will also add a new tasks to integration to install rvm/ruby -> https://github.com/wayneeseguin/rvm/issues/829 我还将添加新的集成任务以安装rvm / ruby​​-> https://github.com/wayneeseguin/rvm/issues/829

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM