hackforla / heart

Heart is a project working directly with the LA City Attorney’s Homeless Engagement and Response Team. We are building a database and case management system to streamline their workflow and enable them to scale their program. Find us on the Hack for LA Slack #heart.
https://www.lacityattorney.org/community-justice
MIT License
31 stars 40 forks source link

Dockerized postgres/pgadmin #20

Closed thekaveman closed 5 years ago

thekaveman commented 5 years ago

Here's a proposal for a simple setup for #9, implemented in spikes/ since I haven't been part of the repo/project layout discussions. Easy enough to move around.

I opted for two separate Docker containers (one for the PostgreSQL server, one for pgAdmin client) since it makes things a little more reusable/portable.

Nothing special going on here, pretty much straight defaults. But there's plenty of ability to extend - like setting up default databases on container startup, local persistence, etc.

I set this up on Windows 10 with:

$ docker --version
Docker version 18.06.1-ce, build e68fc7a

$ docker-compose --version
docker-compose version 1.22.0, build f46880fe
thekaveman commented 5 years ago

Just updated to the latest Docker for Windows, tested and (still!) works:

$ docker --version
Docker version 18.09.0, build 4d60db4

$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01
thekaveman commented 5 years ago

Another point for consideration:

The environment variables are currently defined directly in the docker-compose.yml file.

Compose will automatically source an .env file in the same directory as docker-compose.yml upon start up, as an alternative option. This makes it possible to e.g. share env variables between services that need the same.