David Cantu
David Cantu

Reputation: 81

Configure postgresql on database.yml

I have an rails web app running on heroku. In my heroku website dashboard it says my app is running on postgresql, but my database.yml says its running on sqlite3

default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3

And this is my gem file

group :development do
  gem 'sqlite3'
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :production do
  gem 'pg'
end

I want to make the adpater postgresql for production so i can change RAILS_MAX_THREADS to 25.

Im not sure if changing this can erase my production database so I asking your help on how to fix this.

Upvotes: 0

Views: 2780

Answers (2)

Siri Bunnamon
Siri Bunnamon

Reputation: 116

In your database.yml You have to configure a production env

production:
  adapter: postgresql
  encoding: unicode
  database: db_name
  pool: 5
  username: db_user
  password: db_pass

Upvotes: 1

NM Pennypacker
NM Pennypacker

Reputation: 6952

Looks like you haven't configured a production database.

production:
  adapter: postgresql
  database: your_database
  user: your_user
  password: your_password
  pool: 5

You should save the database user and password in environment variables. You may find this documentation helpful: https://devcenter.heroku.com/articles/getting-started-with-rails5#add-the-pg-gem

Upvotes: 0

Related Questions