s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
2k stars 173 forks source link

Add Docker-Swarm support #92

Open sorasful opened 2 years ago

sorasful commented 2 years ago

Hi there !

Since we are using docker-compose and there is also a Kubernetes config, I was wondering If it would be a good idea to add a Docker Swarm configuration. That's something I would be interested in and I would like to propose something if that's accepted !

s3rius commented 2 years ago

Hi and thanks for raising this issue. As I remember docker swarm config is an extended docker-compose.yml config with deploy spec in each service.

Could you please provide an example of your swarm config files or describe what changes you have to make to docker-compose files?

sorasful commented 2 years ago

Yes I think you're right, it's more like some configuration in docker-compose. So I was maybe thinking of adding an additional docker-compose for this.

I don't have the exact syntax right now, but I was thinking that this PR should mostly add (the docker-compose.yml obviously) documentation about the commands to run and how to setup a cluster etc ...

What do you think ?

s3rius commented 2 years ago

I guess it's a good idea. I'll try to research it this week.

s3rius commented 2 years ago

Hi. I got some information about docker swarm.

And I want to decide how we can implement this. I don't think it's a good to deploy database in docker swarm, also docker swarm doesn't support extended depends_on syntax as docker-composev3.9.

Maybe it would be good to generate configuration for swarm in a separate direcrory, such as ./deploy/swarm? And it will have only the application without any database or rabbitmq.

sorasful commented 2 years ago

Hi ! I'm curious, why do you think it's not a good idea to deploy a database using docker swarm ? Currently we have the database in the docker-compose and it seems okay.

And I don't know about the dedicated directory for swarm. I don't see why not, but I don't see the value it adds instead of being side by side with the other yml files

s3rius commented 2 years ago

I will create a proof of concept in near future. This feature will be marked as unstable for a while.