0

임 카피 스트라 노의의 nginx와 간단한 응용 프로그램과 유니콘카피 스트라 노 권한 거부 오류 : 설정

  • /srv/paintings.git 배포하려고 (시작과 밀어 REPO)

  • /SRV/그림 (응용 프로그램이 설치되어 있어야 장소)

내 deploy.rb의 모습

# config/deploy.rb 
require "bundler/capistrano" 

set :scm,    :git 
set :repository,  "[email protected]:srv/paintings.git" 
set :branch,   "origin/master" 
set :migrate_target, :current 
set :ssh_options,  { :forward_agent => true } 
set :rails_env,  "production" 
set :deploy_to,  "/srv/paintings" 
set :normalize_asset_timestamps, false 

set :user,   "root" 
set :group,   "rvm" 
set :use_sudo,  true 

role :web, "109.0.0.0.05" 
role :app, "109.0.0.0.05" 
role :db,  "109.0.0.0.05", :primary => true 

set(:latest_release) { fetch(:current_path) } 
set(:release_path) { fetch(:current_path) } 
set(:current_release) { fetch(:current_path) } 

set(:current_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip } 
set(:latest_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip } 
set(:previous_revision) { capture("cd #{current_path}; git rev-parse --short [email protected]{1}").strip } 

default_environment["RAILS_ENV"] = 'production' 
default_run_options[:shell] = 'bash' 

namespace :deploy do 
    desc "Deploy your application" 
    task :default do 
    update 
    restart 
    end 

    desc "Setup your git-based deployment app" 
    task :setup, :except => { :no_release => true } do 
    dirs = [deploy_to, shared_path] 
    dirs += shared_children.map { |d| File.join(shared_path, d) } 
    run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}" 
    run "git clone #{repository} #{current_path}" 
    end 

    task :cold do 
    update 
    migrate 
    end 

    task :update do 
    transaction do 
     update_code 
    end 
    end 

    desc "Update the deployed code." 
    task :update_code, :except => { :no_release => true } do 
    run "cd #{current_path}; git fetch origin; git reset --hard #{branch}" 
    finalize_update 
    end 

    desc "Update the database (overwritten to avoid symlink)" 
    task :migrations do 
    transaction do 
     update_code 
    end 
    migrate 
    restart 
    end 

    task :finalize_update, :except => { :no_release => true } do 
    run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) 

    # mkdir -p is making sure that the directories are there for some SCM's that don't 
    # save empty folders 
    run <<-CMD 
     rm -rf #{latest_release}/log #{latest_release}/public/system #{latest_release}/tmp/pids && 
     mkdir -p #{latest_release}/public && 
     mkdir -p #{latest_release}/tmp && 
     ln -s #{shared_path}/log #{latest_release}/log && 
     ln -s #{shared_path}/system #{latest_release}/public/system && 
     ln -s #{shared_path}/pids #{latest_release}/tmp/pids && 
     ln -sf #{shared_path}/database.yml #{latest_release}/config/database.yml 
    CMD 

    if fetch(:normalize_asset_timestamps, true) 
     stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") 
     asset_paths = fetch(:public_children, %w(images stylesheets javascripts)).map { |p| "#{latest_release}/public/#{p}" }.join(" ") 
     run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" } 
    end 
    end 

    desc "Zero-downtime restart of Unicorn" 
    task :restart, :except => { :no_release => true } do 
    run "kill -s USR2 `cat /tmp/unicorn.my_site.pid`" 
    end 

    desc "Start unicorn" 
    task :start, :except => { :no_release => true } do 
    run "cd #{current_path} ; bundle exec unicorn_rails -c config/unicorn.rb -D" 
    end 

    desc "Stop unicorn" 
    task :stop, :except => { :no_release => true } do 
    run "kill -s QUIT `cat /tmp/unicorn.my_site.pid`" 
    end 

    namespace :rollback do 
    desc "Moves the repo back to the previous version of HEAD" 
    task :repo, :except => { :no_release => true } do 
     set :branch, "[email protected]{1}" 
     deploy.default 
    end 

    desc "Rewrite reflog so [email protected]{1} will continue to point to at the next previous release." 
    task :cleanup, :except => { :no_release => true } do 
     run "cd #{current_path}; git reflog delete --rewrite [email protected]{1}; git reflog delete --rewrite [email protected]{1}" 
    end 

    desc "Rolls back to the previously deployed version." 
    task :default do 
     rollback.repo 
     rollback.cleanup 
    end 
    end 
end 

def run_rake(cmd) 
    run "cd #{current_path}; #{rake} #{cmd}" 
end 

로그 출력 : * 모자를 수행 : 설정 *

 [109.etc] env RAILS_ENV=production sh -c 'git clone [email protected]:srv/paintings.git /srv/paintings/current' 
** [out :: 109.etc] Initialized empty Git repository in /srv/paintings/current/.git/ 
** [out :: 109.etc] The authenticity of host '109.etc (109.etc)' can't be established. 
** [out :: 109.etc] RSA key fingerprint is e9:af etc. 
** [out :: 109.etc] Are you sure you want to continue connecting (yes/no)? 

Typing Yes keeps me waiting forever with no status updates 
+0

릴리스 [/ srv/paintings/releases] 폴더가 프로덕션 시스템에 있는지 확인하십시오. 프로덕션 시스템에서이 폴더를 수동으로 만들어야한다고 생각합니다. – Arun

+0

thx. 존재하지 않았지만 수동으로 추가하려고했지만 오류는 use_sudo를 false로 설정하고 시도하여 – Rubytastic

+0

을 계속 유지했습니다. – Arun

답변

1

I Capistrano에게 이전에 연결하지 않은 ssh 서버에 연결하라고 말했을 때 비슷한 오류가 발생했습니다. ssh [email protected]과 같이 서버에 연결 (동일한 사용자, 즉 root이 아니고 git이 아님) 했습니까?

서버를 신뢰하려면 다시 묻는 것이 좋습니다. 그렇다면 카피스토라노가 당신의 '예'입력에 반응하지 않는다고 생각합니다.

또한 루트로 서버에 연결합니다. 즉, use_sudotrue으로 설정하지 않아도됩니다.

+0

이 문제가 해결되었습니다. thx 님이 글을 업데이트 할 수 없었습니다. 이제 배포가 모두 실행되지만 유니콘과 같은 작은 문제가 있지만이 현상금에 맞지 않을 것으로 추측됩니다. – Rubytastic

+0

일하게되어 기쁩니다. – Pascal

+0

아직 완전하지는 않습니다. 나는 또 다른 부분에 다시 갇혀서 그것에 관한 질문을 게시하는 것을 생각하지만, 그것은 다른 주제에있을 것입니다. 고마워 – Rubytastic

1

default_environment["PATH"] = "--"를 사용하거나 어떻게 든 bash에 전체 경로를 제공하지 않습니다 (보통 /bin/bash)

+0

Thx는 너무나 명백한 것을 지적하기 위해 여러 번 보았지만 완전히 좋지는 않았지만 그렇게 보였습니다. 해당 섹션을 업데이트 된 게시물과 같이 변경했습니다. 하지만 정확히 똑같은 문제가 지속됩니다 – Rubytastic

관련 문제