ManageIQ / manageiq-appliance

System files for the ManageIQ appliance.
Apache License 2.0
7 stars 50 forks source link

Set sensible psql host/port defaults or let psql do it. #367

Closed jrafanie closed 2 years ago

jrafanie commented 2 years ago

This PR will let psql handle missing host/port/password values. For our ncat call, we previously defaulted a missing port to 5432. We now do the same for host and default to localhost.

This should resolve an issue where database.yml didn't have a host field and we'd see this in the journalctl:

Before

Sep 01 12:15:29 localhost.localdomain systemd[1]: Starting ManageIQ DB Ready...
Sep 01 12:15:29 localhost.localdomain manageiq-db-ready[6804]:   - not accepting connections
Sep 01 12:15:39 localhost.localdomain manageiq-db-ready[6804]:   - not accepting connections
Sep 01 12:15:49 localhost.localdomain manageiq-db-ready[6804]:   - not accepting connections
Sep 01 12:15:59 localhost.localdomain manageiq-db-ready[6804]:   - not accepting connections
Sep 01 12:16:09 localhost.localdomain manageiq-db-ready[6804]:   - not accepting connections

After

Sep 15 16:39:30 *** systemd[1]: Starting ManageIQ DB Ready...
Sep 15 16:39:30 *** manageiq-db-ready[59889]: localhost 5432 - accepting connections
Sep 15 16:39:30 *** manageiq-db-ready[59889]: vmdb_production is up and running
Sep 15 16:39:30 *** systemd[1]: manageiq-db-ready.service: Succeeded.
Sep 15 16:39:30 *** systemd[1]: Started ManageIQ DB Ready.
miq-bot commented 2 years ago

Checked commit https://github.com/jrafanie/manageiq-appliance/commit/ce9c0533aa25c29f2bec2e6a5d8f972f54125501 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint 0 files checked, 0 offenses detected Everything looks fine. :star:

jrafanie commented 2 years ago

Verified this manually:

For:

production:
  adapter: postgresql
  encoding: utf8
  username: root
  pool: 5
  wait_timeout: 5
  min_messages: warning
  database: vmdb_production
  password: v2:{qEcSjRYDVMdL7uHjCkvYPw==}

Result:

localhost 5432 - accepting connections
vmdb_production is up and running

For:

production:
  adapter: postgresql
  encoding: utf8
  username: root
  pool: 5
  wait_timeout: 5
  min_messages: warning
  database: vmdb_production
  host: 10.0.2.10
  port: 5432
  password: v2:{qEcSjRYDVMdL7uHjCkvYPw==}

Result:

10.0.2.10 5432 - accepting connections
vmdb_production is up and running
jrafanie commented 2 years ago

I'll just close this if it's not the right surgical fix. 🤷