microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation
MIT License
66 stars 24 forks source link

Add support for self-contained deployments #170

Open Nisden opened 2 years ago

Nisden commented 2 years ago

When trying to use the ApplicationInsights Profiler in our AKS cluster where we deploy our application on to mcr.microsoft.com/dotnet/runtime-deps:6.0 the uploader fails to execute as the dotnet executable does not exist on our machines.

Could we get support for a self-contained uploader?

xiaomi7732 commented 2 years ago

Hi @Nisden Thanks for the ask. This is the first time we see an ask to support runtime-deps container, and I want to gathering some context, if it is okay with you:

Curious, why do you prefer runtime-deps than runtime package? I guess it is about image size but I am interested to know if there is some other.

At the same time, just so that you know, we will need some time to understand what's the implications - package size for the uploader, caller contracts, backward compatibility and so on to form a decision to support it or not.

Let's keep the conversation going.

Nisden commented 2 years ago

Hi @xiaomi7732

Your questions are more then welcome, I think running runtime-deps vs runtime is a left over from when we ran our deployment on Azure App Service / Web App for Containers, as the smaller size was a win.

However I have considered switching our deployment to runtime instead, as AKS should be able to cache the base-layers.

xiaomi7732 commented 2 years ago

@Nisden Thanks for sharing the quick reply and the information. Specifically to AKS (or other K8s environment), having cached base layers' actually a good leverage for total size consideration!

That said, our investigation for uploader to support self-contained is still on the table. :-)

xiaomi7732 commented 2 years ago

By initial investigation, it looks like this scenario could be supported by:

Caveat to test for:

I think this worth a shot for 2.5.0-beta1. Let me talk with the team.

Reference: Publish .NET apps with the .NET CLI.

xiaomi7732 commented 2 years ago

A quick update:

The plan isn't working.

After some implementation, the test shows a different result that execution will not happen when:

  1. Build on Windows with UseAppHost enabled to generate exe.
  2. Run the exe (with all execution permissions, I actually tried 777), it won't execute.

Going back to documentation, it looks like it is clearly stated:

Executables aren't cross-platform...

More details: https://docs.microsoft.com/en-us/dotnet/core/deploying/#produce-an-executable

Also, more info on the *-deps package, it only contains native dependencies. Apps to run on it has to be self-contained.

Both pushes us to having a self-contained uploader. The size of the uploader wouldn't fit for most of the users. That makes me leaning towards out of band release of self-contained uploaders.