Dev environment (postgress on docker image)

Maybe it would be a good idea to provide a docker image with a pre-deployed postgress database for development (eventually even containing some mock data)

This may also help on unit-testing/smoke-testing (some day)

3 Likes

It might be confusing since the project doesn’t actually use Docker. IMO there’s already lots of setup instructions & documentation.
We will have a build script in the future so that the database & project gets setup with 1 command.

For my own development I use Docker and you can see how it’s setup here: https://github.com/LionelBergen/codidact-docker
After running docker-compose build the postgres container contains mock data from the project

4 Likes

This is exactly what I was looking for. Thanks for sharing it.

2 Likes

My team uses docker for dev only, it really isn’t confusing. When it works well, it’s the opposite; it lowers the barrier to getting the project bootstrapped. You don’t have to understand docker really to use a db container, and you don’t have to know a single thing about postgres. It just makes sense from the abstraction POV, using EF Core and other ORM features abstracts away the specifics of the db, docker continues that concept at the persistence software management/implementation layer.

Using docker also makes it easier for the dev team to decide to switch persistence layers, if that ever comes up. There’s far less reluctance to make what might otherwise be a sensible change if it doesn’t involve any retooling for the devs – they just keep getting the latest docker image and writing code.

The other great thing about using docker for dev db is that we can push release tags, so it’s casually easy to get my local database set to a certain release’s database. Especially since it looks like we’re doing Code First, squashing the migrations and pushing a new docker tag is also an easy (and easily automatable) part of builds and releases.

I came from a long time on a project where we deved local mysql and often pushed “looks good to me” code straight to production, then to the company I’m at now that used a shared hosted Oracle instance for all devs, and a separate QA instance, and a separate prod instance. The team I’m on now has docker for devs, then all separate shared instances for the various higher environments. I feel like I’ve done a tour of the options, and I can’t say enough how much better the docker route has been compared to all the others. I didn’t even touch on local state tagging… it’s just very powerful, useful, and fluent.

Man. I didn’t know I was a fanboy until I re-read this post.