[英]Which azure services to use ( AKS or App service) to deploy multiple docker containers (compose enabled) on azure
I am trying to deploy multiple web-app containers on azure cloud to implement CI/CD pipeline deployment for production environment.我正在尝试在 azure 云上部署多个 Web 应用程序容器,以实现生产环境的 CI/CD 管道部署。 Currently I have built multiple container images using docker compose file which works totally fine on localhost environment.目前,我已经使用 docker 组合文件构建了多个容器镜像,该文件在本地主机环境中运行良好。 I tried to deploy the docker images to azure container registry and run them using azure web app services but it failed giving error " Cannot map container ports on ACI ".我尝试将 docker 图像部署到 azure 容器注册表并使用 azure web 应用程序服务运行它们,但它未能给出错误“ Cannot map ACI 上的容器端口”。 Looks like ACI doesn't support port mapping!貌似ACI不支持端口映射!
Can anyone suggest me a concrete solution to implement CI/CD deployment for multiple container deployment?谁能建议我为多容器部署实施 CI/CD 部署的具体解决方案?
Technology stack of app: Nodejs and Angular app技术栈:Nodejs和Angular
Docker: Docker desktop for windows (using Linux containers to build the images) Docker:windows 的 Docker 桌面(使用 Linux 容器构建镜像)
Cloud: Azure云:Azure
I don't have much experience in the Devops world, it would be helpful if anyone can guide me at proper path to implement a CI/CD process for multi-container web application.我在 Devops 世界中没有太多经验,如果有人可以指导我以正确的方式为多容器 web 应用程序实施 CI/CD 流程,那将会很有帮助。
Thanks for your time!谢谢你的时间!
Docker compose file: Docker 撰写文件:
version: "3.4"
services:
frontend:
build: ./frontend
ports:
- "85:80"
expose:
- "85"
- "80"
networks:
- dev_network
depends_on:
- backend
backend:
build: ./backend
ports:
- "3000:8600"
expose:
- "3000"
- "8600"
networks:
- dev_network
networks:
dev_network:
driver: bridge
Frontend Docker file:前端 Docker 文件:
# Stage 1: Compile and Build angular codebase
# Use official node image as the base image
FROM node:latest as build
# Set the working directory
WORKDIR /usr/local/app
# Add the source code to app
COPY ./ /usr/local/app/
# Install all the dependencies
RUN npm install
# Stage 2: Serve app with nginx server
FROM nginx:latest
COPY --from=build /usr/local/app/dist/ClientServicePortal /usr/share/nginx/html
# Expose port 80
EXPOSE 80
Backend Docker file:后端Docker文件:
FROM node:14-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3000 8600
CMD ["node", "server.js"]
I'm not an expert but I think it depends on what kind of of infra/traffic you need for you application.我不是专家,但我认为这取决于您的应用程序需要什么样的基础设施/交通。
AKS allow you to set up scalling, load balancing, traffic control inside the cluster. AKS 允许您在集群内设置缩放、负载平衡和流量控制。 Another advantage, if you are using Azure DevOps tool, is that AKS as a new feature in preview "Deployment center (preview)".如果您使用 Azure DevOps 工具,另一个优势是 AKS 作为预览版“部署中心(预览版)”中的新功能。 This feature will create CI and CD based on a repository.此功能将基于存储库创建 CI 和 CD。 It's a good help to start and see it working, after that you can jump in the config/settings and play with it:)这是一个很好的帮助,开始并看到它工作,之后你可以跳入配置/设置并使用它:)
edit: your docker compose will be replaced by an K8s manifest, but it's "easy" to setup编辑:你的 docker compose 将被 K8s manifest 取代,但设置起来“很容易”
As a by-default recommendation, the following is the main criteria recommended in this guidance:作为默认建议,以下是本指南中推荐的主要标准:
Single monolithic app: Choose Azure App Service N-Tier app: Choose orchestrators such as Azure Kube.netes Service (AKS) or App Service if you have a single or a few back-end services Microservices: Choose AKS or Azure Web Apps for Containers Serverless functions & event handlers: Choose Azure Functions Large-scale Batch: Choose Azure Batch单一整体应用程序:选择 Azure App Service N-Tier 应用程序:选择协调器,例如 Azure Kube.netes 服务 (AKS) 或应用程序服务,如果您有一个或几个后端服务微服务:选择 AKS 或 Azure Web 容器应用程序Serverless functions & event handlers:选择 Azure Functions Large-scale Batch:选择 Azure Batch
AKS vs Azure App Services AKS 与 Azure 应用服务
Azure App Services: Azure 应用服务:
PROS优点
CONS缺点
Azure Kube.netes Service: Azure Kube.netes服务:
PROS优点
CONS缺点
sources:资料来源:
https://learn.microsoft.com/en-us/do.net/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-container-based-applications https://learn.microsoft.com/en-us/do.net/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-基于容器的应用程序
https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kube.netes-service-part-1-e489857c6440 https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kube.netes-service-part-1-e489857c6440
https://spltech.co.uk/azure-appservice-vs-azure-kube.netes-service/ https://spltech.co.uk/azure-appservice-vs-azure-kube.netes-service/
https://medium.com/nature-of-clouds/azure-kube.netes-vs-app-services-a-simple-cost-comparison-3800819e3c35 https://medium.com/nature-of-clouds/azure-kube.netes-vs-app-services-a-simple-cost-comparison-3800819e3c35
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.