Я пытаюсь развернуть мое приложение rails, используя capistrano
, но после db:migrate
я получаю
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate
01 rake aborted!
01 KeyError: Cannot load database configuration:
01 key not found: "APP_DATABASE_PASSWORD"
01 (erb):54:in `fetch'
01 (erb):54:in `<main>'
01 /home/deploy/app/shared/bundle/ruby/2.6.0/gems/railties-6.0.2.1/lib/rails/application/configuration.rb:228:in `database_configuration'
01 /home/deploy/app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/railtie.rb:39:in `block (3 levels) in <class:Railti…
01 /home/deploy/app/shared/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
01 /home/deploy/.rbenv/versions/2.6.3/bin/bundle:23:in `load'
01 /home/deploy/.rbenv/versions/2.6.3/bin/bundle:23:in `<main>'
Однако у меня уже установлено APP_DATABASE_PASSWORD
в моем файле .bashr c и оно уже получено это.
Вот мой database.yml
:
default: &default
adapter: mysql2
encoding: utf8mb4
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: <%= ENV.fetch("APP_DATABASE_USERNAME") %>
password: <%= ENV.fetch("APP_DATABASE_PASSWORD") %>
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
database: app_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: app_test
production:
<<: *default
database: app_production
username: app
password: <%= ENV.fetch("APP_DATABASE_PASSWORD") %>
По моему .bashrc
:
export APP_DATABASE_PASSWORD="SOME_PASSWORD"
export APP_DATABASE_USERNAME="SOME_USERNAME"