Skip to content

Instantly share code, notes, and snippets.

@raprasad
Last active January 16, 2021 17:06
Show Gist options
  • Save raprasad/0bb709308d26ceca844f89f89861f147 to your computer and use it in GitHub Desktop.
Save raprasad/0bb709308d26ceca844f89f89861f147 to your computer and use it in GitHub Desktop.
Postgres: Update pg_hba.conf for Static IP

Find pg_hba.conf file location

bash-4.1$ psql
psql (8.4.20)
Type "help" for help.

postgres=# SHOW hba_file;
            hba_file             
---------------------------------
 /var/lib/pgsql/data/pg_hba.conf
(1 row)

Add rows for static IP

  • Edit file: vim /var/lib/pgsql/data/pg_hba.conf
    • File path from SHOW hba_file; above
  • Add these two (active) lines)
# Heroku - metrics app - static IP 1
host 	all	    all		52.86.18.14	255.255.255.255	password
# Heroku - metrics app - static IP 2
host 	all	    all		50.17.160.202	255.255.255.255	password

Reload Postgres settings

SELECT pg_reload_conf();

Heroku app, update the qgtunnel file

[qgtunnel.postgres]
accept = "localhost:5432"
#connect = "demo.dataverse.org:5432"
connect = "dvndb-qa1.hmdc.harvard.edu:5432"

Heroku, update the settings (via the web dashboard)

  • Update: DV_DEMO_DATABASE_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment