fastapi / full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.
MIT License
26.55k stars 4.67k forks source link

Can someone help with deploy to aws ec2 instance? #219

Open timofeyantonenko opened 4 years ago

timofeyantonenko commented 4 years ago

I don't really know anything about docker-swarm. So, I don't understand even the concept of deploying this template to a simple EC2 instance (or any cloud instance).

I'm running deploy commands from Readme.md but nothing really works. So, right now I'm running with a simple docker-compose up. But I'm sure, it's not a production solution.

Could you provide me some simple instructions on how to run my project (even if it's just a fresh one from this template.) in some simple cloud instance like EC2?

Sorry, if this question was very silly, and thanks for your attention.

MLWhiz commented 4 years ago

I saw this issue while struggling with the same problem. Here is how I solved it.

https://towardsdatascience.com/deployment-could-be-easy-a-data-scientists-guide-to-deploy-an-image-detection-fastapi-api-using-329cdd80400

timofeyantonenko commented 4 years ago

@MLWhiz Thanks for your answer. But actually, I was more interested in managing it to work with docker-swarm. I realize how to make it work with docker but docker-swarm approach is quite new for me so I don't really understand what is the best way to start digging into it within this project. And, I suppose, it leads me to a misunderstanding of containers management in this cookiecutter template.

paxcodes commented 4 years ago

Same here. I was following dockerswarm.rocks and I got lost once I got into the "optional" steps since I don't what my workers/managers should be.

paxcodes commented 4 years ago

A, I missed the README.md generated. I was only looking at the README.md of this project generator.

@timofeyantonenko Maybe if you ask which part exactly in README.md you are getting stuck, then more people might be able to help.

IanSaucy commented 4 years ago

@timofeyantonenko When I was trying to deploy my images to docker in EC2 for a quasi production scenario I found this useful: https://docs.docker.com/compose/production/

In regards to a "true" production mode, from my understanding that is not generally recommended at least right now in docker's current maturity(This is based on my own research, in no way am I trying to state this as fact). Unless running in some sort of cluster(ECS, docker swarm etc). IF you where to run the docker-compose in a production environment you'd for sure want to move the DB out of docker and maybe separate the front and backend containers among many other things.

If just getting the stack running in an EC2 instance via docker-compose is the problem, if you provide more details I am happy to try to help as I just setup a few instances for testing and quasi production.