Question

Connect to app platform dev database via psql

I’ve created a web application using App Platform, and created a Postgres “dev” database (i.e. not a full, “managed” database) as a component with it. In order for my app to work, I need to load some data into the db, and had thought that I would do that using psql. However, I can’t seem to find where to add my computer’s IP to the database’s “trusted sources”.

I’ve read through the docs on how to connect to a managed database, as well as on how to connect to Postgres in particular, but that still hasn’t led me to a solution.

Is it possible to connect to a Postgres “dev” database in app platform from the outside world? Or do I have to either a. disable trusted sources, or b. upgrade to a full “managed” database?

Edit: Alternatively, c. is there another, preferred way of managing the dev database from within DO?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Hey Ben,

Happy to hear that you found a work around and thank you for sharing it here with the community.

An alternative approach that I use with dev databases is database migration files and seed files. That way when I initially setup my dev app the database migrations are executed and the seeders add the dev content.

Best,

Bobby

I wasn’t able to find a way to add trusted sources (aside from the app itself) to my dev database. However, my workaround was to temporarily disable trusted sources, connect via psql, load my data, and then re-enable trusted sources again.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel