logzio / zipkin-logzio

A logz.io storage option for Zipkin
Apache License 2.0
5 stars 0 forks source link

Dockerfile support? #13

Closed omerlh closed 5 years ago

omerlh commented 5 years ago

I'm trying to create a dockerfile with this plugin. Tried the following:

FROM alpine as base

WORKDIR /zipkin

RUN apk add unzip curl --no-cache && \
    curl -sSL https://jitpack.io/com/github/logzio/zipkin-logzio/zipkin-autoconfigure-storage-logzio/master-0.0.2/zipkin-autoconfigure-storage-logzio-master-0.0.2-module.jar > logzio.jar 

FROM quay.io/openzipkin/zipkin
WORKDIR /zipkin
COPY --from=base /zipkin/logzio.jar .

ENV JAVA_OPTS="-Dloader.path='logzio.jar,logzio.jar!lib' -Dspring.profiles.active=logzio"
ENV STORAGE_TYPE=logzio

But I can't make it work - getting the following error when running:

Exception in thread "main" java.lang.IllegalArgumentException: File /zipkin/'logzio.jar must exist
        at org.springframework.boot.loader.data.RandomAccessDataFile$FileAccess.openIfNecessary(RandomAccessDataFile.java:232)
        at org.springframework.boot.loader.data.RandomAccessDataFile$FileAccess.<init>(RandomAccessDataFile.java:214)
        at org.springframework.boot.loader.data.RandomAccessDataFile$FileAccess.<init>(RandomAccessDataFile.java:204)
        at org.springframework.boot.loader.data.RandomAccessDataFile.<init>(RandomAccessDataFile.java:49)
        at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:88)
        at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:60)
        at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:56)
        at org.springframework.boot.loader.PropertiesLauncher.getArchive(PropertiesLauncher.java:486)
        at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:462)
        at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:433)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
        at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:577)
yyyogev commented 5 years ago

@omerlh try removing the single quote around the loader path like so: ENV JAVA_OPTS="-Dloader.path=logzio.jar,logzio.jar!lib -Dspring.profiles.active=logzio"

omerlh commented 5 years ago

This solved it, but now I'm experiencing a new error:

Exception in thread "main" java.util.zip.ZipException: zip END header not found
        at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1535)
        at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1436)
        at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1443)
        at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1274)
        at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1237)
        at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:825)
        at java.base/java.util.zip.ZipFile$CleanableResource$FinalizableResource.<init>(ZipFile.java:851)
        at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:840)
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:346)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:317)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:283)
        at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:116)
        at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:111)
        at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:97)
        at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:88)
        at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:60)
        at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:56)
        at org.springframework.boot.loader.PropertiesLauncher.getArchive(PropertiesLauncher.java:486)
        at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:462)
        at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:433)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
        at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:577)
yyyogev commented 5 years ago

@omerlh could you share the full dockerfile?

omerlh commented 5 years ago

The is the entire file, based upon Zipkin official dockerfile.

yyyogev commented 5 years ago

@omerlh try this:


WORKDIR /zipkin-logzio

RUN apk add curl unzip && \
  curl -sSL https://jitpack.io/com/github/logzio/zipkin-logzio/zipkin-autoconfigure-storage-logzio/master-SNAPSHOT/zipkin-autoconfigure-storage-logzio-master-SNAPSHOT-module.jar > logzio.jar && \
  unzip logzio.jar -d logzio && \
  rm logzio.jar

FROM openzipkin/zipkin:2.15.0
MAINTAINER OpenZipkin "https://zipkin.io/"

COPY --from=0 /zipkin-logzio/ /zipkin/

ENV STORAGE_TYPE=logzio
ENV LOGZIO_ACCOUNT_TOKEN=<ACCOUNT TOKEN>
ENV LOGZIO_API_TOKEN=<API TOKEN>
ENV QUERY_ENABLED false

env MODULE_OPTS="-Dloader.path=logzio -Dspring.profiles.active=logzio"

Edit the parameters before you build according to our readme

omerlh commented 5 years ago

Thanks! Look like it worked, do you want me to open a PR with the dockerfile for future reference?

yyyogev commented 5 years ago

No thanks, we'll do it in the future with external config file instead of the hard-coded parameters. Glad it worked :)

omerlh commented 5 years ago

I don't know why, but all of a sudden it stopped working... Going back to the original error:

/zipkin # java -Dloader.path=logzio -Dspring.profiles.active=logzio -Djava.security.egd=file:/dev/./urandom -cp . org.
springframework.boot.loader.PropertiesLauncher
                                    ********
                                  **        **
                                 *            *
                                **            **
                                **            **
                                 **          **
                                  **        **
                                    ********
                                      ****
                                      ****
        ****                          ****
     ******                           ****                                 ***
  ****************************************************************************
    *******                           ****                                 ***
        ****                          ****
                                       **
                                       **

             *****      **     *****     ** **       **     **   **
               **       **     **  *     ***         **     **** **
              **        **     *****     ****        **     **  ***
             ******     **     **        **  **      **     **   **

:: Powered by Spring Boot ::         (v2.1.6.RELEASE)

2019-07-18 05:53:24.641  INFO 130 --- [           main] z.s.ZipkinServer                         : Starting ZipkinServer on e1f99be0e4c7 with PID 130 (/zipkin/BOOT-INF/classes started by root in /zipkin)
2019-07-18 05:53:24.649  INFO 130 --- [           main] z.s.ZipkinServer                         : The following profiles are active: shared,logzio
2019-07-18 05:53:28.443  WARN 130 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkin2.server.internal.ZipkinServerConfiguration': Unsatisfied dependency expressed through field 'httpCollector'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkin2.server.internal.ZipkinHttpCollector': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'zipkin2.storage.StorageComponent' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2019-07-18 05:53:28.565  INFO 130 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-18 05:53:29.924 ERROR 130 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in zipkin2.server.internal.ZipkinHttpCollector required a bean of type 'zipkin2.storage.StorageComponent' that could not be found.

The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=false)

The following candidates were found but could not be injected:
        - Bean method 'storage' in 'ZipkinCassandraStorageConfiguration' not loaded because @ConditionalOnProperty (zipkin.storage.type=cassandra) found different value in property 'zipkin.storage.type'
        - Bean method 'storage' in 'ZipkinCassandra3StorageConfiguration' not loaded because @ConditionalOnProperty (zipkin.storage.type=cassandra3) found different value in property 'zipkin.storage.type'
        - Bean method 'storage' in 'ZipkinElasticsearchStorageAutoConfiguration' not loaded because @ConditionalOnProperty (zipkin.storage.type=elasticsearch) found different value in property 'zipkin.storage.type'
        - Bean method 'storage' in 'ZipkinMySQLStorageConfiguration' not loaded because @ConditionalOnProperty (zipkin.storage.type=mysql) found different value in property 'zipkin.storage.type'

Action:

Consider revisiting the entries above or defining a bean of type 'zipkin2.storage.StorageComponent' in your configuration.

This is when running the exact command in the container. I checked and the jar is in the directory:

image

yyyogev commented 5 years ago

Did you change anything from the time it worked?

omerlh commented 5 years ago

No, did you get it working?

yyyogev commented 5 years ago

Yes, with the dockerfile I gave you above.. And I thought you got it working as well

Thanks! Look like it worked, do you want me to open a PR with the dockerfile for future reference?

omerlh commented 5 years ago

Sorry no... anyway, I'm moving for Jaeger and I'll just wait until there will be support also there :)

yyyogev commented 4 years ago

@omerlh we now support Jaeger as well :)