How do you guys connect with PgAdmin 4 to postgres running on a ubuntu-droplet? Can you do it over SSH or do you need to setup a VPN or something like that? All info is appreciated since I cant find real good articles on it, but I just assume not everyone is working through the terminal?
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Best choice for connecting PGAdmin to server is SSH-tunnel using Public key authentication (Identity file) for SSH connection. PGAdmin 4.4 supports ssh-tunnel out of the box. But there is a small issue with supported public key formats. By default newer versions of ssh-keygen generate key in RFC4716 format, but PGAdmin supports only PEM. So you need to add -m PEM option when generating your key.
Use
ssh-keygen -m PEM -t rsa -b 4096
More information here
The most secure way to do this is probably to configure an SSH tunnel. It will securely send traffic from the Droplet to your local machine without needing to expose the database publically.
Assuming you already have SSH set up, from your local machine run:
ssh -L 63333:localhost:5432 user@111.111.111.111
Let’s break that command down a bit:
63333 is the port you want to be able to access Postgresql on locally. It doesn’t need to be that number, it is just for example.5432 is the port that Postgresql is running on the Droplet. That is the default port used.Now when you set up PgAdmin, you can use localhost for the “Host” setting and 63333 for the port.
For more information on how SSH tunneling works, check out:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.