在容器中托管Web应用程序的最佳方法是什么 [英] Whats best way to host webapps in containers

查看:71
本文介绍了在容器中托管Web应用程序的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是使用AngularJs和WebApi的SPA.我想将整个应用程序托管在容器中.每个客户端每个容器.我还想在每个容器中有一个单独的数据库服务器,但听说这会消耗资源.所以我会 坚持将单个数据库服务器放在一个容器中.对于每个客户端,我希望提供相同的地址以访问虚拟地址不同的Web应用程序,例如:myapp.com/Client1、myapp/Client2.做这个的最好方式是什么?最好的意思是最少的资源 消耗并能够监视每个客户端容器.我应该使用kubernetes还是nginx或vm?我的应用还必须具有静态IP地址.

My application is SPA using AngularJs and WebApi. I would like to host this whole app in containers. Each container per client. I also wanted to have separate database server inside each container but I heard that it would be resources consuming. So I would stick with single db server being on one container. For each client I would want to give same address to access web app with difference in virtual path like: myapp.com/Client1, myapp/Client2. What is the best way to do this? By best I mean least resources consuming and being able to monitor each clients container. Should I go with kubernetes or nginx or vm? Also my app has to have static IP address.

推荐答案

每个客户的每个容器.

您能否弄清这是什么意思-每个连接到Web应用程序的人都可以旋转的容器吗?

Can you clarify what you mean by this - a container to be spun up for each person connecting to the web application? 

对于一般体系结构,您是正确的,通常不赞成在每个容器中都有一个数据库.您将需要相互之间不断地同步数据库.扩展数据库可能很困难,这就是为什么您会看到非常大的原因 数据库服务器,而不是许多小型服务器.

As for the general architecture, you're right that having a database in each container is generally frowned upon. You're going to need to sync the databases constantly with each other. Scaling databases can be difficult, which is why you'll see very large database servers instead of many small ones. 

我个人的喜好是对数据库使用Azure SQL之类的东西(因此不能在容器中使用),但是您当然可以将SQL安装到容器中.

My personal preference is to utilize something like Azure SQL for the database (so not in a container), but you can certainly install SQL into a container. 

我们有一个的博客文章 AKS .如果您正在研究使用容器,这是我建议的路线. AKS(Azure Kubernetes服务)将使您毫不费力地扩展和更新容器. Nginx在VM上的路由是经典方法,但是在这种情况下已经过时了 尤其是一种应用.确实如此;但是,仍然可以正常工作! 

We have a blog post about deploying Angular, ASP.NET, and a SQL server into AKS. That's my suggested route if you're looking into using containers. AKS (Azure Kubernetes Service) will allow you to effortlessly scale and update your containers. The route of nginx on a VM is the classical approach, but is going out of style for this kind of application especially. It does; however, still work just fine! 


这篇关于在容器中托管Web应用程序的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆