Closed kaaveland closed 1 month ago
Honestly, we don't need to rely on the postgres init setup in the image. We can write a setup that is way simpler.
Let's assume that we have a postgres installation on $PATH
, then:
initdb
to set up a new postgres cluster in tmp=$(mkdtemp)
postgres -D $tmp
in a subprocessThat should work both on docker and elsewhere.
I want us to have a docker image that can be run like this:
The image should be built from
postgres:latest
because:/docker-entrypoint-initdb.d/eugene.sh
postgres:latest
will start a "temporary database server", then while it is running, run all shell scripts in that location--commit
What should happen:
/sql
and discover all sql scripts and run them in the correct order--commit
since it's a throwaway databaseWe should expose some more controls as well, probably as env vars:
This way, eugene "brings its own" postgres and a large barrier to entry goes away. What it's lacking is opportunities to "git smart" and automatically discover that we're in gitlab ci/cd or github actions, or automatically diff against
main
and report only on the interesting scripts. But other than that, this is almost perfectly my vision for what I want to offer and it's easy to imagine building more cool stuff, like schema linting (all FKs have index, ...).