How to access Azure Web App Container from Internet - azure-web-app-service

I have created an Azure Webapp multi container service. It contains two containers, one for the client SPA web app, and one for an api, that the client webapp needs to call. The web app starts up, fine but I am not sure what url the webapp needs to use to call the api?
So what is the external url I need to use to access the api container?
Here is the docker-compose.yml
version: '3.3'
services:
app:
image: soxxxxdev.azurecr.io/soxxxale:latest
ports:
- 3009:3009
api:
image: soxxxdev.azurecr.io/soxxxale-api:latest
ports:
- 4000:4000

Azure App Service only exposes ports 80 and 443, so even though you can deploy a multi container app with Docker Compose it isn't suitable for what you are trying to achieve.
If you want to present a container that is exposing a different port then you can configure this using the WEBSITES_PORT application setting. But remember App Service only allows your container to expose only one port for HTTP requests.
Typically you would use multi container hosting for supporting services used by your application such as a database or Redis Cache (although not recommended in production), or to implement a sidecar pattern.
You would be better suited to host the API in the App Service, and host the SPA in either a storage account as a static web site, or using Azure Static Web Apps.
App Service Ports: https://learn.microsoft.com/en-us/azure/app-service/networking-features
WEBSITES_PORT: https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#configure-port-number
Multi Container: https://learn.microsoft.com/en-us/azure/app-service/quickstart-multi-container
Sidecar Pattern: Differences between Sidecar and Ambassador and Adapter pattern
Static Web Hosting: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
Azure Static Web Apps: https://learn.microsoft.com/en-gb/azure/static-web-apps/overview

Related

Publishing a container app on Azure Cloud

I have a nextJS app working in local container. I uploaded the image to Azure and now my application is up from Azure Container Instances.
its listening on port 3000 on http protocol.
I want to utilize Azure https certificate and have site like https://mysitexyz.azurewebsites.net which should point to my container: http://containerip:3000
What Azure resource should i using to achieve that?
You can point your custom DNS to an Azure Container Instances: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-custom-dns
EDIT: *.azurewebsites.net is the DNS assigned when you use Azure App Service. You can't use it outside Azure App Service. What you can do, is run Containers on top of it using Azure Web App for Containers.

can i access the rest-api from other computer if i deploy my nodejs application on docker swarm?

I am working on an supply chain management application. I developed frontend of the application in ReactJS and backed in docker and nodeJS. My question is if i deploy my backend i.e NodeJS sdk on docker swarm. Can i access the deployed API's in different computer?
You can achieve service (backend) is reachable from the outside in primarily two ways:
eighter you expose the port of the service directly, and you can then connect straight to it (it is not recommended to do so on any actual deployments) by using ports configuration. By doing so the exposed port will be available to access the service from the outside world.
or you deploy another service which will act as a reverse proxy / API gateway. So the proxy (nginx, traefik, ...) will listen for all incoming requests, check SSL, ..., and then it will forward the request to the right service. This is the recommended way because you hide your actual service behind a proxy, and also put all of the auth/ssl details on the proxy itself, so you free your service from needing to know anything about that technical details.

How to setup communication between ASP.NET CORE Web and WebAPI containers for AKS and Helm

I have two projects, one in ASP.NET Core MVC in one container, the other in ASP.NET Core WebAPI in a separate container, both are using Azure Kubernetes Service and Helm.
The MVC project makes calls to the WebAPI project. It works locally by using localhost.
My question is how to set it up so that it works on AKS and accepts public request.
You can read this document which shows you the network in Kubernetes that communicate be between containers in the same pod, or in the same node but different pods, or in the different pods and different nodes. And Kubernetes usually use the service for each deployment to communicate between pods.
It's simple to achieve. You just need to create two images for your applications and use the images to create the deployment. Make sure what is the service for each deployment. In your code, when you want to connect to another pod of the deployment, you can directly connect it with the service of the deployment.
Here I show you a simple plan:
deployment: frontend -> ASP.NET Core MVC, service: frontend-service
deployment: backend -> ASP.NET Core WebAPI, service: backend-service
Within the frontend container, you can connect the backend container like this, I just use the shell command to make the example:
curl http://backend-service
It means you just need to connect the container you expect with its service.
Helm just use the chart to manage all the things for you.

Reverse proxy in front of .NET core app when deploying a custom docker container to App Service?

I'm planning to deploy my .NET core application as custom docker container to Azure App Service but have a couple of questions regarding the load balancer.
I have read in the documentation that it is a good idea to place a reverse proxy in front of the Kestrel webserver. Is it recommended to create a multi docker container that has a Nginx reverse proxy in front of the webserver instead of a single container when deploying to App Service? Or does the load balancer already deal with this?

Scaling Azure Container Service with private ports on containers

In our organization, we are currently trying out the Azure Container Service with Docker Swarm. We have developed a Web API project based on .NET Core and created containers out of it. We have exposed the web api on Container’s Private Port (3000). We want to scale this to say 15 containers on three agent nodes while still accessing the web api through one single Azure load balancer url on public port 8080.
I believe we would need an Internal Load Balancer to do this but there is no documentation around it. I have seen this article on DC\OS but we are using Docker Swarm here. Any help?
Azure Container Service use vanilla Docker Swarm so any load balancing solution for Swarm will work in ACS, e.g. https://botleg.com/stories/load-balancing-with-docker-swarm
Same is true for DC/OS, but in this case it is documented in "Load balance containers in an Azure Container Service cluster" - https://azure.microsoft.com/en-us/documentation/articles/container-service-load-balancing/

Resources