I have many services running on my server and about half of them use postgres. As long as I installed them manually I would always create a new database and reuse the same postgres instance for each service, which seems to me quite logical. The least amount of overhead, fast boot, etc.

But since I started to use docker, most of the docker-compose files come with their own instance of postgres. Until now I just let them do it and were running a couple of instances of postgres. But it’s kind of getting rediciolous how many postgres instances I run on one server.

Do you guys run several dockerized instances of postgres or do you rewrite the docker compose files to give access to your one central postgres instance? And are there usually any problems with that like version incompatibilities, etc.?

  • Shimitar
    link
    fedilink
    English
    -58 months ago

    This is one of the annoying issues with docker, or better, on how docker is abused in production.

    The single instance/multiple databases is the correct way to go, docker approach mess up with that.

    Rewriting docker files is always a possibility but honestly defies the reason why docker is used by self hosters.

    Also beware that some devs will shunt you out of support if you do, specially the apps that ships docker files by default.

    Go bare metal if possible, that way you have full control. Do docker for testing up stuff quickly and be flexible at cost of accepting how stuff is packaged by upstream

    • @sardaukar@lemmy.world
      link
      fedilink
      English
      68 months ago

      The official Postgres Docker image is geared towards single database per instance for several reasons - security through isolation and the ability to run different versions easily on the same server chief among them. The performance overhead is negligible.

      And about devs not supporting custom installation methods, I’m more inclined to think it’s for lack of time to support every individual native setup and just responding to tickets about their official one (which also is why Docker exists in the first place).