eshepelyuk / cmak-docker

CMAK (prev. Kafka Manager) and cmak2zk docker images
Apache License 2.0
221 stars 75 forks source link

application.home_IS_UNDEFINED #5

Closed cen1 closed 5 years ago

cen1 commented 5 years ago

There are error logs in default configuration, not being able to open the log file. After extending my compose:

command: ["-Dpidfile.path=/dev/null", "-Dapplication.home=/kafka-manager"]

the home is set properly and log files are found. Both parameters should probably be predefined in Dockerfile so we don't have to override in run/compose..

hleb-albau commented 5 years ago

@cen1 Yeah, nice catch! Do you want to provide PR on your own?

cen1 commented 5 years ago

I would already do it but I am having weird issue building the image:

docker build -t kafka-manager-docker .
...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.codehaus.plexus#plexus-utils;3.0.20!plexus-utils.jar
[warn]  :: org.apache.commons#commons-compress;1.14!commons-compress.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: download failed: org.codehaus.plexus#plexus-utils;3.0.20!plexus-utils.jar
download failed: org.apache.commons#commons-compress;1.14!commons-compress.jar
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:294)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
    at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
    at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
    at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
    at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
    at xsbt.boot.Using$.withResource(Using.scala:10)
    at xsbt.boot.Using$.apply(Using.scala:9)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
    at sbt.IvySbt.withIvy(Ivy.scala:127)
    at sbt.IvySbt.withIvy(Ivy.scala:124)
    at sbt.IvySbt$Module.withModule(Ivy.scala:155)
    at sbt.IvyActions$.updateEither(IvyActions.scala:168)
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1392)
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1388)
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1422)
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1420)
    at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1425)
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1419)
    at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
    at sbt.Classpaths$.cachedUpdate(Defaults.scala:1442)
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1371)
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1325)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
[error] (*:update) sbt.ResolveException: download failed: org.codehaus.plexus#plexus-utils;3.0.20!plexus-utils.jar
[error] download failed: org.apache.commons#commons-compress;1.14!commons-compress.jar

Any ideas?

hleb-albau commented 5 years ago

@cen1 Yeah, maven-sbt system not so stable. I already struggled a lot with the same issue. https://hub.docker.com/r/hlebalbau/kafka-manager/builds?page=2 I just keep trying and after some time it was able to download all dependencies. You can try to mount your local maven cache directory into a container, thus between rebuilding dependencies will be persisted. Also, we can change the script a bit, to add download retry something like there

cen1 commented 5 years ago

The weirdest thing is that for me it failed 3 times at exactly the same spot (plexus). This doesn't seem to be just flaky connection. I'll play around with it some more. One possible solution would also be to add additional repos.

hleb-albau commented 5 years ago

@cen1 I tried to build a container and got the same plexus download error. It definitely problems with their maven repository. Also, kafka manager repo itself contains issue regarding bad building experience. We need to find a way to manage this error.

cen1 commented 5 years ago

I tried several things.

I seperated the source download run so the build failure preserves the layer at least. Then I followed the suggestion you linked but added build in a while loop instead of multiple RUN commands. This now nicely restarts the build on failure. I think I need to add a retry counter at least just in case so it doesn't build in infinity for a broken version.

https://github.com/cen1/kafka-manager-docker/tree/feature/robustBuilds

hleb-albau commented 5 years ago

@cen1 Nice move! I try to find any sbt command to just download dependencies, but as I understand from here, it is not possible. So simple counter will help, just need to select reasonable counter stop value.

cen1 commented 5 years ago

From a few test runs it seems to build in 1 retry so 5 is probably more than enough. I'll make a pull request once I have everything ready. I guess the failure is either unstable longstanding connections or rate limiting in certain repos.

hleb-albau commented 5 years ago

Fixed. Thanks!