vert-x3 / vertx-stack

Vert.x stack
Apache License 2.0
120 stars 48 forks source link

Docker solution for SLF4J warning at startup ? #81

Closed StephenOTT closed 6 years ago

StephenOTT commented 6 years ago

As discussed here: http://vertx.io/docs/vertx-core/js/#_troubleshooting

When loading the vertx/vertx3 container

something like:

version: '3.2'

services:
  worker_01:
    build: worker/.
    environment:
      - JAVA_OPTS=-Duser.timezone=America/Montreal
      - VERTICLE_NAME= worker123.js
      # - VERTX_OPTS "-Dvertx.options.eventLoopPoolSize=26 -Dvertx.options.deployment.worker=true"
      - VERTX_ARGS= -ha
    ports:
      - "8081:8080"
    networks:
      - workers

networks:
  workers:
    driver: bridge
# Notice the difference between VERTX_HOME and VERTICLE_HOME.  
# VERTX_HOME is the location of the vertex executable/command

FROM vertx/vertx3-alpine

ENV VERTICLE_HOME /usr/verticles

COPY logging.properties ${VERTICLE_HOME}/logging.properties
ENV VERTX_JUL_CONFIG $VERTICLE_HOME/logging.properties 

# Setup Stack Manager for Vertx
COPY vertx-stack.json ${VERTX_HOME}/vertx-stack.json
# Download and resolve dependencies listed in stack manager
RUN vertx resolve && rm -rf ${HOME}/.m2 

# Setup the cluster Hazelcast configuration
COPY cluster.xml ${VERTICLE_HOME}/cluster.xml

# Copies the starting verticles to the home directory
COPY $VERTICLE_NAME $VERTICLE_HOME/$VERTICLE_NAME
# Copies the sub-verticles into a verticles directory
COPY verticles $VERTICLE_HOME/verticles

# Starts the starting verticle in the home directory
WORKDIR $VERTICLE_HOME
ENTRYPOINT ["sh", "-c"]
CMD ["exec vertx run $VERTICLE_NAME -cp $VERTICLE_HOME/* $VERTX_ARGS"]

The stack manager is being run after the inital startup and thus something like SLF4J-simple is not loaded.

I also see this issue: https://github.com/vert-x3/issues/issues/239 which seems stale at the moment.

Is there a solution to this? The error only occurs when the stack manager runs for the first time as part of a download. Once the cache is generated, it does not throw that error.

If slf4j required as part of the min stack? Docs for this?

I am running vertxs-stack.json as

{ 
  "variables": {
    "jsoup.version": "1.11.2",
    "vertx.version": "3.5.1"
  },
  "dependencies": [
    {
      "groupId": "org.jsoup",
      "artifactId": "jsoup",
      "version": "${jsoup.version}",
      "included": true
    },
    {
      "groupId": "io.vertx",
      "artifactId": "vertx-core",
      "version": "${vertx.version}",
      "included": true
    },
    {
      "groupId": "io.vertx",
      "artifactId": "vertx-lang-js",
      "version": "${vertx.version}",
      "included": true
    },
    {
      "groupId": "io.vertx",
      "artifactId": "vertx-web",
      "version": "${vertx.version}",
      "included": true
    },
    {
      "groupId": "io.vertx",
      "artifactId": "vertx-hazelcast",
      "version": "${vertx.version}",
      "included": true
    }
  ]
}
tsegismont commented 6 years ago

So you get the warning when you run vertx resolve, correct? Do you still get it when the image is ready?

StephenOTT commented 6 years ago

Once image is ready it does not appear. Does not appear when building he image and the jars are already cached.

tsegismont commented 6 years ago

Then I guess we can't do much. The problem is known (due to some dependencies forcing slf4j) and tracked in vert-x3/issues#239

StephenOTT commented 6 years ago

k will track in 239

thanks