Azure Docker Container Service Multiple Instances - azure

I'm using Azure for the first time to deploy a web app. More specifically, I'm using the Docker Container Service to do this. I already have one instance of it deployed. But, I want to also deploy 2 more instances of the same web app. I want each instance to have a different URL. What is the best way of doing this? Do I have to add a new container service for each new instance and repeat the steps I did for deploying the first instance?

As in case of Azure Container Service (ACS),
You choose a container orchestrator i.e. Swarm, DC\OS and Kubernetes (Because creating replicas works differently in each of them).
In case of Swarm then either create a separate application container for the same application with a different end point and use automatic discovery feature for different URL(s) or choose a reverse-proxy load-balancer such as Nginx which will work on the same URL but on a different port (My blog here might help you).
Creating replicas across a cluster are used for Load Balancing, Routing Mesh, Scaling and Rolling updates etc.

Related

Azure Container Instance Pricing

I am trying to deploy a ASP net core web application in Azure Container Instance. Since it is having a microservice pattern I had to create 3 container groups for 2 API's and 1 for the web application. Each container group is having one application container and an nginx side cart to act as a reverse proxy. But I have getting around 120$ bill for these container instances alone. Each container is allocated 0.2GB Ram and 0.2GB CPU.
I am pretty new to Container instances and I am not sure if my approach is correct? Can any one suggest is it the right approach for hosting the application and also am I missing or misconfiguring some configurations while creating the container instances?

How to link 2 docker containers one with backend code and other with react both are on node.js

I have 2 docker containers running one with node which is my backend code and another with react build running on node, how do I link between the containers so that my react API calls are fulfilled via my node backend container.
I'm running the containers using ECS and routing using ALB, both my containers are in different target groups and the same cluster.
Actual Result:-
Both the containers are running individually but there is no response to the API calls made using react.
Expected Result:-
API requests should be fulfilled using the other node container.
There is no way to link two different task definition, You should run both containers in one task definition. you can only link container if it is the single task definition otherwise you need to use service discovery or internal load balancer if the there is two different task definition and having two different target group so better to use an internal load balancer or service discovery.
If you want to configure in the same task definition then you can refer or access the container using container name along with port. But I will not suggest docker linking in case of AWS I think such an approach is not good for production.
One of the biggest disadvantages is that if you want to scale one container in the service, all the container will be the scale of the task definition.
You can link this way, Go to task definition -> Container -> Networking -> just add the name of the second container as pasted in the image.
You can explore here and here further about service discovery and load balancer.

Difference between Azure Container Service and Web App for Containers

What is the difference between Azure Container Service and Web App for Containers?
They both seem to offer a fully managed platform on which we can deploy containers. I feel that Web App for Containers must be offering something more, but I don't see it. I've read the Azure Container Service FAQ and the Web App for Containers intro page, but the difference is not obvious to me.
Web App for Containers lets you run your custom Docker container which hosts your Web Application. By default the Web App Service with Linux OS provides built-in Docker images like PHP 7.0 and Node.js 4.5. But by following the instructions from this webpage you can also host your custom docker images which allows you to define your own SW-Stack. The limitation is that you can only deploy one docker image to an App Service. You can scale the App Service to use multiple instances, but each instance will have the same docker image deployed. So this allows you to use Docker as a Service, but isn't intended for deploying Microservices.
Container Services (ACS), Kubernetes Service (AKS) and Service Fabric allow you to deploy and manage multiple (different) Docker containers which might also need to communicate with each other. Let's say you implement a shopping website and want to build your web application based on a Microservices architecture. You end up having one Service (= container) which is used for registration & login of users and another Service which is used for the visitors' shopping carts and purchasing items. Additionally you have many further small services for all the other needed tasks. Because the purchasing service is used more frequently than the sign-up/sign-in service, you will need, for example, 6 instances of the sign-up/sign-in service and 12 instances of the cart service. Basically, ACS, AKS and Service Fabric let you deploy and manage all those different Microservices.
If you want to know the difference between ACS/AKS and Service Fabric you might want to have a look here.

Azure Web aps- When scale out on Web Apps happens does it put load balancer

Sorry guys if my question does not make sense. Let us say I have a website running in cloud. It is running under one instance.
I have a Scale out app service plan such that when CPU usage is more than 80% it creates one more instance. On day 3 let us say CPU usage gets to 85% and one more instance is created. My question is
1) Is it going to put a load balancer in front of these two instances.
2) Are these two Virtual machines going to be in different fault domain?
3) when I have two instances and I deploy from Visual studio, is it going to deploy to both instances?
1) Is it going to put a load balancer in front of these two
instances.
The answer is yes, after you enable autoscale settings, when your service receives additional traffic, you will get more instances without doing anything.
2) Are these two Virtual machines going to be in different fault
domain?
When multiple Cloud Service role instances are deployed, Azure deploys these instances to different fault domains.
More information about cloud service instances and fault domains, please refer to this blob.
3) when I have two instances and I deploy from Visual studio, is it
going to deploy to both instances?
No, after we deploy a new package, it will be applied in all instances of your WebApp.
More information about how to deploy APP to Azure app service, please refer to the link.
1-) Yes
2-) Probably, however I can't say this with 100% sure, because WebApps are PaaS, you delegate the management to Microsoft.
3-) When you deploy a new package it will be applied in all instances of your WebApp.

Link containers in Azure Container Service with Mesos & Marathon

I'm trying to deploy a simple WordPress example (WordPress & MySQL DB) on Microsofts new Azure Container Service with Mesos & Marathon as the underlying orchestration platform. I already ran this on the services offered by Google (Kubernetes) and Amazon (ECS) and thought it would be an easy task on ACS as well.
I have my Mesos cluster deployed and everything is up and running. Deploying the MySQL container isn't a problem either, but when I deploy my WordPress container I can't get a connection to my MySQL container. I think this might be because MySQL runs on a different Mesos agent?
What I tried so far:
Using the Mesos DNS to get ahold of the MySQL container host (for now I don't really care which container I get ahold of). I set the WORDPRESS_DB_HOST environment var to mysql.marathon.mesos and specified the host of MySQL container as suggested here.
I created a new rule for the Agent Load Balancer and a Probe for port 3306 in Azure itself, this worked but seems like a very complicated way to achieve something so simple. In Kubernetes and ECS links can be simply defined by using the container name as hostname.
An other question that came up, what difference is their in Marathon between setting the Port in the Port Mappings Section and in the Optional Settings section. (See screenshot attached)
Update: If I ssh into the master node than I can dig by using mysql.marathon.mesos, how ever I can't get a connection to work from within an other container (in my case the wordpress container).
So there are essentially two questions here: one around stateful services on Marathon, the other around port management. Let me first clarify that neither has to do anything with Azure or ACS in the first place, they are both Marathon-related.
Q1: Stateful services
Depending on your requirements (development/testing or prod) you can either use Marathon's persistent volumes feature (simple but no automatic failover/HA for the data) or, since you are on Azure, a robust solution like I showed here (essentially mounting a file share).
Q2: Ports
The port mapping you see in the Marathon UI screen shot is only relevant if you launch a Docker image and want to explicitly map container ports to host ports in BRIDGE mode, see the docs for details.

Resources