2016-11-05 11 views
0

私は、すでに何度もうまく展開したデジタル海洋サーバーを使用しています。突然、私が実行する度にcap production deployが失敗し、欠落している宝石があると私に伝えます。その中には開発グループに入っているものもあるので、生産中であってはいけません。ここに私のコンソールの出力に欠けている宝石があります。また、プリコンパイルされたアセットに関連しているように見えるいくつかの失敗したプロセスもあります。ここでRailsアプリの配備に失敗し、宝石が見つからないと言われました。

DEBUG [c182dc11] Running [ -L /home/deploy/apps/team_hadley/releases/20161105191648/public/assets ] on 162.243.135.130 
DEBUG [c182dc11] Command: [ -L /home/deploy/apps/team_hadley/releases/20161105191648/public/assets ] 
DEBUG [c182dc11] Finished in 0.062 seconds with exit status 1 (failed). 
DEBUG [5bd74104] Running [ -d /home/deploy/apps/team_hadley/releases/20161105191648/public/assets ] on 162.243.135.130 
DEBUG [5bd74104] Command: [ -d /home/deploy/apps/team_hadley/releases/20161105191648/public/assets ] 
DEBUG [5bd74104] Finished in 0.064 seconds with exit status 1 (failed). 
INFO [92c16c38] Running /usr/bin/env ln -s /home/deploy/apps/team_hadley/shared/public/assets /home/deploy/apps/team_hadley/releases/20161105191648/public/assets on 162.243.135.130 
DEBUG [92c16c38] Command: /usr/bin/env ln -s /home/deploy/apps/team_hadley/shared/public/assets /home/deploy/apps/team_hadley/releases/20161105191648/public/assets 
INFO [92c16c38] Finished in 0.061 seconds with exit status 0 (successful). 
DEBUG [7012f1eb] Running if test ! -d /home/deploy/apps/team_hadley/releases/20161105191648; then echo "Directory does not exist '/home/deploy/apps/team_hadley/releases/20161105191648'" 1>&2; false; fi on 162.243.135.130 
DEBUG [7012f1eb] Command: if test ! -d /home/deploy/apps/team_hadley/releases/20161105191648; then echo "Directory does not exist '/home/deploy/apps/team_hadley/releases/20161105191648'" 1>&2; false; fi 
DEBUG [7012f1eb] Finished in 0.065 seconds with exit status 0 (successful). 
DEBUG [d02096e8] Running ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/team_hadley/shared/bundle on 162.243.135.130 


DEBUG [d02096e8] Command: cd /home/deploy/apps/team_hadley/releases/20161105191648 && ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/team_hadley/shared/bundle 
DEBUG [d02096e8]  ESC[32mRVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
DEBUG [d02096e8] 
DEBUG [d02096e8]  you can ignore these warnings with 'rvm rvmrc warning ignore /home/deploy/apps/team_hadley/releases/20161105191648/Gemfile'. 
DEBUG [d02096e8] 
DEBUG [d02096e8]  To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31mThe following gems are missingESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * nokogiri (1.6.8.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * globalid (0.3.7)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * net-ssh (3.2.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * net-scp (1.2.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sshkit (1.11.3)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * airbrussh (1.1.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * debug_inspector (0.0.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * binding_of_caller (0.7.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano-harrow (0.5.3)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano (3.6.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano-bundler (1.2.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano-rails (1.1.8)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano-rvm (0.1.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano-sidekiq (0.5.4)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * capistrano3-puma (1.2.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * coderay (1.1.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * database_cleaner (1.5.3)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * responders (2.3.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * diff-lcs (1.2.5)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * docile (1.1.5)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * factory_girl (4.7.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * factory_girl_rails (4.7.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * jbuilder (2.6.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * jquery-rails (4.2.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * turbolinks (5.0.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * materialize-sass (0.97.7)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * method_source (0.8.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * slop (3.6.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * pry (0.10.4)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sprockets (3.7.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sprockets-rails (3.2.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * react-rails (1.9.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * rspec-support (3.5.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * rspec-core (3.5.4)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * rspec-expectations (3.5.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * rspec-mocks (3.5.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * rspec-rails (3.5.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sass-rails (5.0.6)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sdoc (0.4.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * shoulda-matchers (3.1.1)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * simplecov-html (0.10.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * simplecov (0.11.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * spring (2.0.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * sprockets-es6 (0.9.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * uglifier (3.0.2)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[31m * web-console (2.3.0)ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8]  ESC[33mInstall missing gems with `bundle install`ESC[0m 
DEBUG [d02096e8] 
DEBUG [d02096e8] Finished in 1.037 seconds with exit status 1 (failed). 
    INFO [62fad7fd] Running ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/team_hadley/shared/bundle --without development test --deployment --quiet on 162.243.135.130 
DEBUG [62fad7fd] Command: cd /home/deploy/apps/team_hadley/releases/20161105191648 && ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/team_hadley/shared/bundle --without development test --deployment --quiet 
DEBUG [62fad7fd]  ESC[32mRVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
DEBUG [62fad7fd] 
DEBUG [62fad7fd]  you can ignore these warnings with 'rvm rvmrc warning ignore /home/deploy/apps/team_hadley/releases/20161105191648/Gemfile'. 
DEBUG [62fad7fd] 
DEBUG [62fad7fd]  To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 
DEBUG [62fad7fd] 
DEBUG [62fad7fd]  ESC[0m 
DEBUG [62fad7fd] 
DEBUG [62fad7fd]  bash: line 1: 7571 Killed     ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/team_hadley/shared/bundle --without development test --deployment --quiet 

は私Capfileです:

# Load DSL and Setup Up Stages 
require 'capistrano/setup' 
require 'capistrano/deploy' 

require 'capistrano/rails' 
require 'capistrano/bundler' 
require 'capistrano/rvm' 
require 'capistrano/puma' 

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. 
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 

そして、私のdeploy.rbファイル:

server '162.243.135.130', port: 22, roles: [:web, :app, :db], primary: true 

set :repo_url,  '[email protected]:mghadley/team_hadley.git' 
set :application,  'team_hadley' 
set :user,   'deploy' 
set :puma_threads, [4, 16] 
set :puma_workers, 0 

# Don't change these unless you know what you're doing 
set :pty,    true 
set :use_sudo,  false 
set :stage,   :production 
set :deploy_via,  :remote_cache 
set :deploy_to,  "/home/#{fetch(:user)}/apps/#{fetch(:application)}" 
set :puma_bind,  "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock" 
set :puma_state,  "#{shared_path}/tmp/pids/puma.state" 
set :puma_pid,  "#{shared_path}/tmp/pids/puma.pid" 
set :puma_access_log, "#{release_path}/log/puma.error.log" 
set :puma_error_log, "#{release_path}/log/puma.access.log" 
set :ssh_options,  { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) } 
set :puma_preload_app, true 
set :puma_worker_timeout, nil 
set :puma_init_active_record, true # Change to false when not using ActiveRecord 

## Defaults: 
# set :scm,   :git 
# set :branch,  :master 
# set :format,  :pretty 
# set :log_level,  :debug 
# set :keep_releases, 5 

## Linked Files & Directories (Default None): 
# set :linked_files, %w{config/database.yml} 
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} 

namespace :puma do 
    desc 'Create Directories for Puma Pids and Socket' 
    task :make_dirs do 
    on roles(:app) do 
     execute "mkdir #{shared_path}/tmp/sockets -p" 
     execute "mkdir #{shared_path}/tmp/pids -p" 
    end 
    end 

    before :start, :make_dirs 
end 

namespace :deploy do 
    desc "Make sure local git is in sync with remote." 
    task :check_revision do 
    on roles(:app) do 
     unless `git rev-parse HEAD` == `git rev-parse origin/master` 
     puts "WARNING: HEAD is not the same as origin/master" 
     puts "Run `git push` to sync changes." 
     exit 
     end 
    end 
    end 

    desc 'Initial Deploy' 
    task :initial do 
    on roles(:app) do 
     before 'deploy:restart', 'puma:start' 
     invoke 'deploy' 
    end 
    end 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     invoke 'puma:restart' 
    end 
    end 

    before :starting,  :check_revision 
    after :finishing, :compile_assets 
    after :finishing, :cleanup 
    after :finishing, :restart 
end 

# ps aux | grep puma # Get puma pid 
# kill -s SIGUSR2 pid # Restart puma 
# kill -s SIGTERM pid # Stop puma 

そして、最後に、私のGemfile:誰もが

source 'https://rubygems.org' 
ruby '2.2.3' 

gem 'rails', '4.2.5' 
gem 'pg', '~> 0.15' 
gem 'sass-rails', '~> 5.0' 
gem 'materialize-sass', '~> 0.97.6' 
gem 'uglifier', '>= 1.3.0' 

gem 'devise', '~> 4.1.1' 

gem 'jquery-rails' 
gem 'jquery-turbolinks' 
gem 'turbolinks' 
gem 'jbuilder', '~> 2.0' 
gem 'sdoc', '~> 0.4.0', group: :doc 

gem "sprockets" 
gem "sprockets-es6" 
gem "react-rails" 
gem "cloudinary" 
gem "jquery-slick-rails" 
gem "sidekiq" 

group :development, :test do 
    gem 'pry', '~> 0.10.3' 
    gem 'rspec-rails' 
    gem 'shoulda-matchers', '~> 3.1.1' 
    gem 'database_cleaner', '~> 1.5.3' 
    gem 'simplecov', '~> 0.11.2' 
    gem 'factory_girl_rails', '~> 4.7.0' 
end 

group :development do 
    gem 'web-console', '~> 2.0' 

    gem 'spring' 

    gem 'capistrano-sidekiq', require: false 
    gem 'capistrano',   require: false 
    gem 'capistrano-rvm',  require: false 
    gem 'capistrano-rails', require: false 
    gem 'capistrano-bundler', require: false 
    gem 'capistrano3-puma', require: false 
end 

group :produection do 
    gem 'rails_12factor' 
    gem 'puma' 
end 

が起こるん何がうまくいかないのか知るために?

答えて

2

bundle checkの出力が表示されています。宝石が欠けています。これは、capistrano-bundlerがbundle installを実行する前に最初にbundle checkを実行するために発生します。 checkの出力は無視できます。

本当の問題は、言うあなたのログの最後の行、次のとおりです。

bash: line 1: 7571 Killed     ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/team_hadley/shared/bundle --without development test --deployment --quiet 

を見てわかるように、bundle installは、オペレーティングシステムによって殺されることになって失敗しています。これは、あなたがRAMを使い果たし、OSがプロセスを停止させたため、ほぼ確実です。

解決策として、VMにスワップを追加するか、RAMを増やしてVMにアップグレードすることができます。

ログを確認して/var/log/syslogを確認し、メモリ関連のエラーを探します。

+0

ありがとうございます!私はこれを試してみましょう。 – NoTroutAboutIt

+0

あなたが気にしない場合、1つのフォローアップの質問 - メモリが不足していることがよくありますか? – NoTroutAboutIt

+0

私はスワップメモリ​​を追加することが私の場合でも同様のエラーが発生していることを確認できます。 –

関連する問題