Hey , i’ve been running a discord bot script on my digital ocean droplet(ubuntu 16.04) for going on 3 years now. Recently i’ve been trying to rewrite it to a newer library but for whatever reason my postgresql connect command consistently throws a Timeout Error when i try to run it from my desktop. However the same script running on the vps itself works perfectly fine for some reason.

This would lead me to think that it’s a firewall error however i have double checked and my sql server port is forwarded which is also evidenced by the fact that i can consistently use PGAdmin to view the database from my desktop.

Another point of notice is that sometimes my droplet starts acting up where even ssh'ing into it using putty times out and i have to try a handful of times before i can get in which makes me guess that it’s a digital ocean side issue ?

I have checked my internet connection and it’s stable so that’s not the issue either. I’m fairly confused about this as i’ve never had any troubles in the 3 years i’ve been using DO before this ; any insight and help is appreciated.

This is the exact error my script raises on my desktop.
TimeoutError: [Errno 10060] Connect call failed (‘my ip’, 5432)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @AAnsari1998,

I believe that you would need to enable remote connections on PostgreSQL server. To do that you need to edit your pg_hba.conf configuration file and add the following:

host  all  all your_home_ip_address_or_range/32  md5

After that change:

listen_addresses = 'localhost'

To:

listen_addresses = '*'

And finally, restart your PostgreSQL service.

Also as you mentioned, make sure that port 5432 is open for TCP connections from your IP address.

Hope that this helps!
Regards,
Bobby

Submit an Answer