0

I have over 30 apps written in various Ruby frameworks. All of them are internal apps so they receive very little traffic. I want to run each of them in a separate Docker container. All of them use Postgres as the DB, each has a different database. I'm trying to decide if I should keep all the databases on a single, more powerful server, or run DB servers in the same Docker image with the app. I'm leaning towards having a separate DB server, it may be easier to manage backups that way. I will be running the whole setup on AWS.

Leo Net
  • 103
  • 1

2 Answers2

0

You can and probably should run PostGreSQL also in containers, no matter if they are on the same EC2 instance or not.

If you run the DB container(s) on the same EC2 instance, you should probably think about using Docker links.

Also note that a good practice would be that the PG_DATA directory should not be located inside the container but in a volume.

Florin Asăvoaie
  • 7,057
  • 23
  • 35
-1

If you can live with the space occupied by the PostGRES install in each docker this will be the best solution...

For speed... this is the obvious one.

And for security... not so obvious but in this solution you don't need to expose the PostGRES port to the outside world... you just need access to the db from inside the docker... this way you can block the db port (? 5432) in the firewall... ;-)

ZEE
  • 326
  • 3
  • 14
  • I would prefer to keep the containers as small as possible but will look into your suggestion. I'm still worried about database backups. I'm more concerned about data persistence than about uptime or speed. I think it would be easier to configure and verify backups if I'm backing up a single DB server with multiple small databases. Is this a valid concern or am I overthinking it? – Leo Net Dec 08 '15 at 01:46
  • The whole point of docker is not to occupy space multiple times with installs. @ZEE, I doubt you understand how Docker works. – Florin Asăvoaie Dec 08 '15 at 05:26
  • Well Florin... maybe you did not get the all picture,,, just to 'enlight' the question... for each PostgreSQL server you want to work truly independently you must create a docker... remember you must have a complete system/data profile for each database and independent '''virtualized engines''' with the same port number (different IPs)... By the way... ?did you know I'm using dockers now in Windows 2016TP4... ;-) remember also the security thing... – ZEE Dec 08 '15 at 17:02