我有两个问题。一个小而一个更大的问题。
在我尝试通过teachmetocode-tuorial设置capistrano之后 有一些stackoverflow的帮助。我坐下来,有许多部署capistrano的教程,并编写了我自己的deploy.rb新版本 我们的gem env输出看起来如此
RubyGems环境:
我们的deploy.rb就在这里
require "bundler/capistrano"
set :application, "myapp"
set :repository, "#{application}@myserver:/home/git/repos/#{application}.git"
set :scm, :git
set :user, "#{application}"
set :use_sudo, false
set :deploy_to, "/home/#{application}/#{application}"
set :deploy_via, :remote_cache
set :keep_releases, 5
server "myserver", :app, :web, :db, :primary => true
set :branch, "master"
ssh_options[:forward_agent] = false
default_run_options[:pty] = true
before "deploy:assets:precompile", "bundle:install"
load 'deploy/assets'
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
我们的开发设置 我们使用Apache + Passagner和http://beginrescueend.com/rvm/install/的rvm安装。 在服务器上,我们以相同的方式安装它。每个用户(应用程序,gemsets或realuser)都必须是rvm组的成员...我们使用modrails安装passagner ... http://www.modrails.com/documentation/Users%20guide%20Apache.html#_installing_via_the_gem
但是当我使用cap deploy:cold
时,为什么会出现错误。 cap deploy:check
说You appear to have all necessary dependencies installed
错误在这里
triggering after callbacks for `deploy:finalize_update'
* executing `bundle:install'
* executing "ls -x /home/myapp/myapp/releases"
servers: ["myserver"]
[myserver] executing command
[myserver] sh -c 'ls -x /home/myapp/myapp/releases'
command finished in 82ms
* executing "cd /home/myapp/myapp/releases/20120331143114 && bundle install --gemfile /home/myapp/myapp/releases/20120331143114/Gemfile --path /home/m
ahaloo/myapp/shared/bundle --deployment --quiet --without development test"
servers: ["myserver"]
[myserver] executing command
[myserver] sh -c 'cd /home/myapp/myapp/releases/20120331143114 && bundle install --gemfile /home/myapp/myapp/releases/20120331143114/Gemfile --path /h
ome/myapp/myapp/shared/bundle --deployment --quiet --without development test'
** [out :: myserver] sh: bundle: not found
command finished in 73ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/myapp/myapp/releases/20120331143114; true"
servers: ["myserver"]
[myserver] executing command
[myserver] sh -c 'rm -rf /home/myapp/myapp/releases/20120331143114; true'
command finished in 171ms
failed: "sh -c 'cd /home/myapp/myapp/releases/20120331143114 && bundle install --gemfile /home/myapp/myapp/releases/20120331143114/Gemfile --path /home/
myapp/myapp/shared/bundle --deployment --quiet --without development test'" on myserver
marcus@lenny:~/dev/workspace/myapp$
我们的bundle list
就在这里
* actionmailer (3.2.0)
* actionpack (3.2.0)
* activemodel (3.2.0)
* activerecord (3.2.0)
* activeresource (3.2.0)
* activesupport (3.2.0)
* arel (3.0.2)
* builder (3.0.0)
* bundler (1.1.1)
* capistrano (2.11.2)
* coffee-rails (3.2.1)
* coffee-script (2.2.0)
* coffee-script-source (1.2.0)
* erubis (2.7.0)
* execjs (1.3.0)
* highline (1.6.11)
* hike (1.2.1)
* i18n (0.6.0)
* journey (1.0.3)
* jquery-rails (1.0.17)
* json (1.6.5)
* libv8 (3.3.10.4)
* mail (2.4.4)
* mime-types (1.17.2)
* multi_json (1.1.0)
* net-scp (1.0.4)
* net-sftp (2.0.5)
* net-ssh (2.3.0)
* net-ssh-gateway (1.1.0)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.0)
* railties (3.2.0)
* rake (0.9.2.2)
* rdoc (3.12)
* sass (3.1.15)
* sass-rails (3.2.0)
* simple_form (2.0.1)
* sprockets (2.1.2)
* sqlite3 (1.3.5)
* therubyracer (0.9.10)
* thor (0.14.6)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.32)
* uglifier (1.2.3)
* uuidtools (2.1.2)
有人可以帮助我们获得工作的capistrano
答案 0 :(得分:0)
通过上限检查您的Capistrano路径,然后回显$ PATH 。你可能会看到你的标准/ usr / local / bin和/ usr / bin,但这不是RVM有Bundler的地方
编辑您的Capistrano config / deploy.rb文件,并添加以下行:
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
set :rvm_type, :user # Don't use system-wide RVM
答案 1 :(得分:0)
问题1(多次输入密码):
您可以使用
在本地计算机上生成公钥/私钥对 ssh-keygen -t rsa
(输入所有)
这会在/home/LOCAL_USER/.ssh/目录中生成两个文件(id_rsa和 id_rsa.pub )
然后在服务器中创建或编辑文件/home/user/.ssh/ authorized_keys 并添加id_rsa.pub的内容
使用此功能,您的本地计算机有权访问此服务器(使用用户进行日志记录)而无需输入密码。
答案 2 :(得分:0)
您没有使用rvm-capistrano集成,此处描述了集成:
请注意,rvm-capistrano不再是RVM安装的一部分,它是单独的gem,您需要将其包含在Gemfile
中,并且config/deploy.rb
中的要求也不要忘记设置{{1} }}