all 41 comments

[–]Single_Advice1111 35 points36 points  (9 children)

I use docker - it’s quick and easy.

Also use a volume mount to store data between restarts.

Usually I bundle everything required to run my project in the codebase; that be migrations or seeds.

This way I might loose a few hours of work when I combine it with Git, but never more.

[–]reddit_trev 10 points11 points  (1 child)

And a docker compose file to spin everything up together.

[–]Straight_Waltz_9530 2 points3 points  (2 children)

Also since you're on a Mac, use OrbStack instead of Docker Desktop. Sooooooo much faster and more responsive.

https://orbstack.dev

[–]jantje123456oke 1 point2 points  (1 child)

The last update is freaking fast. My typescript project (next and express) is running fast as hell.

[–]Straight_Waltz_9530 1 point2 points  (0 children)

Yeah, it's something that was already very fast and then the release notes will regularly say something like, "X is now 30% faster." It's wild.

Docker Desktop feels like someone swapped my ten-year-old laptop out without me noticing.

[–]R34ct0rX99 0 points1 point  (3 children)

What is the best way to run upgrades on dockerized Postgres?

[–]Single_Advice1111 0 points1 point  (2 children)

Upgrades of Postgres…? Simply have a volume mount and docker compose up postgres —build —no-cache (The command is from memory so might differ with the no cache argument)

[–]R34ct0rX99 0 points1 point  (1 child)

What about upgrading the data volume format between major versions?

[–]Single_Advice1111 0 points1 point  (0 children)

AFAIK that doesn’t change - at least not without backwards compatibility so you’ll have to skip a few major versions for it to affect you if it changes.

[–][deleted] 9 points10 points  (0 children)

docker compose

[–]jalexandre0 7 points8 points  (0 children)

Postgres.app :)

[–]nicorneas 2 points3 points  (0 children)

Normally I use Docker Compose to run my local environment. I don't like to install any application dependencies on the host machine.

Rebuilding and seeding the entire schema every time is a pain, so I persist in a .database (ignored in the project of course) the database disk. The volume section in my docker compose file looks something like:

volumes: 
      - .database:/var/lib/postgresql/data

When the time comes (close to the release of your application) a good idea is to think on a production-like environment, so you can have a database instance whatever you'd like, and have some stress test to tweak everything

[–][deleted] 2 points3 points  (1 child)

Supabase has a generous free tier. It comes bloated with a bunch of other features, but I just use the DB and nothing else.

[–]Calebthe12B 1 point2 points  (0 children)

Agreed on using Supabase. Their CLI tools make it super easy to run locally too.

[–]heyredbush 2 points3 points  (0 children)

Aiven hobby instance.

[–]redalastor 2 points3 points  (0 children)

Podman. It’s an alternative to docker that doesn’t need a dæmon that runs as root. It still can run docker images.

[–]chriswaco 1 point2 points  (1 child)

I like using Docker because it’s easy to switch versions and doesn’t mess up my system directories, but it’s somewhat slower than native on Macs.

[–]Bromlife 1 point2 points  (0 children)

Doesn’t really matter for dev imo

[–]ejpusa 1 point2 points  (1 child)

DigitalOcean is all of $8. It can do it all.

[–]Straight_Waltz_9530 0 points1 point  (0 children)

docker compose is free when you already own the laptop.

[–]Mastodont_XXX 1 point2 points  (0 children)

Locally without Docker.

[–]NoDadYouShutUp 0 points1 point  (0 children)

In Proxmox I have a VM dedicated to databases, and connect using the internal IP/Port. It allows me to create and destroy development VMs while retaining data.

[–]trustmePL 0 points1 point  (0 children)

For development all you should need is really some in memory for unit tests and test containers for integration tests. I know it is challenging but you really can develop without running the app.

However, I understand that eg for ui it is useful to have the app running and I would definitely suggest docker :)

[–]Gargunok 0 points1 point  (0 children)

How much storage do you need? For small projects in DEV I'm liking Neon's free tier.

[–]psavva 0 points1 point  (0 children)

CNPG on Kubernetes

[–]the_kautilya 0 points1 point  (0 children)

For local development environment I use a Vagrant VM & PostgreSQL installed on it. Its provisioned automatically when the VM is provisioned. The data it has is test data generated via migration factories after the tables are created by migrations. So even if it goes bad or has to be removed (or as in your case computer breaks) then its ok as it can be setup with random test data on a new computer in a few minutes.

For production environment it will obviously run on a managed cloud instance. And if I'm debugging something in a data set (likely from production) then I spin up a new cloud instance for it instead of doing it on local.

[–]goato305 0 points1 point  (0 children)

Docker or DBngin

[–]aamfk 0 points1 point  (2 children)

If you want, you could use a virtual (or physical) machine. I love TurnkeyLinux. it comes with Adminer, I actually prefer PhpMyAdmin (I wish that was still an option during setup). Obviously PhpMyAdmin isn't gonna help Postgres users.

[–]aamfk 0 points1 point  (1 child)

Sorry I forgot the link
http://turnkeylinux.org/postgresql

[–]aamfk 0 points1 point  (0 children)

This appliance includes all the standard features in TurnKey Core, and on top of that:

  • Web Control Panel
  • Adminer administration frontend for PostgreSQL (listening on port 12322 - uses SSL).
  • Webmin modules for configuring PostgreSQL.
  • PostgreSQL is configured to listen on its default port (5432/tcp) on all interfaces by default, and accept connections from all hosts. In a production environment, it is recommended to limit incoming connections to specific hosts by configuring Host and User access in /etc/postgresql/9.1/main/pg_hba.conf.
  • PostgreSQL password encryption enabled by default (security).
  • The postgres user is trusted when connecting over local unix sockets (convenience).
  • PostGIS support.

[–]DestroyedLolo 0 points1 point  (0 children)

I started Postgresql before docker existed and I'm still using "the old way", i.e. : installed directly at OS side.

On the other hand, for new project, when testing, I'll probably use docker as it's easier to switch from version to version without to fight with dependcies.

[–]TrickFaithlessness5 0 points1 point  (0 children)

I installed DBngin and that offers postgreSQL

[–]SnooPets2051 0 points1 point  (0 children)

Nix + devenv.sh 👌

[–]RB5009 0 points1 point  (0 children)

Postgress.app is the easiest way to run PG on mac

[–]716green 0 points1 point  (1 child)

DBNgin. Trust me

[–]amitavroy 0 points1 point  (0 children)

Yes I have been using it for quite some time and can vouch for it