AWS ECS Fargate +蟒蛇 + nginx
嘿,
我想创建一个完全用 Python 处理的小网站。我将为此使用 Flask 框架。到目前为止,我接触了很多AWS ECS和ELB服务,但我承认,Python本身对我来说仍然是未知的。这就是为什么我有几个问题:
1.我理解,从软件工程师的角度来看,最好将后端和前端分开 - 因此最好创建两个单独的基于Python的项目在 Flask 上——一个是 API,另一个是前端,对吧?一般来说,我猜两者应该是ECS服务中的单独服务。
2. 在这样的配置中,他们都必须使用某种 WSGI 服务器,比如gunicorn?这是在具有多个 vCPU 的 Fargate 内运行的好解决方案吗?
3. 对于 Nginx 的这个解决方案,存在很多问题和误解。到目前为止,我认为如果我使用应用程序负载均衡器就足够了(毕竟它也充当反向代理)。 ECS中是否有必要使用Nginx作为sidecar,这样做有什么好处吗?假设使用 Nginx 是可取的,它应该只用于前端还是也用于 API?
预先感谢您在这里提供的任何支持性建议 - 我知道我要求了很多东西。
Hey,
I would like to start a small website that will be entirely handled in Python. I will be using the Flask framework for this. So far I had a lot of contact with AWS ECS and ELB service, but I admit, Python itself is still unknown to me. That's why I have a few questions:
1. I understand that from the point of view of a software engineer it is better to separate the backend and frontend - so it is best to create two separate Python projects based on Flask - one will be the API, the other the frontend, right? Generally, both should be separate services in the ECS service I guess.
2. In such configuration do they both have to use some kind of WSGI server, like gunicorn? Is this a good solution to run inside Fargate with multiple vCPU?
3. There are quite a few questions and myths around Nginx for this solution. Until now I assumed that if I use Application Load Balancer it should be enough (after all it also acts as reverse proxy). Is it necessary to use Nginx as a sidecar in ECS, are there any benefits of this? Assuming that using Nginx would be advisable, should it be only for the frontend or also for API?
Thank you really in advance for any supportive advice here - I know that I have asked for a lot of things.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的考虑中
1-如果你想要一个微服务概念,你可以将你的应用程序与前端和后端分开,每个应用程序都有自己的框架。对于前端,您可以使用 Angular、React 、 Vuejs 等等。 Python 是后端技术,
如果您使用例如 Docker 并为每个服务编写 Dockerfile,这在微服务中最常见,可以使用任何服务器(如 nginx、apache 或 WSGI 服务器)运行容器(我没有使用过)这个)然后暴露端口(如果需要)可访问
3-当您在AWS Fargate中运行服务时,可以将负载均衡器连接到您的服务,并且服务本身运行任务,每个任务实际上是一个或多个容器,可能是nginx 服务器或其他东西,如果你的意思是你的容器中有 nginx 是正常的。
In my consideration
1- if you want to have a microservice concept you can separate you application with front-end and back-end each of them has their freameworks. for front-end you can use Angular, React , Vuejs and so on. Python is backend technology and you can write strong restfull api to communicate with you front-end application
2- if you containerize your application with for example Docker and write Dockerfile for each service witch it is most common in microservice it is okay to run your container with any servers like nginx,apache or WSGI server(i did not work with this) then expose port (if it is needed) to be accessible
3- when you run your service in AWS Fargate it is possible to connect loadbalancer to your service and a service itself run tasks each task actually is one or more container with may be nginx server or something else , if you mean that it is normal to have nginx in your container.