skip to Main Content

I am trying to deploy multiple web-app containers on azure cloud to implement CI/CD pipeline deployment for production environment.
Currently I have built multiple container images using docker compose file which works totally fine on localhost environment.
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" . Looks like ACI doesn’t support port mapping!

Can anyone suggest me a concrete solution to implement CI/CD deployment for multiple container deployment?

Technology stack of app: Nodejs and Angular

Docker: Docker desktop for windows (using Linux containers to build the images)

Cloud: 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.

Thanks for your time!

Docker compose file:

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:

# 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:

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"]

2

Answers


  1. 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.
    Another advantage, if you are using Azure DevOps tool, is that AKS as a new feature in preview "Deployment center (preview)". This feature will create CI and CD based on a repository.
    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

    Login or Signup to reply.
  2. 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 Kubernetes 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

    AKS vs Azure App Services

    Azure App Services:

    PROS

    • It’s extremely easy to set up
    • Built-in integration with Azure DevOps
    • Works perfectly with applications written in .NET/.NET Core
    • No management overhead (i.e. no sysadmin activity required)

    CONS

    • Each API needs its own Azure DevOps pipeline setup its own ARM/Terraform template customizations template, application settings, and secrets setup.
    • It is only available in Azure. Even though it leverages docker containers, working with Azure AppService requires Azure training.
    • There is no way to limit the consumption of memory and CPU services in AppService.
    • In terms of Pricing, AKS is the winner with a 30% average cost saving vs Azure AppService.
    • App Services are legacy technology for Microsoft Azure — no major announcements or blog posts since 2017.

    Azure Kubernetes Service:

    PROS

    • No need for ARM template deployments.
    • The AKS ‘rollout’ process is much faster than the Web Deploy process in App Services.
    • Additionally, with features such as rolling deployments, readiness and liveness probes, a ‘zero-downtime’ deployment is much simpler to achieve in AKS.
    • Simpler CI/CD
    • Can control CPU, memory for each container inside a pod
    • Automatically: can scale the number of replicas of pods automatically, using the horizontal pod autoscaler or scale the number of nodes of the cluster using the cluster autoscaler. Kubernetes can also adjust resources up or down per pod by analyzing CPU and memory consumption by pods using the vertical pod autoscaler. Unfortunately, this feature is not yet supported in AKS.
    • Kubernetes is available in most of the cloud providers. If ever needed, it is possible to move workloads running in Azure Kubernetes Service to other Kubernetes providers like Google Kubernetes Engine(GKE) or Amazon EKS.
    • In terms of Pricing, AKS is the winner with a 30% average cost saving vs Azure AppService.

    CONS

    • Steep learning curve.
    • Need to learn kubernetes terminology, kubectl etc.

    sources:

    https://learn.microsoft.com/en-us/dotnet/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-container-based-applications

    https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kubernetes-service-part-1-e489857c6440

    https://spltech.co.uk/azure-appservice-vs-azure-kubernetes-service/

    https://medium.com/nature-of-clouds/azure-kubernetes-vs-app-services-a-simple-cost-comparison-3800819e3c35

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search