Capistrano 3, Rails 4, database configuration does not specify adapter

前端 未结 6 959
半阙折子戏
半阙折子戏 2020-12-24 14:47

When I start

cap production deploy

it fails like this:

DEBUG [4ee8fa7a] Command: cd /home/deploy/myapp/releases/         


        
6条回答
  •  太阳男子
    2020-12-24 15:20

    Seems to be a bug in capistrano-rails.

    There is a task (rails.rake) that sets the environment either from rails_env or stage:

    namespace :deploy do
      before :starting, :set_rails_env do
        set :rails_env, (fetch(:rails_env) || fetch(:stage))
      end
    end
    

    But this task isn't called before i.e. assets:precompile. So this:

    namespace :assets do
      task :precompile do
        on roles :web do
          within release_path do
            with rails_env: fetch(:rails_env) do
              execute :rake, "assets:precompile"
            end
          end
        end
      end
    end
    

    fails because rails_env is nil if it isn't set explicitly.

    If I have the time to dig a little deeper I'll file a bug report.

提交回复
热议问题