I use microservices in my projects. Each microservice lives in it's own folder and it's own git repo.
All services live in separate docker container. So overall project structure looks like this:
project_root/
microservice1_folder -> Dockerfile, .git, files ...
microservice2_folder -> Dockerfile, .git, files ...
microservice3_folder -> Dockerfile, .git, files ...
docker-compose.yml
The problem is that docker-compose.yml isn't in any repo. There is no repo I could git clone and bring all services up with docker-compose up -d.
One could suggest to use submodules but I see no way of integrating them into my workflow.
With current setup I mount each microservice folder into docker, so I can make changes on the fly, commit and so on.
How do I work with submodules?
project_root would need to be a git repo. You would then use
git submodule add {REPO_NAME} {PATH_TO_REPO}
for each of your submodules, which would, in turn, create a .gitmodules file in project_root.
When you clone project_root, you would then need to call
git submodule update --init
which would pull down the source for each of your submodules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With