Ends in:
7 DAYS
13 HRS
26 MIN
7 SEC
Ends in:
7 D
13 H
26 M
7 S
Open Closed

Deployment to Docker container and AWS ECS #93


User avatar
0
Repunjay created

Hi,

I'm developing an application using abp.io with Angular front-end. I'm trying to deploy and run the api into Docker container. I used Visual studio Docker support which creates a Dockerfile under project *.HttpApi.Host. The Docker image is created and a container runs successfully. But when I try to access the api from Docker using http://localhost:<Docker port> from browser, it is not accessible. However, the api is accessible when it runs from local machine using Visual Studio like http://localhost:44306.

Question -

  1. Do we have some instructions/guidelines/scripts to deploy and run abp.io asp.net core api into Docker container? To extend it further, I want to deploy and run it from AWS ECS.
  2. How do we map port of local machine which is specified in appsettings.json to the port of docker container?

Let me know if you require additional information. Any help, suggestions would be welcome.

Thanks, Repunjay


3 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Hello,

    I used Visual studio Docker support which creates a Dockerfile under project *.HttpApi.Host. The Docker image is created and a container runs successfully. But when I try to access the api from Docker using http://localhost:-Docker port- from browser, it is not accessible. Visual Studio runs the containers with additional parameters (like located inside docker-compose.vs.debug.g.yml). Your http server (kestrel) is alive as long as you are debugging it. That's why you can't access them when you are not running through Visual Studio. So, you manually need to build the docker images for production.

    Question -

    1. Do we have some instructions/guidelines/scripts to deploy and run abp.io asp.net core api into Docker container? To extend it further, I want to deploy and run it from AWS ECS. We are planning to add guideline about how to run abp on containers for both development and production. However I can't hint a date about it unfortunatelly.

    2. How do we map port of local machine which is specified in appsettings.json to the port of docker container? You can pass the port as environment variable from top to bottom (env-> docker -> appsettings)

    Hope it helps.

  • User Avatar
    0
    Repunjay created

    Hi,

    I'm facing another issue when try to deploy and run aspnet-core project into Docker Container (Windows). The image is successfully created but the docker container doesnt run and exits. When I checked the logs, I found below issue - Could you please advise on resolution steps for this issue? Kindly note, that I have a commercial license code for abp.io and it works properly when I run code from local machine.

    2020-04-28 00:00:03.669 +05:30 [ERR] ABP-LIC-0008 - License check failed for 'Volo.Abp.LanguageManagement.Domain.Shared-v2.4.0.0'. You need to log in using the command abp login <username>. For more information, contact to license@abp.io. 2020-04-28 00:00:03.673 +05:30 [INF] Application is shutting down... 2020-04-28 00:00:03.673 +05:30 [FTL] An error occurred stopping the application System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.) ---> System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.Hangfire.AbpHangfireModule.OnApplicationShutdown(ApplicationShutdownContext context) at Volo.Abp.Modularity.OnApplicationShutdownModuleLifecycleContributor.Shutdown(ApplicationShutdownContext context, IAbpModule module) at Volo.Abp.Modularity.ModuleManager.ShutdownModules(ApplicationShutdownContext context) at Volo.Abp.AbpApplicationBase.Shutdown() at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.<>c__DisplayClass1_0.<InitializeApplication>b__0() at System.Threading.CancellationToken.<>c.<.cctor>b__26_0(Object obj) at System.Threading.CancellationTokenSource.CallbackNode.<>c.<ExecuteCallback>b__9_0(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback() at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException) --- End of inner exception stack trace --- at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException) at System.Threading.CancellationTokenSource.NotifyCancellation(Boolean throwOnFirstException) at System.Threading.CancellationTokenSource.Cancel(Boolean throwOnFirstException) at Microsoft.Extensions.Hosting.Internal.ApplicationLifetime.StopApplication()

    Regards, Repunjay

  • User Avatar
    0
    alper created
    Support Team Director

    about your Docker license issue see this answer https://support.abp.io/QA/Questions/69/#answer-d8bebebb-b714-3c1e-7fcb-39f437bc8ba3

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06