Question: Database configuration does not specify adapter (Sinatra + Nginx + Activerecord)

Question

Database configuration does not specify adapter (Sinatra + Nginx + Activerecord)

Answers 0
Added at 2016-12-16 07:12
Tags
Question

I want run migrate with capistrano on production server.

When I call command cap production deploy:migrate get error:

Command: cd /home/deploy/sudoku/current && ( export RACK_ENV="" ; bundle exec rake db:migrate )
 DEBUG [7fadeecc]   rake aborted!
 DEBUG [7fadeecc]   ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
 DEBUG [7fadeecc]   /home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/connection_specification.rb:170:in `spec'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_handling.rb:53:in `establish_connection'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-activerecord-2.0.11/lib/sinatra/activerecord.rb:50:in `database='
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1217:in `set'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-activerecord-2.0.11/lib/sinatra/activerecord.rb:41:in `database_file='
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1217:in `set'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-activerecord-2.0.11/lib/sinatra/activerecord.rb:22:in `registered'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1400:in `block in register'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1398:in `each'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1398:in `register'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1969:in `register'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2030:in `register'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-activerecord-2.0.11/lib/sinatra/activerecord.rb:63:in `<module:Sinatra>'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/sinatra-activerecord-2.0.11/lib/sinatra/activerecord.rb:10:in `<top (required)>'
/home/deploy/sudoku/releases/20161216055930/app.rb:3:in `require'
/home/deploy/sudoku/releases/20161216055930/app.rb:3:in `<top (required)>'
/home/deploy/sudoku/releases/20161216055930/Rakefile:1:in `require'
/home/deploy/sudoku/releases/20161216055930/Rakefile:1:in `<top (required)>'
/home/deploy/sudoku/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
 DEBUG [7fadeecc]   (See full trace by running task with --trace)

On localhost migration are run without errors. This issue only with production deploy. The database settings in the following file:

#config/database.yml
development:
  adapter:   "sqlite3"
  database:  "sudoku_database.sqlite3"  

production:
  adapter:   "sqlite3"
  database:  "../../db/sudoku_database.sqlite3"

Also added to the task config/deploy.rb to start migration:

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  task :migrate do
      on roles(:app) do
        within release_path do
          with rack_env: fetch(:rack_env) do
            execute :rake, "db:migrate"
          end
        end
      end
    end

  #after 'deploy', 'migrate'
  #after :publishing, 'deploy:restart'
  #after :finishing, 'deploy:cleanup'
end
Answers
Source Show
◀ Wstecz