mercredi 9 novembre 2016

Capistrano cap production deploy fails on migration but cap production deploy:migrate passes

I've come across a strange problem with Capistrano while getting a production server ready. When I run cap production deploy, it always fails on the deploy:migrate step with

ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["defaul…

Yet, when I run cap production deploy:migrate, Capistrano completes successfully.

On the actual server, I am able to run RAILS_ENV=production bundle exec rake:migrate without any problems either.

The Capistrano log spits out the same command for both:

[deploy:migrate] Run rake db:migrate

My database config looks like this:

production:
  adapter: mysql2
  encoding: utf8
  database: foo
  host: localhost
  pool: 5
  timeout: 5000
  username: bar
  password: password
  socket: /opt/bitnami/mysql/tmp/mysql.sock

I should also mention that I have set the rails env in my deploy.rb like so: set :rails_env, :production

Here is the relevent information in my gemfile:

gem 'mysql2', '~> 0.4.5'
group :development do
  gem 'capistrano', '~> 3.6', '>= 3.6.1'
  gem 'capistrano-rvm'
  gem 'capistrano-bundler'
  gem 'capistrano-rails'
  gem 'capistrano-passenger'
end

Can anyone shed some light on what I am missing here? I am new to Capistrano.

Aucun commentaire:

Enregistrer un commentaire