2016-04-10 15 views
0

私はUbuntu 14 LTSを実行するローカル仮想マシンに私のレールアプリケーションを配備しようとします。私はnginxとphusionの乗客を使用します。また、私は展開のためにカピストラーノの宝石を使用します。Capistrano gemを使用してUbuntuサーバーにRailsアプリケーションをデプロイ

仮想マシンの認証キーにローカルSSHキーを追加しました。
のssh [email protected]私が書くしかし


はまた、私はそのようにssh経由で私の仮想マシンへの接続問題がない

bundle exec cap production deploy 

私は、取得するには、次のエラー:

cap aborted! 

Net::SSH::Disconnect: connection closed by remote host 

EOFError: end of file reached 

Tasks: TOP => rbenv:validate 

マイdeploy.rbファイル:

server "192.168.0.8", port: 80, roles: %i(:web :app :db), primary: true 
set :log_level, :debug 

set :application, "mySimpleBlog" 
set :repo_url, "[email protected]:NeilAlishev/mySimpleBlog.git" 
set :user,   "neil" 
set :linked_files, fetch(:linked_files, []).push("config/database.yml", "config/secrets.yml") 
set :linked_dirs, fetch(:linked_dirs, []).push("log", "tmp/pids", "tmp/cache", "tmp/sockets", 
    "vendor/bundle", "public/system", "public/uploads") 
set :deploy_to,  "/home/#{fetch(:user)}/src/#{fetch(:application)}" 

set :rbenv_type, :user 
set :rbenv_ruby, "2.2.4" 
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} "\ 
    "RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" 
set :rbenv_map_bins, %w(rake gem bundle ruby rails) 
set :rbenv_roles, :all 

namespace :deploy do 
    desc "Restart application" 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     execute :touch, release_path.join("tmp/restart.txt") 
    end 
    end 

    after :publishing, "deploy:restart" 
    after :finishing, "deploy:cleanup" 
end 

マイデプロイ/ production.rbファイル:

set :stage, :production 
server "192.168.0.8", user: "neil", roles: %w(web app db) 
role :app, %w([email protected]) 
role :web, %w([email protected]) 
role :db, %w([email protected]) 

マイnginx.confファイル:このような

server { 
listen 80; 
server_name 192.168.0.8; 
charset utf-8; 
rails_env production; 
passenger_enabled on; 
root /home/neil/mySimpleBlog/current/public; 
} 
+0

缶あなたは[このスレッドでは、ソリューションを試してください(http://stackoverflow.com/questio) ns/33567498/capistrano-deploy-error-deploy-to-ubuntu-server)? – BoraMa

+0

SSHでターゲティングサーバーにアクセスできますか? – qcam

+0

ssh neil @ address_of_the_server 私は問題なくサーバにアクセスします。 – Neil

答えて

0

変更production.rb、

role :app, 'address_of_the_server', { 
:ssh_options => { 
:keys => 'key_path(like ~/.ssh/key_name.pem)' 
} 
} 

role :web, 'address_of_the_server', { 
:ssh_options => { 
:keys => 'key_path(like ~/.ssh/key_name.pem)' 
} 
} 

role :db, 'address_of_the_server', { 
:ssh_options => { 
    :keys => 'key_path(like ~/.ssh/key_name.pem)' 
} 
} 
+0

助けてくれなかった、同じエラーが出る – Neil

関連する問題