部署 .NET Core +使用 Docker 和 GitLab 进行 Angular SPA
我在 Digital Ocean 中有一个使用 Ubuntu 20.04 的 Droplet 和一个连接到 Mongo 的 .NET Core Web 应用程序。
我的部署工作流程如下:
我在本地使用 Visual Studio 工作并将我的应用程序发布到文件夹。
然后我通过 FTP 连接到我的服务器并将文件夹的内容拖到 /var/www/myapp
Secrets 由 Azure 管理(我花了很多时间来设置它)。
服务运行应用程序并在需要时重新启动它。
网络服务器是Nginx
一切正常,到目前为止没有什么新鲜事。但是,我希望自动化每个部署,并且我发现 GitLab 可以运行管道来帮助我实现这一目标。问题是我不明白如何正确设置它,因为我看到涉及更多部分,例如 Docker 和 Kubernetes,我感到有点不知所措。
我需要“dockerize”我的应用程序、数据库等吗?如果我想添加 Angular 作为客户端,我是否也需要对其进行 dockerize,或者它与 .NET Core 应用程序位于同一个容器中?
我需要 Kubernetes 吗?如果是这样,为什么?
为我的应用程序实现 CI/CD 的最直接和推荐的方法是什么?
我花了很多精力才部署到我的 Linux 服务器上,而且我担心我会破坏生产中的某些东西。
我真的很感激任何帮助。
I have a droplet in Digital Ocean with Ubuntu 20.04 and a .NET Core web application that connects to Mongo.
My deployment workflow is the following:
I work locally with Visual Studio and release my app to a folder.
Then I connect to my server through FTP and drag the content of my folder to /var/www/myapp
Secrets are managed by Azure (it took me a lot of time to set this up).
A service runs the app and restarts it if needed.
The web server is Nginx
Everything works fine, nothing new so far. However, I'd like to automate each deployment and I found GitLab can run a pipeline to help me achieve that. The problem is I don't understand how to set this up correctly since I've seen there are more partes involved, such as Docker and Kubernetes, and I feel a bit overwhelmed.
Do I need to "dockerize" my application, database, etc.? If I want to add Angular as the client side, do I need to dockerize it as well or it goes in the same container as the .NET Core app?
Do I need Kubernetes? If so, why?
What would be the most straightforward and recommended way of achieving a CI/CD for my app?
It took me a lot of effort to deploy to my Linux server and I'm afraid I can destroy something in production.
I would really appreciate any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论