简体   繁体   English

使用Capistrano gem在VPS上部署

[英]Deploying on a VPS using the Capistrano gem

I'm trying to deploy a Rails app on a VPS using the capistrano gem. 我正在尝试使用capistrano gem在VPS上部署Rails应用程序。 I want to deploy it from my local machine to the VPS. 我想将其从本地计算机部署到VPS。 I'm not using any repositories like Github or SVN. 我没有使用任何类似Github或SVN的存储库。

So, I've installed the capistrano gem and ran 'bundle'. 因此,我安装了capistrano gem并运行了“ bundle”。 And added the following lines: 并添加了以下几行:

Capfile Capfile

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.3-p194@gemset'

deploy.rb deploy.rb

set :user, 'deploy'
set :application, "my_app"

set :scm, :none
set :deploy_via, :copy
set :deploy_to, "/home/#{user}/#{application}"
set :use_sudo, false

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

role :web, '1.2.3.4'
role :app, '1.2.3.4'
role :db,  '1.2.3.4', :primary => true

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

However, after running 'cap deploy:setup' on local, I get the following error: 但是,在本地运行“ cap deploy:setup”后,出现以下错误:

RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)

I'm not sure if I should use the rvm-capistrano gem. 我不确定是否应该使用rvm-capistrano gem。 I'm a total newbie in deployments, detailed or step by step instructions would really help. 我是部署方面的新手,详细或分步说明确实很有帮助。 Thanks. 谢谢。

Seems like you need to add 好像您需要添加

gem "rvm/capistrano" 宝石“ rvm / capistrano”

to your Gemfile and then remove the unshift line (comment out) 到您的Gemfile,然后删除取消移位的行(注释掉)

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

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