我是第一次使用capistrano部署 . 我跑的时候

上限 生产环境 部署

它在'00:22部署:迁移'中给出以下内容

00:18 bundler:install
      01 $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/akashpinnaka/shared/bundle --without development test --deployment --quiet
    ✔ 01 deploy@139.59.24.82 3.440s
00:21 deploy:migrate
      [deploy:migrate] Run `rake db:migrate`
00:22 deploy:migrating
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate
      01 rake aborted!
      01 ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_…
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required…
      01 /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
      01 /home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
      01 /home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
      01 Tasks: TOP => db:migrate
      01 (See full trace by running task with --trace)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@139.59.24.82: Exception while executing as deploy@139.59.24.82: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

SSHKit::Runner::ExecuteError: Exception while executing as deploy@139.59.24.82: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Tasks: TOP => deploy:migrate
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@139.59.24.82: Exception while executing as deploy@139.59.24.82: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [eb2269e4] Command: if test ! -d /home/deploy/akashpinnaka/releases/20170601050415; then echo "Directory does not exist '/home/deploy/akashpinnaka/releases/20170601050415'" 1>&2; false; fi

 DEBUG [eb2269e4] Finished in 0.200 seconds with exit status 0 (successful).

  INFO [1081d980] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate as deploy@139.59.24.82

 DEBUG [1081d980] Command: cd /home/deploy/akashpinnaka/releases/20170601050415 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.0" RAILS_ENV="production" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate )

 DEBUG [1081d980]       rake aborted!

 DEBUG [1081d980]       ActiveRecord::ConnectionNotEstablished: No connection pool with id primary found.

 DEBUG [1081d980]       /home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:128:in `retrieve_connection'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:91:in `connection'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1118:in `initialize'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `new'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:1006:in `up'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/migration.rb:984:in `migrate'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:163:in `migrate'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'

/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'

/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'

/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'

 DEBUG [1081d980]       Tasks: TOP => db:migrate

 DEBUG [1081d980]       (See full trace by running task with --trace)

我尝试搜索goole,但注意似乎与迁移问题有关 .

我在数字海洋液滴中的database.yml . (/home/deploy/akashpinnaka/shared/config/database.yml)

production:
  adapter: mysql2
  encoding: utf8
  pool: 5
  timeout: 5000
  host: 127.0.0.0
  port: 3306
  database: akashpinnaka_website_production
  username: akash
  password: password

的Gemfile

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.0.3'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bcrypt', '~> 3.1.7'
gem 'paperclip', '~> 5.1'
gem 'tinymce-rails', '~> 4.5', '>= 4.5.7'
gem 'aws-sdk', '~> 2.9', '>= 2.9.25'
gem 'friendly_id', '~> 5.2', '>= 5.2.1'
gem 'mysql2'

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'

  gem 'capistrano', '~> 3.7', '>= 3.7.1'
  gem 'capistrano-rails', '~> 1.2'
  gem 'capistrano-passenger', '~> 0.2.0'
  gem 'capistrano-rbenv', '~> 2.1'
end

group :production do
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Capfile

require "capistrano/setup"
require "capistrano/deploy"
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
require 'capistrano/passenger'
require 'capistrano/rbenv'
set :rbenv_type, :user
set :rbenv_ruby, '2.4.0'
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

配置/ deploy.rb

lock "3.8.1"

set :application, "akashpinnaka"
set :repo_url, "git@github.com:akashpinnaka/akashpinnaka_me_do.git"
set :deploy_to, "/home/deploy/akashpinnaka"

append :linked_files, "config/database.yml", "config/secrets.yml"
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle", "public/system", "public/uploads"

配置/部署/ production.rb

set :stage, :production
server '139.59.24.82', user: 'deploy', roles: %w{app db web}

当我在 生产环境 服务器上运行rake db:create时 . 我收到以下错误

deploy@akashpinnaka:~/akashpinnaka/releases/20170601043705$ rake db:create
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:2: warning: already initialized constant Rake::VERSION
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:2: warning: previous definition of VERSION was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::MAJOR
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: previous definition of MAJOR was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::MINOR
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: previous definition of MINOR was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::BUILD
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: previous definition of BUILD was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::OTHER
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:5: warning: previous definition of OTHER was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:7: warning: already initialized constant Rake::Version::NUMBERS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/version.rb:7: warning: previous definition of NUMBERS was here
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/linked_list.rb:109: warning: already initialized constant Rake::LinkedList::EMPTY
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/linked_list.rb:109: warning: previous definition of EMPTY was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/scope.rb:40: warning: already initialized constant Rake::Scope::EMPTY
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/scope.rb:40: warning: previous definition of EMPTY was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_utils.rb:9: warning: already initialized constant FileUtils::RUBY
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_utils.rb:9: warning: previous definition of RUBY was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_utils.rb:108: warning: already initialized constant FileUtils::LN_SUPPORTED
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_utils.rb:108: warning: previous definition of LN_SUPPORTED was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_utils_ext.rb:16: warning: already initialized constant Rake::FileUtilsExt::DEFAULT
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_utils_ext.rb:16: warning: previous definition of DEFAULT was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:43: warning: already initialized constant Rake::FileList::ARRAY_METHODS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:43: warning: previous definition of ARRAY_METHODS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:46: warning: already initialized constant Rake::FileList::MUST_DEFINE
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:46: warning: previous definition of MUST_DEFINE was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:50: warning: already initialized constant Rake::FileList::MUST_NOT_DEFINE
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:50: warning: previous definition of MUST_NOT_DEFINE was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:54: warning: already initialized constant Rake::FileList::SPECIAL_RETURN
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:54: warning: previous definition of SPECIAL_RETURN was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:60: warning: already initialized constant Rake::FileList::DELEGATING_METHODS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:60: warning: previous definition of DELEGATING_METHODS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:85: warning: already initialized constant Rake::FileList::GLOB_PATTERN
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:85: warning: previous definition of GLOB_PATTERN was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:380: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PATTERNS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:380: warning: previous definition of DEFAULT_IGNORE_PATTERNS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:386: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PROCS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb:386: warning: previous definition of DEFAULT_IGNORE_PROCS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/promise.rb:11: warning: already initialized constant Rake::Promise::NOT_SET
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/promise.rb:11: warning: previous definition of NOT_SET was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:12: warning: already initialized constant Rake::CommandLineOptionError
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:12: warning: previous definition of CommandLineOptionError was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:40: warning: already initialized constant Rake::Application::DEFAULT_RAKEFILES
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:40: warning: previous definition of DEFAULT_RAKEFILES was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task_arguments.rb:107: warning: already initialized constant Rake::EMPTY_TASK_ARGS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task_arguments.rb:107: warning: previous definition of EMPTY_TASK_ARGS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/invocation_chain.rb:54: warning: already initialized constant Rake::InvocationChain::EMPTY
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/invocation_chain.rb:54: warning: previous definition of EMPTY was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/early_time.rb:20: warning: already initialized constant Rake::EARLY
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/early_time.rb:20: warning: previous definition of EARLY was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/late_time.rb:16: warning: already initialized constant Rake::LATE
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/late_time.rb:16: warning: previous definition of LATE was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:3: warning: already initialized constant Rake::Backtrace::SYS_KEYS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:3: warning: previous definition of SYS_KEYS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:4: warning: already initialized constant Rake::Backtrace::SYS_PATHS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:4: warning: previous definition of SYS_PATHS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:7: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:7: warning: previous definition of SUPPRESSED_PATHS was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:11: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS_RE
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:11: warning: previous definition of SUPPRESSED_PATHS_RE was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:15: warning: already initialized constant Rake::Backtrace::SUPPRESS_PATTERN
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb:15: warning: previous definition of SUPPRESS_PATTERN was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake.rb:69: warning: already initialized constant FileList
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake.rb:69: warning: previous definition of FileList was here
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake.rb:70: warning: already initialized constant RakeFileUtils
/home/deploy/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake.rb:70: warning: previous definition of RakeFileUtils was here
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:236:in `resolve_symbol_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:217:in `resolve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:138:in `resolve'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:168:in `spec'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:53:in `establish_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:131:in `create_current'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:27:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

但是当我在 生产环境 服务器上运行'bundle exec rake db:create'时,我得到了不同的错误 .

deploy@akashpinnaka:~/akashpinnaka/releases/20170601043705$ bundle exec rake db:create
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:236:in `resolve_symbol_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:217:in `resolve_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:138:in `resolve'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_adapters/connection_specification.rb:168:in `spec'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/connection_handling.rb:53:in `establish_connection'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/tasks/database_tasks.rb:131:in `create_current'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.3/lib/active_record/railties/databases.rake:27:in `block (2 levels) in <top (required)>'
/home/deploy/akashpinnaka/shared/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

我通过添加开发配置更改了 生产环境 服务器中的database.yml,并在'bundle exec rake db:create'时更改了另一个错误

deploy@akashpinnaka:~/akashpinnaka/releases/20170601052938$ bundle exec rake db:create
#<Mysql2::Error: Can't connect to MySQL server on '139.59.24.82' (111)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "timeout"=>5000, "host"=>"139.59.24.82", "port"=>3306, "database"=>"akashpinnaka_website_development", "username"=>"akash", "password"=>"admin"}, {:charset=>"utf8"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'akashpinnaka_website_development'

提前致谢!