Total noob di sini. Saya mencoba untuk menyebarkan aplikasi melalui Capistrano. Saya mendapatkan izin ditolak kesalahan tanpa henti ketika saya mencoba menjalankan cap deploy: update. Tampaknya setidaknya beberapa kesalahan ini disebabkan oleh direktori yang hilang yang memicu kesalahan "Izin Ditolak". (Saya sedang melakukan setup pada root untuk sementara waktu.)
set :user, 'root'
set :domain, 'domainname.com'
set :application, 'appname'
# adjust if you are using RVM, remove if you are not
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
# file paths
set :repository, "ssh://root@domain.com/~/git/appname.git"
set :deploy_to, "/var/rails/appname"
# distribute your applications across servers (the instructions below put them
# all on the same server, defined above as 'domain', adjust as necessary)
role :app, domain
role :web, domain
role :db, domain, :primary => true
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
set :rails_env, :production
namespace :deploy do
desc "cause Passenger to initiate a restart"
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
end
end
after "deploy:update_code", :bundle_install
desc "install the necessary prerequisites"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end
Inilah hasil saya:
** [domainname.com :: out] Cloning into '/var/rails/appname/shared/cached-copy'...
** [domainname.com :: err] Permission denied, please try again.
** [domainname.com :: err] Permission denied, please try again.
** [domainname.com :: err] Permission denied (publickey,gssapi-with-mic,password).
** [domainname.com :: err] fatal: The remote end hung up unexpectedly
Saya dapat ssh tanpa kata sandi, jadi tidak yakin tentang kesalahan publickey itu.
Omong-omong, jika saya lari cap deploy:update
tanpanya set :deploy_via, :remote_cache
, inilah hasil saya:
** [domainname.com :: out] Cloning into '/var/rails/appname/releases/20120326204237'...
** [domainname.com :: err] Permission denied, please try again.
** [domainname.com :: err] Permission denied, please try again.
** [domainname.com :: err] Permission denied (publickey,gssapi-with-mic,password).
** [domainname.com :: err] fatal: The remote end hung up unexpectedly
command finished
Terima kasih banyak atas bantuan Anda dengan ini.
UPDATE
Menambahkan ssh_options[:forward_agent] = true
ke deploy.rb tampaknya agak memperbaiki keadaan.