Fiberplane started out with developers using a mix of Linux and MacOS where bash scripts work perfectly fine for getting a local dev environment running. As the team grew, one of those awkward Windows developers (me, the author) joined and had to deal with a conglomerate of bash scripts without rocking the boat too much by changing the existing process.
Fortunately for me, the bash scripts were just a series of Docker commands and a bit of bash magic that fairly trivially could be converted to Docker Compose.
Here’s a short overview for Windows developers of how I did that: Our backend service relies on two services being available, postgres and AWS S3. For testing object storage while developing locally we use MinIO which provides us with an S3 compatible object storage to test against.
As such the run_all_services.sh bash script serves as the entry point that crates the docker network, starts postgres, then MinIO and awaits ctrl+c to shutdown the whole shebang.
This ends up looking something like this:
The keen-eyed reader might notice this runs another two bash scripts concurrently which each respectively start postgres/MinIO.
The MinIO bash script looks like this:
This is simple to translate into a docker-compose.yml
. So, let’s do just that:
I decided to use a volume rather than a bind mount in the docker-compose conversion as this is simply a development setup and we don’t care if the volume gets nuked at some point. Docker desktop on Windows with WSL 2 isn’t the best combination. Using a volume is a better choice.
The script used to start the run_postgressql.sh docker container looks like this:
Using the same approach as above, we can expand the docker-compose.yml
with the postgres service:
With all of that, our docker-compose.yml
file is complete so we can save it in the root of our git repo, create a PR and begin using it!
Where my colleagues can continue to use ./scripts/run_all_services.sh to get up and running, I can simply use docker compose up which will start the services and shut them down when I press ctrl+c just like the bash scripts.
As an additional benefit I can use docker compose up -d to run in daemon mode which will run the services in the background so I can reuse my terminal.
If I wish to access the service logs in while they are running the background I can simply issue a docker compose logs —follow command.