I need to create rails app with nginx and puma. I followed this guide: https://www.codeflow.site/fr/article/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04.
but this line doesn’t work as expected:
RAILS_ENV=production rake db:create
it drops the following error:
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
no implicit conversion of nil into String
Couldn't create '' database. Please check your configuration.
rake aborted!
TypeError: no implicit conversion of nil into String
[...]
Tasks: TOP => db:create
Here is the content of my database.yml file:
# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# 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: db/test.sqlite3
production:
<<: *default
host: localhost
adapter: postgresql
encoding: utf8
database:
pool: 5
username: user
password: mdp
2
Answers
can you check config/database.yml file
production
database
nameMust be this way
All environments must use same database adapter
Sample database.yml file for PostgreSQL. Can you check configuration for this