Mina Deployment那些坑

./bin/rails is a stub that was generated by Bundler

Rails 4之后,在Mina发布的Rails程序中使用rails console production,出现提示:

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables
  git add bin                   # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

  bundle binstubs some-gem-name
  git add bin/new-executable

Loading production environment (Rails 4.0.3)

解决的方法是在deploy.rb中加入:

set :bundle_options, lambda { %{--without development:test --path "#{bundle_path}" --deployment} }

首次发布,git clone时候提示Host verfication fail

需要将term_mode设置为system,确保在本地可以获取远程服务器的yes/no提示。

set :term_mode, :system # this make sure that we get the prompt for yes/no

自定义的task运行时候提示bundle not found

需要加入=> :environment

task my_task => :environment do
  queue 'bundle exec ...'
end