2017-11-28 31 views
1

mina gemを使用してレールアプリケーションをデジタル海洋に展開しようとしていますか?私はすべての設定を行い、minaの設定も適切に実行されています。mina deploy throwsエラー - バンドル:コマンドが見つかりません!エラー:展開に失敗しました

mina deploy throwsエラー。どんな助けでも大歓迎です。ここで

はミナが展開され

[email protected]:/home/rails/rails-demo# mina deploy --trace 
** Invoke deploy (first_time) 
** Execute deploy 
** Invoke remote_environment (first_time) 
** Execute remote_environment 
** Invoke git:clone (first_time) 
** Execute git:clone 
** Invoke deploy:link_shared_paths (first_time) 
** Execute deploy:link_shared_paths 
** Invoke bundle:install (first_time) 
** Execute bundle:install 
** Invoke rails:db_migrate (first_time) 
** Execute rails:db_migrate 
** Invoke rails:assets_precompile (first_time) 
** Execute rails:assets_precompile 
** Invoke deploy:cleanup (first_time) 
** Execute deploy:cleanup 
** Invoke puma:phased_restart (first_time) 
** Invoke remote_environment (first_time) 
** Execute remote_environment 
** Execute puma:phased_restart 
[email protected]'s password: 
-----> Creating a temporary build path 
-----> Deploying rails-demo to 139.59.72.156:/home/rails/rails-demo 
-----> Fetching new git commits 
     remote: Counting objects: 43, done. 
remote: Compressing objects: 100% (33/33), done. 
remote: Total 43 (delta 6), reused 43 (delta 6), pack-reused 0 
Unpacking objects: 100% (43/43), done. 
     From github.com:krishnateja/rails-demo 
      739096a..4cf74f8 master  -> master 
-----> Using git branch 'master' 
     Cloning into '.'... 
     done. 
-----> Using this git commit 
     root (4cf74f8): 
     > small config change 
-----> Symlinking shared paths 
-----> Installing gem dependencies using Bundler 
     bash: line 137: bundle: command not found 
!  ERROR: Deploy failed. 
-----> Cleaning up build 
     Unlinking current 
     OK 
     Connection to 139.59.72.156 closed. 

!  Run Error 

deploy.rb

require 'mina/bundler' 
require 'mina/rails' 
require 'mina/git' 
require 'mina/rvm' 
require 'mina/puma' 

set :application_name, 'rails-demo' 
set :domain, '139.59.72.156' 
set :deploy_to, '/home/rails/rails-demo' 
set :repository, '[email protected]:krishnateja/rails-demo.git' 

set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/pids', 'tmp/sockets', 'public/uploads') 
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml', 'config/puma.rb') 
set :user, 'root' 

task :environment do 
    invoke :'rvm:use', 'ruby-2.2.3' 
end 

task :setup do 
    command %[touch "#{fetch(:shared_path)}/config/database.yml"] 
    command %[touch "#{fetch(:shared_path)}/config/secrets.yml"] 
    command %[touch "#{fetch(:shared_path)}/config/puma.rb"] 
    comment "Be sure to edit '#{fetch(:shared_path)}/config/database.yml', 'secrets.yml' and puma.rb." 
end 

task :deploy do 
    deploy do 
    comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}" 
    invoke :'git:clone' 
    invoke :'deploy:link_shared_paths' 
    invoke :'bundle:install' 
    invoke :'rails:db_migrate' 
    invoke :'rails:assets_precompile' 
    invoke :'deploy:cleanup' 

    on :launch do 
     invoke :'puma:phased_restart' 
    end 
    end 

end 

puma.rb

environment "production" 

bind "unix:///home/rails/rails-demo/shared/tmp/sockets/puma.sock" 
pidfile "/home/rails/rails-demo/shared/tmp/pids/puma.pid" 
state_path "/home/rails/rails-demo/shared/tmp/sockets/puma.state" 
directory "/home/rails/rails-demo/current" 

workers 2 
threads 1,2 

daemonize true 

activate_control_app 'unix:///home/rails/rails-demo/shared/tmp/sockets/pumactl.sock' 

prune_bundler 

--trace私にその何かを感じたいくつかの方法executaへの道を行くそれで、これを行った。 gem環境 - これを与える。

[email protected]:/home/rails/rails-demo# gem environment 
RubyGems Environment: 
    - RUBYGEMS VERSION: 2.6.14 
    - RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-linux] 
    - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.2.3 
    - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.2.0 
    - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.2.3/bin/ruby 
    - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.2.3/bin 
    - SPEC CACHE DIRECTORY: /root/.gem/specs 
    - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.2.3/etc 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86_64-linux 
    - GEM PATHS: 
    - /usr/local/rvm/gems/ruby-2.2.3 
    - /usr/local/rvm/gems/[email protected] 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - REMOTE SOURCES: 
    - https://rubygems.org/ 
    - SHELL PATH: 
    - /usr/local/rvm/gems/ruby-2.2.3/bin 
    - /usr/local/rvm/gems/[email protected]/bin 
    - /usr/local/rvm/rubies/ruby-2.2.3/bin 
    - /usr/local/rvm/bin 
    - /usr/local/sbin 
    - /usr/local/bin 
    - /usr/sbin 
    - /usr/bin 
    - /sbin 
    - /bin 
    - /usr/games 
    - /usr/local/games 
    - /snap/bin 

パスにEXECUTABLE DIRECTORYを追加しました。

[email protected]:/home/rails/rails-demo# export PATH=$PATH:/usr/local/rvm/gems/ruby-2.2.3/bin 
[email protected]:/home/rails/rails-demo# echo $PATH 
/usr/local/rvm/gems/ruby-2.2.3/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-2.2.3/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/rvm/gems/ruby-2.2.3/bin 
+1

この特定のツールセットではちょっと錆びますが、 'bundle install:install(first_time)'は 'bundle install'を実行する前に' gem install bundler'する必要があります。 –

+0

バンドルがサーバーマシンにインストールされていることを確認してください。 'bundle -v'コマンドを使ってそれが正しいことを確認してください。 –

+0

@ MaximPontyushenko Bundlerがインストールされています。 mina gemを設定する過程で、すべてのgemをvpsにインストールできます。コマンド「mina deploy」を入力すると、上記の質問に記載されているタスクが1つずつ実行されます。その後、エラーを取得しています。これはバーンダーバージョン 'Bundler version 1.16.0'です –

答えて

0

Bundlerは、サーバーマシン(展開先のマシン)にインストールする必要があります。最も簡単な方法は、sshでログインしてgem install bundlerを一度実行することです。 official mina FAQ

+0

あなたは私のポイントを見失っています。上記の私のコメントをチェックしてください。 –

0

私もこの問題を抱えていますが、私の起動タスクを別のタスクに移動することで回避できます。だから、

task :deploy do 
    deploy do 
    comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}" 
    invoke :'git:clone' 
    invoke :'deploy:link_shared_paths' 
    invoke :'bundle:install' 
    invoke :'rails:db_migrate' 
    invoke :'rails:assets_precompile' 
    invoke :'deploy:cleanup' 
    end 
end 

task :launch do 
    invoke :'puma:phased_restart' 
end 

task :deploy do 
    deploy do 
    comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}" 
    invoke :'git:clone' 
    invoke :'deploy:link_shared_paths' 
    invoke :'bundle:install' 
    invoke :'rails:db_migrate' 
    invoke :'rails:assets_precompile' 
    invoke :'deploy:cleanup' 

    on :launch do 
     invoke :'puma:phased_restart' 
    end 
    end 

end 

を回すことによってこれを行うことができます。そして(確かに、次善である)別にそれを実行します。

$ mina deploy 
$ mina launch 

私はあなたの詳細を知りません私のように設定します。

task :launch => :remote_environment do 
    in_path(fetch(:current_path)) do 
    invoke :'my:task' 
    end 
end 

これは解決策や説明ではありませんが、うまくいけば助かります。