Capistrano部署后,Rails 4不会检测到应用程序 [英] Rails 4 doesn't detect application after capistrano deployment
本文介绍了Capistrano部署后,Rails 4不会检测到应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在尝试使用Capistrano 3部署Rails 4应用程序。一切进展顺利,但是我遇到了问题,是的!我无法在我的应用程序中运行任何Rails命令。
I'm currently trying to deploy a Rails 4 app using Capistrano 3. All going smoothly but I've got an issue, yeah ! I can't run any rails commands in my app.
这是我相关的capistrano插件:
Here is my related capistrano plugins :
gem 'capistrano-rails'
gem 'capistrano-unicorn-nginx'
gem 'capistrano-rbenv'
gem 'capistrano-secrets-yml'
gem 'capistrano-rails-console'
所以当我运行 cap production rails:console
它给了我这个输出:
So when I run a cap production rails:console
it give me this output:
[b2458a1e] Running /usr/bin/env [ -d ~/.rbenv/versions/2.1.1 ] as user@x.x.x.x
DEBUG [b2458a1e] Command: [ -d ~/.rbenv/versions/2.1.1 ]
DEBUG [b2458a1e] Finished in 0.528 seconds with exit status 0 (successful).
INFO [2d552562] Running ~/.rbenv/bin/rbenv exec bundle exec rails console production as user@x.x.x.x
DEBUG [2d552562] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.1 ~/.rbenv/bin/rbenv exec bundle exec rails console production )
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /home/rails_app/.rbenv/versions/2.1.1/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
[--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/ frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
# Default: jquery
-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
[--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
[--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
-T, [--skip-test-unit], [--no-skip-test-unit] # Skip Test::Unit files
[--rc=RC]
任何想法吗?
更新13/03-添加deploy.rb
# config valid only for current version of Capistrano
lock '3.3.5'
set :application, 'my_app'
set :repo_url, 'git@github.com:foo/my_app.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
set :branch, 'master'
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/var/www/my_app'
# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('config/database.yml')
# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('bin', 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
set :rbenv_ruby, '2.1.1'
推荐答案
我认为问题在于您缺少 bin / rails
在您的Rails应用程序的已部署副本中。这就是我要做的事情:
I think the problem is that you are missing bin/rails
in the deployed copy of your Rails app. Here's what I would do:
- 确保
bin
目录的内容是添加,提交并推送到您的git存储库。这将包括bin / rails
和bin / rake
。 - 从Capistrano的
:linked_dirs
设置中的deploy.rb <中删除
bin
/ code>。 - 重新部署。
- Make sure the contents of your
bin
directory are added, committed, and pushed to your git repository. This will includebin/rails
andbin/rake
. - Remove
bin
from Capistrano's:linked_dirs
setting in yourdeploy.rb
. - Re-deploy.
这篇关于Capistrano部署后,Rails 4不会检测到应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文