gpt4 book ai didi

ruby-on-rails - 部署 capistrano 后,Rails 4 未检测到应用程序

转载 作者:行者123 更新时间:2023-12-04 06:12:19 25 4
gpt4 key购买 nike

我目前正在尝试使用 Capistrano 3 部署 Rails 4 应用程序。一切顺利,但我遇到了一个问题,是的!我无法在我的应用程序中运行任何 rails 命令。

这是我相关的 capistrano 插件:

gem 'capistrano-rails'
gem 'capistrano-unicorn-nginx'
gem 'capistrano-rbenv'
gem 'capistrano-secrets-yml'
gem 'capistrano-rails-console'

所以当我运行 cap production rails:console它给了我这个输出:
    [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 应用程序的已部署副本中。这是我会做的:

  • 确保您的 bin 的内容目录被添加、提交并推送到您的 git 存储库。这将包括 bin/railsbin/rake .
  • 删除 bin来自 Capistrano 的 :linked_dirs在您的 deploy.rb 中设置.
  • 重新部署。
  • 关于ruby-on-rails - 部署 capistrano 后,Rails 4 未检测到应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29039927/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com