pm7y / AzureEventGridSimulator

A simulator that provides endpoints to mimic the functionality of Azure Event Grid topics and subscribers and is compatible with the Azure.Messaging.EventGrid client library.
MIT License
82 stars 39 forks source link

Docker image azureeventgridsimulator:3.0.3 does not start on Apple M1 Pro #148

Closed vnea closed 1 year ago

vnea commented 1 year ago

Hello.

Issue

The Docker image azureeventgridsimulator:3.0.3 / azureeventgridsimulator:latest does not start on a Apple M1 Pro, the server inside the container does not start.

I can deduce that because the logs Started and It's alive ! are not present.

I don't know if it is specific to all Mac or only Mac M1 Pro.

Do you have an idea why it does not work?

Everything was OK with the old latest Docker image which was published several months ago.

Configuration

Investigation

I ran the following command:

docker run pmcilreavy/azureeventgridsimulator:3.0.3 ... # ... = all extra arguments

Then, I tried to check if the service was running:

curl https://localhost:60101

But I got the following error:

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:60101

Instead of:

{
  "error": {
    "code": "BadRequest",
    "message": "Request not supported."
  }
}

Then, I checked the Docker logs:

[15:28:02 VRB] AEGS_Serilog__Using__0=Serilog.Sinks.Console (MemoryConfigurationProvider)
AEGS_Serilog__Using__1=Serilog.Sinks.File (MemoryConfigurationProvider)
AEGS_Serilog__Using__2=Serilog.Sinks.Seq (MemoryConfigurationProvider)
ENVIRONMENT=Development (EnvironmentVariablesConfigurationProvider Prefix: 'ASPNETCORE_')
Kestrel:
  Certificates:
    Default:
      Password=Y0urSup3rCrypt1cPa55w0rd! (EnvironmentVariablesConfigurationProvider Prefix: 'ASPNETCORE_')
      Path=/aegs/dotnet-devcert.pfx (EnvironmentVariablesConfigurationProvider Prefix: 'ASPNETCORE_')
Serilog:
  MinimumLevel:
    Default=Verbose (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
Topics:
  0:
    key=TheLocal+DevelopmentKey= (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
    name=ExampleTopic (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
    port=60101 (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
    subscribers:
      0:
        disableValidation=true (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
        endpoint=http://host.docker.internal:7071/runtime/webhooks/EventGrid?functionName=Test (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
        filter:
          subjectBeginsWith=/events (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
        name=Test (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
URLS= (EnvironmentVariablesConfigurationProvider Prefix: 'ASPNETCORE_')

I did the same steps on Linux computer and everything worked. The only difference I had was that when I checked the Docker logs on the Linux computer, I could see the following extra logs at the end saying that the server was correctly started:

...
        name=Test (EnvironmentVariablesConfigurationProvider Prefix: 'AEGS_')
URLS= (EnvironmentVariablesConfigurationProvider Prefix: 'ASPNETCORE_')

[16:28:06 VRB] Started    <--- extra log
[16:28:06 INF] It's alive ! <--- extra log

Temporary fix

From the Apple M1 Pro, I cloned this project and from master (= the commit is 7d9e4be - (HEAD -> master, origin/master, origin/HEAD) Update README.md (8 days ago) <Paul Mcilreavy>), I locally built a Docker image.

Then I tried this locally build image: everything worked:

pm7y commented 1 year ago

Please can you pull the latest image and try again. It seems like the -p:TrimUnusedDependencies=true I was using results in more aggressive trimming on mac than windows. I have disabled this for now.

vnea commented 1 year ago

Okay, thank you.

I tested the new latest image and here are the results:

When I run the docker run ... command on a Linux, I have this behavior:

  1. The container starts.
  2. Then the container instantly stops.
  3. When I check the logs, I have this unique log: exec ./AzureEventGridSimulator: exec format error.
pm7y commented 1 year ago

@vnea I've updated the image again; if you could please pull and test again on ubuntu or arch I would appreciate it. I don't have access to a linux install atm. Thanks.

vnea commented 1 year ago

@vnea I've updated the image again; if you could please pull and test again on ubuntu or arch I would appreciate it. I don't have access to a linux install atm. Thanks.

Thank you, it works now on Ubuntu / Arch :D.

I will test on an Apple M1 Pro too soon, I keep you in touch.

vnea commented 1 year ago

Otherwise, it is better to push new tags instead of overwriting old tags: do not overwrite tag 3.0.3 but push a new tag 3.0.4.

Why? Because in my case, all my CI/CD was broken and my workflow was broken and I couldn't re-use the old tag :(.

But thank you very much for your reactivity :).

vnea commented 1 year ago

Okay, I tested the latest tag on Apple M1 Pro: it works ✅.

But I have just re-tested on Linux: it does not work anymore ❌.

vnea commented 1 year ago

By the was, I tried to build the docker Image (at the commit 60a6971) with the following command from my Linux computer:

docker buildx build --platform linux/amd64,linux/arm64 -t vnea/azureeventgridsimulator:60a6971 --push .

This image works well on my Linux but on Apple M1 Pro, it does not work.

From what OS do you build & push the Docker image?

pm7y commented 1 year ago

I have an Apple M1 Pro and Windows machine to experiment with. It seems we have the following situation...

docker buildx build --push --no-cache --platform linux/arm64,linux/amd64 --tag pmcilreavy/azureeventgridsimulator:3.0.3 --tag pmcilreavy/azureeventgridsimulator:latest .

Publishing images on Apple M1 Pro (with above command)...

Publishing images on Windows (with above command)...

As far as I can tell from the buildx documentation, this should work. I will setup a linux distro so I can test this better.

Q: @vnea is your linux distro running on x64 or arm64?

vnea commented 1 year ago

Okay great !

My Linux disto is running on x64:

image

pm7y commented 1 year ago

OK, if you wouldn't mind pulling the dev tag @vnea, it should now work on all the platforms previously discussed. If it looks good, I will create a 3.0.4 tag and update latest.

vnea commented 1 year ago

I tested everywhere:

Thank you very much for your job!!! 😁

pm7y commented 1 year ago

I've updated the latest tag and also pushed a 3.0.4 tag. I'll close this issue.