Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hermes docker image should support Apple Silicon #1398

Closed
AleksanderBrzozowski opened this issue Oct 15, 2021 · 3 comments
Closed

Hermes docker image should support Apple Silicon #1398

AleksanderBrzozowski opened this issue Oct 15, 2021 · 3 comments

Comments

@AleksanderBrzozowski
Copy link
Contributor

AleksanderBrzozowski commented Oct 15, 2021

As a macbook M1 user I would like to be able to start hermes as a docker container.

When I try to do this I encounter an error, here is a log:

docker run allegro/hermes-management:hermes-1.9.3

...

2021-10-15 19:06:31.830  INFO 1 --- [           main] p.a.t.h.management.HermesManagement      : Starting HermesManagement using Java 11.0.11 on 16fb73a1f026 with PID 1 (/hermes-management/lib/hermes-management-1.9.3-hermes-1.9.3.jar started by root in /)
2021-10-15 19:06:31.839  INFO 1 --- [           main] p.a.t.h.management.HermesManagement      : The following profiles are active: local
2021-10-15 19:06:35.703  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [pl.allegro.tech.hermes.management.HermesManagement]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class] cannot be opened because it does not exist
2021-10-15 19:06:35.780  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-15 19:06:35.848 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [pl.allegro.tech.hermes.management.HermesManagement]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class] cannot be opened because it does not exist
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:822) ~[spring-context-5.3.3.jar:5.3.3]
	at java.base/java.util.ArrayList.forEach(Unknown Source) ~[na:na]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:336) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:252) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:285) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:99) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.2.jar:2.4.2]
	at pl.allegro.tech.hermes.management.HermesManagement.main(HermesManagement.java:10) ~[hermes-management-1.9.3-hermes-1.9.3.jar:na]
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.3.3.jar:5.3.3]
	at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:55) ~[spring-core-5.3.3.jar:5.3.3]
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49) ~[spring-core-5.3.3.jar:5.3.3]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.3.3.jar:5.3.3]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:696) ~[spring-context-5.3.3.jar:5.3.3]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:813) ~[spring-context-5.3.3.jar:5.3.3]
	... 18 common frames omitted

To fix this, we should publish hermes docker image that is compatible with M1 architecture.

To do so, we should change Dockerfiles used to build hermes images. Those Dockerfiles should use images (build and runtime) that support M1 architecture (linux/arm64/v8). I'm pretty sure there are Java based images available in the Docker Hub that support not only amd64 architecture, but also arm64.

At the end, we should publish both amd64 and arm64/v8 images to docker hub. To build those images, we can use this plugin docker/buildx.

What do you think about this? :)

@moscicky
Copy link
Collaborator

Hermes images should work via emulation but I will work on including arm builds in the build process

@AleksanderBrzozowski
Copy link
Contributor Author

Well, I am not sure if the emulation works correctly in this case. When I was testing it a year ago, I had problems trying to make it work 🙂
🤞 you will make some progress on this 🙂

@moscicky
Copy link
Collaborator

I have tested recently that the emulation works.

As for dedicated aarch64 images: hermes images use alpine with adoptopenjdk and the support for alpine/aarch64 in adoptium is not ready yet: adoptium/containers#158

We will monitor this issue and provide aarch64 builds once base images are ready 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants