the latest docker image has problem with embedded mongodb.
dingxiong opened this issue · 7 comments
Hey guys, I am deploying diffy to AWS EKS. and the config is like below
containers:
- name: diffy
image: diffy/diffy:latest
imagePullPolicy: IfNotPresent
command:
- java
- -jar
- "/diffy.jar"
- "--candidate=server.production-diffy-candidate.svc.cluster.local:8000"
- "--master.primary=server.production-diffy-primary.svc.cluster.local:8000"
- "--master.secondary=server.production-diffy-primary.svc.cluster.local:8000"
- "--responseMode=primary"
- "--service.protocol=http"
- "--proxy.port=8880"
- "--http.port=8888"
- "--rootUrl=localhost:8888"
- --serviceName="server"
- --excludeHttpHeadersComparison=true
- --allowHttpSideEffects=true
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "4Gi"
cpu: "1000m"
ports:
- containerPort: 8880
- containerPort: 8888
The container keeps crashing, the error logs are
2023-01-20 04:59:16.052 ERROR [diffy,,] 1 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : /tmp/extract-6e0a6762-ebcf-4592-9915-f0ff4ba607aaextractmongod: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/extract-6e0a6762-ebcf-4592-9915-f0ff4ba607aaextractmongod)
2023-01-20 04:59:16.052 ERROR [diffy,,] 1 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : /tmp/extract-6e0a6762-ebcf-4592-9915-f0ff4ba607aaextractmongod: /lib64/libcurl.so.4: no version information available (required by /tmp/extract-6e0a6762-ebcf-4592-9915-f0ff4ba607aaextractmongod)
2023-01-20 04:59:36.055 WARN [diffy,,] 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiController' defined in URL [jar:file:/diffy.jar!/BOOT-INF/classes!/ai/diffy/ApiController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noiseRepository' defined in ai.diffy.repository.NoiseRepository defined in @EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration: Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryDependentConfiguration.class]: Unsatisfied dependency expressed through method 'mongoTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoDatabaseFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryConfiguration.class]: Unsatisfied dependency expressed through method 'mongoDatabaseFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Could not start process: <EOF>
2023-01-20 04:59:36.075 INFO [diffy,,] 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-01-20 04:59:36.124 INFO [diffy,,] 1 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-01-20 04:59:36.190 ERROR [diffy,,] 1 --- [ main] o.s.boot.SpringApplication : Application run failed
Any clue on where the problem is?
I am getting the same issue with latest image. @dingxiong - Did you get any solution for it?
@abhishek1811 I ended up forking this repo and started from an old commit to implement what I need.
@dingxiong - Can you share any details which commit you used? Do you have docker image for your fix? I can trying to POC this tool and just want to deploy it to K8.
I got this working with following Dockerfile:
# build image
FROM maven:3.8.6-openjdk-18 as builder
ENV HOME=/usr/local/src
RUN mkdir -p $HOME
WORKDIR $HOME
# install cached version of pom.xml
ADD maven_docker_cache.xml $HOME
RUN mvn verify -f maven_docker_cache.xml --fail-never
# install node v16.14.0 and yarn v1.22.19
RUN mvn com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v16.14.0 -DyarnVersion=v1.22.19 -f maven_docker_cache.xml
# install dependencies in frontend/package.json
RUN mkdir -p $HOME/frontend
ADD frontend/package.json $HOME/frontend
RUN mvn com.github.eirslett:frontend-maven-plugin:yarn -f maven_docker_cache.xml
# install dependencies in pom.xml
ADD pom.xml $HOME
RUN mvn verify --fail-never
# finally, copy, compile, bundle, and package everything
ADD . $HOME
RUN mvn package
RUN ls
RUN mv target /target
RUN mv agent /agent
# production image
FROM openjdk:17.0.2-jdk-bullseye
# FROM openjdk:8-jre-alpine
COPY --from=builder /target/diffy.jar /diffy.jar
#COPY --from=builder /agent/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar
ENTRYPOINT ["java", "-jar", "diffy.jar"]
CMD []
Fixed this by changing maven:3.8.6-openjdk-18
to maven:3.8-eclipse-temurin-17-focal
in the Dockerfile
side track question, is it possible to connect to an external mongo DB?