2017-07-16 152 views
2

我正在創建一個Rails應用程序。我部署到VPS服務器作爲由Capistrano,運行以下deploy命令:Gems在部署後丟失(Ruby,Ruby on Rails,Capistrano)

$ bundle exec cap development deploy 

而展開的模樣成功,但一些寶石不翼而飛。

The following gems are missing 
DEBUG [16b13d82]  * debug_inspector (0.0.3) 
* web-console (3.1.1) 
DEBUG [16b13d82]  * spring (1.7.2) 
* spring-watcher-listen (2.0.0) 
DEBUG [16b13d82]  * rails-controller-testing (0.1.1) 
DEBUG [16b13d82]  * ansi (1.5.0) 
DEBUG [16b13d82]  * ruby-progressbar (1.8.1) 
* minitest-reporters (1.1.9) 
* formatador (0.2.5) 
DEBUG [16b13d82]  * lumberjack (1.0.12) 
DEBUG [16b13d82]  * nenv (0.3.0) 
DEBUG [16b13d82]  * shellany (0.0.1) 
DEBUG [16b13d82]  * notiffany (0.1.1) 
DEBUG [16b13d82]  * coderay (1.1.1) 
DEBUG [16b13d82]  * slop (3.6.0) 
DEBUG [16b13d82]  * pry (0.10.4) 
DEBUG [16b13d82]  * guard (2.13.0) 
DEBUG [16b13d82]  * guard-compat (1.2.1) 
DEBUG [16b13d82]  * guard-minitest (2.4.4) 
DEBUG [16b13d82]  Install missing gems with `bundle install` 

我想安裝缺失的寶石。

的規格是:

  • 的ubuntu 16.04
  • 捆紮機1.14.6
  • 紅寶石2.4.1p111(2017年3月22日revision58053)[x86_64的-darwin16]
  • 滑軌5.1 .2
  • capistrano 3
  • cloud9(local environment)

我的Gemfile:

source 'https://rubygems.org' 

gem 'rails', '5.1.2' 
gem 'will_paginate',   '3.1.0' 
gem 'bootstrap-will_paginate', '0.0.10' 
gem 'bootstrap-sass', '~> 3.3.6' 
gem 'sass-rails', '>= 3.2' 
gem 'puma',   '3.4.0' 
gem 'uglifier',  '3.0.0' 
gem 'coffee-rails', '4.2.1' 
gem 'jquery-rails', '4.1.1' 
gem 'turbolinks', '5.0.1' 
gem 'jbuilder',  '2.4.1' 
gem 'devise' 
gem 'toastr-rails' 
gem 'omniauth' 
gem 'omniauth-facebook' 
gem 'omniauth-twitter' 
gem 'omniauth-google-oauth2' 
gem 'paperclip' 
gem 'geocoder' 
gem 'jquery-ui-rails', '5.0.5' 
gem 'private_pub' 
gem 'thin' 
gem 'ransack' 
gem 'font-awesome-rails' 
gem 'font-awesome-sass' 
gem 'rails-i18n' 
gem 'payjp' 
gem 'carrierwave' 
gem 'rmagick' 
gem 'rack-mini-profiler' 
gem 'rb-readline' 
gem 'unicorn' 
gem 'capistrano', '~> 3.6' 
gem 'capistrano-rails', '~> 1.3' 
gem 'capistrano-bundler' 
gem 'capistrano-passenger' 
gem 'capistrano-rbenv' 
gem 'therubyracer', platforms: :ruby 
gem 'capistrano3-unicorn' 
gem 'capistrano-safe-deploy-to' 
gem 'listen', '~> 3.1.5' 
gem 'sqlite3', '1.3.13' 

group :development do 
    gem 'web-console',   '3.1.1' 
    gem 'spring',    '1.7.2' 
    gem 'spring-watcher-listen', '2.0.0' 
end 

group :test do 
    gem 'rails-controller-testing', '0.1.1' 
    gem 'minitest-reporters',  '1.1.9' 
    gem 'guard',     '2.13.0' 
    gem 'guard-minitest',   '2.4.4' 
end 

group :production do 
    gem 'pg', '0.18.4' 
    gem 'rails_12factor' 
end 

我Gemfile.lock的

GEM 
    remote: https://rubygems.org/ 
    specs: 
    actioncable (5.0.3) 
     actionpack (= 5.0.3) 
     nio4r (>= 1.2, < 3.0) 
     websocket-driver (~> 0.6.1) 
    actionmailer (5.0.3) 
     actionpack (= 5.0.3) 
     actionview (= 5.0.3) 
     activejob (= 5.0.3) 
     mail (~> 2.5, >= 2.5.4) 
     rails-dom-testing (~> 2.0) 
    actionpack (5.0.3) 
     actionview (= 5.0.3) 
     activesupport (= 5.0.3) 
     rack (~> 2.0) 
     rack-test (~> 0.6.3) 
     rails-dom-testing (~> 2.0) 
     rails-html-sanitizer (~> 1.0, >= 1.0.2) 
    actionview (5.0.3) 
     activesupport (= 5.0.3) 
     builder (~> 3.1) 
     erubis (~> 2.7.0) 
     rails-dom-testing (~> 2.0) 
     rails-html-sanitizer (~> 1.0, >= 1.0.3) 
    activejob (5.0.3) 
     activesupport (= 5.0.3) 
     globalid (>= 0.3.6) 
    activemodel (5.0.3) 
     activesupport (= 5.0.3) 
    activerecord (5.0.3) 
     activemodel (= 5.0.3) 
     activesupport (= 5.0.3) 
     arel (~> 7.0) 
    activesupport (5.0.3) 
     concurrent-ruby (~> 1.0, >= 1.0.2) 
     i18n (~> 0.7) 
     minitest (~> 5.1) 
     tzinfo (~> 1.1) 
    addressable (2.5.1) 
     public_suffix (~> 2.0, >= 2.0.2) 
    airbrussh (1.3.0) 
     sshkit (>= 1.6.1, != 1.7.0) 
    ansi (1.5.0) 
    arel (7.1.4) 
    autoprefixer-rails (7.1.2.2) 
     execjs 
    bcrypt (3.1.11) 
    bootstrap-sass (3.3.7) 
     autoprefixer-rails (>= 5.2.1) 
     sass (>= 3.3.4) 
    bootstrap-will_paginate (0.0.10) 
     will_paginate 
    builder (3.2.3) 
    capistrano (3.8.2) 
     airbrussh (>= 1.0.0) 
     i18n 
     rake (>= 10.0.0) 
     sshkit (>= 1.9.0) 
    capistrano-bundler (1.2.0) 
     capistrano (~> 3.1) 
     sshkit (~> 1.2) 
    capistrano-passenger (0.2.0) 
     capistrano (~> 3.0) 
    capistrano-rails (1.3.0) 
     capistrano (~> 3.1) 
     capistrano-bundler (~> 1.1) 
    capistrano-rbenv (2.1.1) 
     capistrano (~> 3.1) 
     sshkit (~> 1.3) 
    capistrano-safe-deploy-to (1.1.1) 
     capistrano (>= 3.0) 
    capistrano3-unicorn (0.2.1) 
     capistrano (~> 3.1, >= 3.1.0) 
    carrierwave (1.1.0) 
     activemodel (>= 4.0.0) 
     activesupport (>= 4.0.0) 
     mime-types (>= 1.16) 
    climate_control (0.2.0) 
    cocaine (0.5.8) 
     climate_control (>= 0.0.3, < 1.0) 
    coderay (1.1.1) 
    coffee-rails (4.2.1) 
     coffee-script (>= 2.2.0) 
     railties (>= 4.0.0, < 5.2.x) 
    coffee-script (2.4.1) 
     coffee-script-source 
     execjs 
    coffee-script-source (1.12.2) 
    concurrent-ruby (1.0.5) 
    cookiejar (0.3.3) 
    daemons (1.2.4) 
    debug_inspector (0.0.3) 
    devise (4.3.0) 
     bcrypt (~> 3.0) 
     orm_adapter (~> 0.1) 
     railties (>= 4.1.0, < 5.2) 
     responders 
     warden (~> 1.2.3) 
    domain_name (0.5.20170404) 
     unf (>= 0.0.5, < 1.0.0) 
    em-http-request (1.1.5) 
     addressable (>= 2.3.4) 
     cookiejar (!= 0.3.1) 
     em-socksify (>= 0.3) 
     eventmachine (>= 1.0.3) 
     http_parser.rb (>= 0.6.0) 
    em-socksify (0.3.1) 
     eventmachine (>= 1.0.0.beta.4) 
    erubis (2.7.0) 
    eventmachine (1.2.3) 
    execjs (2.7.0) 
    faraday (0.12.1) 
     multipart-post (>= 1.2, < 3) 
    faye (1.2.4) 
     cookiejar (>= 0.3.0) 
     em-http-request (>= 0.3.0) 
     eventmachine (>= 0.12.0) 
     faye-websocket (>= 0.9.1) 
     multi_json (>= 1.0.0) 
     rack (>= 1.0.0) 
     websocket-driver (>= 0.5.1) 
    faye-websocket (0.10.7) 
     eventmachine (>= 0.12.0) 
     websocket-driver (>= 0.5.1) 
    ffi (1.9.18) 
    font-awesome-rails (4.7.0.2) 
     railties (>= 3.2, < 5.2) 
    font-awesome-sass (4.7.0) 
     sass (>= 3.2) 
    formatador (0.2.5) 
    geocoder (1.4.4) 
    globalid (0.4.0) 
     activesupport (>= 4.2.0) 
    guard (2.13.0) 
     formatador (>= 0.2.4) 
     listen (>= 2.7, <= 4.0) 
     lumberjack (~> 1.0) 
     nenv (~> 0.1) 
     notiffany (~> 0.0) 
     pry (>= 0.9.12) 
     shellany (~> 0.0) 
     thor (>= 0.18.1) 
    guard-compat (1.2.1) 
    guard-minitest (2.4.4) 
     guard-compat (~> 1.2) 
     minitest (>= 3.0) 
    hashie (3.5.6) 
    http-cookie (1.0.3) 
     domain_name (~> 0.5) 
    http_parser.rb (0.6.0) 
    i18n (0.8.6) 
    jbuilder (2.4.1) 
     activesupport (>= 3.0.0, < 5.1) 
     multi_json (~> 1.2) 
    jquery-rails (4.1.1) 
     rails-dom-testing (>= 1, < 3) 
     railties (>= 4.2.0) 
     thor (>= 0.14, < 2.0) 
    jquery-ui-rails (5.0.5) 
     railties (>= 3.2.16) 
    jwt (1.5.6) 
    kgio (2.11.0) 
    libv8 (3.16.14.19) 
    listen (3.1.5) 
     rb-fsevent (~> 0.9, >= 0.9.4) 
     rb-inotify (~> 0.9, >= 0.9.7) 
     ruby_dep (~> 1.2) 
    loofah (2.0.3) 
     nokogiri (>= 1.5.9) 
    lumberjack (1.0.12) 
    mail (2.6.6) 
     mime-types (>= 1.16, < 4) 
    method_source (0.8.2) 
    mime-types (3.1) 
     mime-types-data (~> 3.2015) 
    mime-types-data (3.2016.0521) 
    mimemagic (0.3.2) 
    mini_portile2 (2.2.0) 
    minitest (5.10.2) 
    minitest-reporters (1.1.9) 
     ansi 
     builder 
     minitest (>= 5.0) 
     ruby-progressbar 
    multi_json (1.12.1) 
    multi_xml (0.6.0) 
    multipart-post (2.0.0) 
    nenv (0.3.0) 
    net-scp (1.2.1) 
     net-ssh (>= 2.6.5) 
    net-ssh (4.1.0) 
    netrc (0.11.0) 
    nio4r (2.1.0) 
    nokogiri (1.8.0) 
     mini_portile2 (~> 2.2.0) 
    notiffany (0.1.1) 
     nenv (~> 0.1) 
     shellany (~> 0.0) 
    oauth (0.5.3) 
    oauth2 (1.4.0) 
     faraday (>= 0.8, < 0.13) 
     jwt (~> 1.0) 
     multi_json (~> 1.3) 
     multi_xml (~> 0.5) 
     rack (>= 1.2, < 3) 
    omniauth (1.6.1) 
     hashie (>= 3.4.6, < 3.6.0) 
     rack (>= 1.6.2, < 3) 
    omniauth-facebook (4.0.0) 
     omniauth-oauth2 (~> 1.2) 
    omniauth-google-oauth2 (0.5.0) 
     jwt (~> 1.5) 
     multi_json (~> 1.3) 
     omniauth (>= 1.1.1) 
     omniauth-oauth2 (>= 1.3.1) 
    omniauth-oauth (1.1.0) 
     oauth 
     omniauth (~> 1.0) 
    omniauth-oauth2 (1.4.0) 
     oauth2 (~> 1.0) 
     omniauth (~> 1.2) 
    omniauth-twitter (1.4.0) 
     omniauth-oauth (~> 1.1) 
     rack 
    orm_adapter (0.5.0) 
    paperclip (5.1.0) 
     activemodel (>= 4.2.0) 
     activesupport (>= 4.2.0) 
     cocaine (~> 0.5.5) 
     mime-types 
     mimemagic (~> 0.3.0) 
    payjp (0.0.5) 
     rest-client (~> 2.0) 
    pg (0.18.4) 
    polyamorous (1.3.1) 
     activerecord (>= 3.0) 
    private_pub (1.0.3) 
     faye 
    pry (0.10.4) 
     coderay (~> 1.1.0) 
     method_source (~> 0.8.1) 
     slop (~> 3.4) 
    public_suffix (2.0.5) 
    puma (3.4.0) 
    rack (2.0.3) 
    rack-mini-profiler (0.10.5) 
     rack (>= 1.2.0) 
    rack-test (0.6.3) 
     rack (>= 1.0) 
    rails (5.0.3) 
     actioncable (= 5.0.3) 
     actionmailer (= 5.0.3) 
     actionpack (= 5.0.3) 
     actionview (= 5.0.3) 
     activejob (= 5.0.3) 
     activemodel (= 5.0.3) 
     activerecord (= 5.0.3) 
     activesupport (= 5.0.3) 
     bundler (>= 1.3.0, < 2.0) 
     railties (= 5.0.3) 
     sprockets-rails (>= 2.0.0) 
    rails-controller-testing (0.1.1) 
     actionpack (~> 5.x) 
     actionview (~> 5.x) 
     activesupport (~> 5.x) 
    rails-dom-testing (2.0.3) 
     activesupport (>= 4.2.0) 
     nokogiri (>= 1.6) 
    rails-html-sanitizer (1.0.3) 
     loofah (~> 2.0) 
    rails-i18n (5.0.4) 
     i18n (~> 0.7) 
     railties (~> 5.0) 
    rails_12factor (0.0.3) 
     rails_serve_static_assets 
     rails_stdout_logging 
    rails_serve_static_assets (0.0.5) 
    rails_stdout_logging (0.0.5) 
    railties (5.0.3) 
     actionpack (= 5.0.3) 
     activesupport (= 5.0.3) 
     method_source 
     rake (>= 0.8.7) 
     thor (>= 0.18.1, < 2.0) 
    raindrops (0.18.0) 
    rake (12.0.0) 
    ransack (1.8.3) 
     actionpack (>= 3.0) 
     activerecord (>= 3.0) 
     activesupport (>= 3.0) 
     i18n 
     polyamorous (~> 1.3) 
    rb-fsevent (0.10.2) 
    rb-inotify (0.9.10) 
     ffi (>= 0.5.0, < 2) 
    rb-readline (0.5.4) 
    ref (2.0.0) 
    responders (2.4.0) 
     actionpack (>= 4.2.0, < 5.3) 
     railties (>= 4.2.0, < 5.3) 
    rest-client (2.0.2) 
     http-cookie (>= 1.0.2, < 2.0) 
     mime-types (>= 1.16, < 4.0) 
     netrc (~> 0.8) 
    rmagick (2.16.0) 
    ruby-progressbar (1.8.1) 
    ruby_dep (1.5.0) 
    sass (3.5.1) 
     sass-listen (~> 4.0.0) 
    sass-listen (4.0.0) 
     rb-fsevent (~> 0.9, >= 0.9.4) 
     rb-inotify (~> 0.9, >= 0.9.7) 
    sass-rails (5.0.6) 
     railties (>= 4.0.0, < 6) 
     sass (~> 3.1) 
     sprockets (>= 2.8, < 4.0) 
     sprockets-rails (>= 2.0, < 4.0) 
     tilt (>= 1.1, < 3) 
    shellany (0.0.1) 
    slop (3.6.0) 
    spring (1.7.2) 
    spring-watcher-listen (2.0.0) 
     listen (>= 2.7, < 4.0) 
     spring (~> 1.2) 
    sprockets (3.7.1) 
     concurrent-ruby (~> 1.0) 
     rack (> 1, < 3) 
    sprockets-rails (3.2.0) 
     actionpack (>= 4.0) 
     activesupport (>= 4.0) 
     sprockets (>= 3.0.0) 
    sqlite3 (1.3.13) 
    sshkit (1.14.0) 
     net-scp (>= 1.1.2) 
     net-ssh (>= 2.8.0) 
    therubyracer (0.12.3) 
     libv8 (~> 3.16.14.15) 
     ref 
    thin (1.7.2) 
     daemons (~> 1.0, >= 1.0.9) 
     eventmachine (~> 1.0, >= 1.0.4) 
     rack (>= 1, < 3) 
    thor (0.19.4) 
    thread_safe (0.3.6) 
    tilt (2.0.7) 
    toastr-rails (1.0.3) 
     railties (>= 3.1.0) 
    turbolinks (5.0.1) 
     turbolinks-source (~> 5) 
    turbolinks-source (5.0.3) 
    tzinfo (1.2.3) 
     thread_safe (~> 0.1) 
    uglifier (3.0.0) 
     execjs (>= 0.3.0, < 3) 
    unf (0.1.4) 
     unf_ext 
    unf_ext (0.0.7.4) 
    unicorn (5.3.0) 
     kgio (~> 2.6) 
     raindrops (~> 0.7) 
    warden (1.2.7) 
     rack (>= 1.0) 
    web-console (3.1.1) 
     activemodel (>= 4.2) 
     debug_inspector 
     railties (>= 4.2) 
    websocket-driver (0.6.5) 
     websocket-extensions (>= 0.1.0) 
    websocket-extensions (0.1.2) 
    will_paginate (3.1.0) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    bootstrap-sass (~> 3.3.6) 
    bootstrap-will_paginate (= 0.0.10) 
    capistrano (~> 3.6) 
    capistrano-bundler 
    capistrano-passenger 
    capistrano-rails (~> 1.3) 
    capistrano-rbenv 
    capistrano-safe-deploy-to 
    capistrano3-unicorn 
    carrierwave 
    coffee-rails (= 4.2.1) 
    devise 
    font-awesome-rails 
    font-awesome-sass 
    geocoder 
    guard (= 2.13.0) 
    guard-minitest (= 2.4.4) 
    jbuilder (= 2.4.1) 
    jquery-rails (= 4.1.1) 
    jquery-ui-rails (= 5.0.5) 
    listen (~> 3.1.5) 
    minitest-reporters (= 1.1.9) 
    omniauth 
    omniauth-facebook 
    omniauth-google-oauth2 
    omniauth-twitter 
    paperclip 
    payjp 
    pg (= 0.18.4) 
    private_pub 
    puma (= 3.4.0) 
    rack-mini-profiler 
    rails (= 5.0.3) 
    rails-controller-testing (= 0.1.1) 
    rails-i18n 
    rails_12factor 
    ransack 
    rb-readline 
    rmagick 
    sass-rails (>= 3.2) 
    spring (= 1.7.2) 
    spring-watcher-listen (= 2.0.0) 
    sqlite3 (= 1.3.13) 
    therubyracer 
    thin 
    toastr-rails 
    turbolinks (= 5.0.1) 
    uglifier (= 3.0.0) 
    unicorn 
    web-console (= 3.1.1) 
    will_paginate (= 3.1.0) 

BUNDLED WITH 
    1.15.1 

我Capfile

require 'capistrano/setup' 
require 'capistrano/deploy' 
require "capistrano/scm/git" 
install_plugin Capistrano::SCM::Git 
require 'capistrano/rbenv' 
set :rbenv_type, :user 
set :rbenv_ruby, '2.4.1' 
require 'capistrano/bundler' 
require 'capistrano3/unicorn' 
require 'capistrano/rails' 
require 'capistrano/rails/assets' 
require 'capistrano/rails/migrations' 
require 'capistrano/safe_deploy_to' 
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } 

回答

0

據報失蹤的寶石都是開發和測試組的寶石。所有其他寶石都在那裏。

0

您可以檢查capistrano bundler,因爲這在生產服務器不會在你的開發寶石文件,你也應該在你的生產安裝gemfiles,因爲使用Capistrano部署,那麼你必須在你的Capfile

require 'capistrano/bundler' 

包括與此命令Capistrano將在部署期間在生產服務器上運行軟件包安裝。

+0

謝謝你的建議,但我的Capfile擁有它。 – Tayo0620

+0

我添加了我的capfile到我的問題。 – Tayo0620

+0

你有沒有運行cap production bundler:install? – widjajayd

0

我不認爲還有什麼可以安裝的。

capistrano-bundler首先檢查是否有任何寶石丟失。這就是爲什麼你看到「下面的寶石丟失」的消息。然後它自動繼續安裝這些缺失的寶石。

如果您第二次部署,則不應該看到「缺失」消息,因爲現在已安裝所有寶石。

+0

感謝您的建議,馬特。但是當我再次部署時,我看到「下面的寶石丟失」信息...爲什麼? – Tayo0620

+0

對不起,我不知道。我想這可能會發生,如果你沒有使用':bundle_path'的共享位置。但是,如果您使用的是默認設置,那永遠不應該是一個問題。 –

+0

感謝您的評論。我非常抱歉,但是,你會告訴我如何使用默認設置進行檢查嗎?我可能改變了這一點,但我不知道。 – Tayo0620