0
votes

I am trying to deploy my microservice app to Azure Container Instances. Each service is represented as a Docker image, which is stored in DockerHub. The whole app`s infrastructure is described in the docker-compose.yml file:

version: '3.7'
services:
    db:
        image: darkmode1012/ticketflow_db:1.0.0
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_DB=postgres
            - POSTGRES_HOST_AUTH_METHOD=trust
        networks:
            - ticketflow-network
        restart: unless-stopped
        ports:
            - 5432:5432

    consul:
        image: "consul:1.8.5"
        networks:
            - ticketflow-network
        ports:
            - "8500:8500"

    identity-service:
        image: darkmode1012/ticketflow_identity-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://identity-service:9001
        restart: unless-stopped

    profile-service:
        image: darkmode1012/ticketflow_profile-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://profile-service:9002
        restart: unless-stopped

    ticket-service:
        image: darkmode1012/ticketflow_ticket-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://ticket-service:9003
        restart: unless-stopped

    movie-service:
        image: darkmode1012/ticketflow_movie-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker     
            - ASPNETCORE_URLS=http://movie-service:9004
        restart: unless-stopped            

    api-gateway:
        image: darkmode1012/ticketflow_api-gateway:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - consul
            - identity-service
            - profile-service
            - ticket-service
            - movie-service
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker   
            - ASPNETCORE_URLS=http://host.docker.internal:8080
        restart: unless-stopped        
        ports:
            - "8080:8080"
                    
    web-client:
        image: darkmode1012/ticketflow_web-client:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - api-gateway
        ports:
            - 3000:3000
        stdin_open: true

networks: 
  ticketflow-network:
    driver: bridge

When I run docker-compose up locally - it works correctly. But when I try to deploy it to Azure Container Instances (following the guideline https://docs.microsoft.com/en-us/azure/container-instances/tutorial-docker-compose), I see the error:

D:\Developing\Ticket_Flow>docker compose up
[+] Running 0/1
 - Group ticket_flow  Waiting                                             92.4s
containerinstance.ContainerGroupsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="ServiceUnavailable" Message="The requested resource is not available in the location 'eastus' at this moment. Please retry with a different resource request or in another location. Resource requested: '9' CPU '8.1' GB memory 'Linux' OS"

I have checked the availability of ACI for the chosen "eastus" region - it is available at the moment. https://status.azure.com/en-us/status?WT.mc_id=A52BDE99C

Also, I have tried to use a resource group with another region - the error remains.

Could you please give me an idea about what can cause this error and how should I fix it?

2

2 Answers

1
votes

According to my knowledge, the problem is that the resource you require on the CPU for the Azure Container Instance is over the limit of the East US. See the limit here. The max CPU for the East US is 4. But you require 9.

Of course, you can use the maximum allocation to limit the CPU. But I think it's not enough for all of your services. And the ACI is known for its Lightweight. If you need to expose multiple ports to the outside, I recommend you use the AKS to deploy your services, it's more suitable.

0
votes

I faced the same issue. What was surprising is how fickle the integration was.... it would either fail without error or give an error that made no sense.

For your particular issue, the following would fix it:

Specify needed resources and burst maximum - for each container like so: image: nginx deploy: resources: limits: cpus: '0.50' memory: '1G' reservations: cpus: '0.25' memory: '1G'

Ensure that total memory and CPU (reservations) for the whole compose file is under the limits of container cloud destination.