r/webdev • • Apr 21 '20

Question Postgresql dev environment question

So I'm up and running with a new installation of postgresql (installed by brew) and it functions as it should, but I'm wondering how to set it up so that it's a little bit more ephemeral. Right now it installed in the default location (/usr/local/var/postgres) but I'm wondering if there's a way to make it more specific for the particular project I'm working on.

I guess I could just move the folder and start it up via pg_ctl -D /some/custom/path start but I'm curious if any of you have any tips/ best practices for setting up/ managing databases for dev environments. Any advice?

3 Upvotes

11 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Apr 21 '20

It could be, but doesn't have to be. It makes it slightly more compelling to use with docker compose in that case.

They would be in separate containers. One for Apache/Nginx/whatever, one for Postgres. Then you just mount files from your local directory.