Ruby on rails Mina部署:错误:部署失败

Ruby on rails Mina部署:错误:部署失败,ruby-on-rails,deployment,Ruby On Rails,Deployment,当mina安装程序运行时 $ mina setup -----> Setting up /home/jmuheim/base total 24 drwxr-xr-x 6 jmuheim jmuheim 4096 Mar 26 10:34 . drwx------ 13 jmuheim jmuheim 4096 Mar 25 17:38 .. drwxr-xr-x 2 jmuheim jmuheim 4096

当mina安装程序运行时

$ mina setup
-----> Setting up /home/jmuheim/base        

       total 24 
       drwxr-xr-x  6 jmuheim jmuheim 4096 Mar 26 10:34 . 
       drwx------ 13 jmuheim jmuheim 4096 Mar 25 17:38 .. 
       drwxr-xr-x  2 jmuheim jmuheim 4096 Mar 25 11:48 releases 
       drwxr-xr-x  7 jmuheim jmuheim 4096 Mar 25 11:50 scm 
       drwxr-xr-x  5 jmuheim jmuheim 4096 Mar 25 11:48 shared 
       drwxr-xr-x  2 jmuheim jmuheim 4096 Mar 26 10:34 tmp 

-----> Done.        
-----> Be sure to edit 'shared/config/database.yml'.        
       Elapsed time: 0.00 seconds
mina deploy
导致错误,我不知道问题出在哪里:

$ mina deploy
-----> Creating a temporary build path        
-----> Fetching new git commits        
-----> Using git branch 'master'        
       Initialized empty Git repository in /home/jmuheim/base/tmp/build-13958266858113/.git/ 
-----> Using this git commit        

       Joshua Muheim (0bc8043): 
       > Update outdated gems 

-----> Symlinking shared paths        
-----> Installing gem dependencies using Bundler        
 !     ERROR: Deploy failed.   
-----> Cleaning up build        
       bash: line 79: bundle: command not found
       Unlinking current 
       OK 

 !     Command failed.
       Failed with status 19
似乎找不到
bundle
,但是当手动SSH到服务器时,我看到它肯定在那里:

$ ssh jmuheim@achernar.uberspace.de
Last login: Wed Mar 26 10:39:29 2014 from 187-44.77-83.cust.bluewin.ch
[jmuheim@achernar ~]$ gem list | grep bundler
bundler (1.6.0.rc2)
--verbose
--trace
标志没有提供更多信息:

$ mina deploy --verbose --trace
** Invoke deploy (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute deploy
** 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

-----> Creating a temporary build path
       $ touch "deploy.lock" 
       $ mkdir -p "$build_path" 
       $ cd "$build_path" 

-----> Fetching new git commits
       $ (cd "/home/jmuheim/base/scm" && git fetch "https://github.com/jmuheim/base.git" "master:master" --force) 

-----> Using git branch 'master'
       $ git clone "/home/jmuheim/base/scm" . --recursive --branch "master" 
       Initialized empty Git repository in /home/jmuheim/base/tmp/build-139582683730596/.git/ 

-----> Using this git commit

       $ git --no-pager log --format="%aN (%h):%n> %s" -n 1 
       Joshua Muheim (0bc8043): 
       > Update outdated gems 
       $ rm -rf .git 


-----> Symlinking shared paths
       $ mkdir -p "./config" 
       $ mkdir -p "." 
       $ rm -rf "./config/database.yml" 
       $ ln -s "/home/jmuheim/base/shar       bash: line 97: bundle: command not founde
       $ ln -s "/home/jmuheim/base/shared/config/database.yml" "./config/database.yml"
       $ rm -rf "./log" 
       $ ln -s "/home/jmuheim/base/shared/log" "./log" 

-----> Installing gem dependencies using Bundler
       $ mkdir -p "/home/jmuheim/base/shared/bundle" 
       $ mkdir -p "./vendor" 
       $ ln -s "/home/jmuheim/base/shared/bundle" "./vendor/bundle" 
       $ bundle install --without development:test --path "./vendor/bundle" --binstubs bin/ --deployment 
 !     ERROR: Deploy failed.   

-----> Cleaning up build
       $ rm -rf "$build_path" 
       Unlinking current 
       $ rm -f "deploy.lock" 
       OK 

 !     Command failed.
       Failed with status 19
这是我的
deploy.rb

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
# require 'mina/rvm'    # for rvm support. (http://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

set :domain, 'achernar.uberspace.de'
set :user, 'jmuheim'
set :deploy_to, '/home/jmuheim/base'
set :repository, 'https://github.com/jmuheim/base.git'
set :branch, 'master'

# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'log']

# Optional settings:
#   set :user, 'foobar'    # Username in the server to SSH to.
#   set :port, '30000'     # SSH port number.

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use[ruby-1.9.3-p125@default]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task setup: :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task deploy: :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      queue "touch #{deploy_to}/tmp/restart.txt"
    end
  end
end

# For help in making your deploy script, see the Mina documentation:
#
#  - http://nadarei.co/mina
#  - http://nadarei.co/mina/tasks
#  - http://nadarei.co/mina/settings
#  - http://nadarei.co/mina/helpers

非常感谢您的帮助。

首先,根据您使用的内容取消对mina/rbenv或mina/rvm的注释,然后转到您的环境文件(在Ubuntu中是/etc/environment),并添加以下内容:
导出机架_ENV='environment,例如生产' 导出RAILS_ENV='同上'

然后将ruby环境文件夹添加到同一文件中的路径中,对于rbenv,我会将它们添加到路径中

/usr/lcoal/rbenv/垫片和/usr/local/rbenv/bin

最后,找到文件的源代码


(也不要忘记在部署前安装js运行时,例如sudo apt get install nodejs)

首先,根据您使用的内容取消对mina/rbenv或mina/rvm的注释,然后转到您的环境文件(在Ubuntu中是/etc/environment)并添加以下内容:
导出机架_ENV='environment,例如生产' 导出RAILS_ENV='同上'

然后将ruby环境文件夹添加到同一文件中的路径中,对于rbenv,我会将它们添加到路径中

/usr/lcoal/rbenv/垫片和/usr/local/rbenv/bin

最后,找到文件的源代码

(也不要忘记在部署前安装js运行时,例如sudo apt get install nodejs)

如果使用
rvm/rbenv
,请注意此处的代码


如果您使用
rvm/rbenv
,请注意此处的代码

,谢谢您指出!不知道我怎么会错过。谢谢你指出这一点!不知道我怎么会错过这个。
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use[ruby-2.0.0-p481@default]'
end