Connecting rails to postgresql doesn't work anymore since updating from Ubuntu 18.04 to 19.04

0

I get this error:

“could not translate host name ”db“ to address: Name or service not known”

This is my configuration:

default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see Rails configuration guide
  # http://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development: &default
  adapter: postgresql
  database: backbone_data_bootstrap_development
  min_messages: WARNING
  pool: 5
  username: postgres
  host: db

latipah

Posted 2019-09-08T10:24:23.190

Reputation: 1

Answers

0

host: db

db as a name of host needs to be resolved to an IP address, either by /etc/hosts or by the DNS. Or it needs to be replaced by an IP address.

Possibly in your previous installation there was an entry in /etc/hosts that aliased db to an address, and your new installation has now a fresh /etc/hosts.

Daniel Vérité

Posted 2019-09-08T10:24:23.190

Reputation: 1 225