codingchili/excelastic

Problem running docker

matheussl22 opened this issue · 10 comments

I'm running: docker run -it -p 8080:8080 -e es_port=9200 -e es_host=localhost codingchili/excelastic
But, I have problem:

Feb 08, 2019 12:13:14 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: Starting excelastic 1.3.3..
Feb 08, 2019 12:13:14 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: to import files without the web interface use please supply arguments for <fileName> <indexName>
Feb 08, 2019 12:13:14 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: optional arguments: --mapping <mappingName> --offset <number> --clear
Feb 08, 2019 12:13:14 PM com.codingchili.logging.ApplicationLogger applicationStartupFailure
SEVERE: Failed to start application
java.lang.ExceptionInInitializerError
        at com.codingchili.logging.ApplicationLogger.onWriterStarted(ApplicationLogger.java:191)
        at com.codingchili.Model.ElasticWriter.start(ElasticWriter.java:49)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:491)
        at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.vertx.core.json.DecodeException: Failed to decode: No content to map due to end-of-input
 at [Source: (String)""; line: 1, column: 0]
        at io.vertx.core.json.Json.decodeValue(Json.java:120)
        at io.vertx.core.json.JsonObject.fromJson(JsonObject.java:948)
        at io.vertx.core.json.JsonObject.<init>(JsonObject.java:47)
        at com.codingchili.Model.Configuration.getConfiguration(Configuration.java:44)
        at com.codingchili.Model.Configuration.<clinit>(Configuration.java:31)
        ... 10 more

Any help?

Thanks for submitting an issue, I will need to investigate.

Hello,

Updated the docker image in the registry from 1.3.3 to 1.3.5.

I was not able to reproduce the issue.

From the stacktrace it looks like there is an error in the configuration file, we inject environment variables
into the json configuration - maybe it's not working as expected, some junk character from the terminal etc.

Is this still an issue for the updated image?

I updated with version 1.3.5, but not worked yet.
When I run on IDE, worked.

Feb 11, 2019 5:20:13 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: Starting excelastic 1.3.5..
Feb 11, 2019 5:20:13 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: to import files without the web interface use please supply arguments for <fileName> <indexName>
Feb 11, 2019 5:20:13 PM com.codingchili.logging.ApplicationLogger startupMessage
INFO: optional arguments: --mapping <mappingName> --offset <number> --clear
Feb 11, 2019 5:20:14 PM com.codingchili.logging.ApplicationLogger applicationStartupFailure
SEVERE: Failed to start application
java.lang.ExceptionInInitializerError
        at com.codingchili.logging.ApplicationLogger.onWriterStarted(ApplicationLogger.java:191)
        at com.codingchili.Model.ElasticWriter.start(ElasticWriter.java:49)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:494)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320)
        at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.vertx.core.json.DecodeException: Failed to decode: No content to map due to end-of-input
 at [Source: (String)""; line: 1, column: 0]
        at io.vertx.core.json.Json.decodeValue(Json.java:124)
        at io.vertx.core.json.JsonObject.fromJson(JsonObject.java:956)
        at io.vertx.core.json.JsonObject.<init>(JsonObject.java:48)
        at com.codingchili.Model.Configuration.getConfiguration(Configuration.java:46)
        at com.codingchili.Model.Configuration.<clinit>(Configuration.java:32)
        ... 11 more

I'm unable to reproduce it still, can you try the following?

PS C:\Users\chili> docker run --entrypoint "/bin/sh" -it codingchili/excelastic
/opt/excelastic # ls
bootstrap.sh        configuration.json  excelastic.jar
/opt/excelastic # cat configuration.json
{
  "web_port": 8080,
  "elastic_port": $es_port,
  "elastic_host": "$es_host",
  "elastic_tls": $es_tls,
  "default_index": "$default_index",
  "authentication": $es_authentication,
  "basic": "$username:$password"
}
/opt/excelastic # envsubst < configuration.json > configuration.json
/opt/excelastic # cat configuration.json
{
  "web_port": 8080,
  "elastic_port": 9200,
  "elastic_host": "localhost",
  "elastic_tls": false,
  "default_index": "excelastic",
  "authentication": false,
  "basic": "root:root"
}
/opt/excelastic # java -jar excelastic.jar
...

Verify that configuration.json file is not malformed after running envsubst, if it's not malformed it should start up.

I'm try verify too.
I run commands:

/opt/excelastic # docker run --entrypoint "/bin/sh" -it codingchili/excelastic^C
/opt/excelastic # ls
bootstrap.sh        configuration.json  excelastic.jar
/opt/excelastic # cat configuration.json
{
  "web_port": 8080,
  "elastic_port": $es_port,
  "elastic_host": "$es_host",
  "elastic_tls": $es_tls,
  "default_index": "$default_index",
  "authentication": $es_authentication,
  "basic": "$username:$password"
}/opt/excelastic # envsubst < configuration.json > configuration.json
/opt/excelastic # cat configuration.json
/opt/excelastic # java -jar excelastic.jar
Feb 12, 2019 10:05:45 AM com.codingchili.logging.ApplicationLogger startupMessage
INFO: Starting excelastic 1.3.5..
Feb 12, 2019 10:05:45 AM com.codingchili.logging.ApplicationLogger startupMessage
INFO: to import files without the web interface use please supply arguments for <fileName> <indexName>
Feb 12, 2019 10:05:45 AM com.codingchili.logging.ApplicationLogger startupMessage
INFO: optional arguments: --mapping <mappingName> --offset <number> --clear
Feb 12, 2019 10:05:45 AM com.codingchili.logging.ApplicationLogger applicationStartupFailure
SEVERE: Failed to start application
java.lang.ExceptionInInitializerError
        at com.codingchili.logging.ApplicationLogger.onWriterStarted(ApplicationLogger.java:191)
        at com.codingchili.Model.ElasticWriter.start(ElasticWriter.java:49)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:494)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320)
        at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.vertx.core.json.DecodeException: Failed to decode: No content to map due to end-of-input
 at [Source: (String)""; line: 1, column: 0]
        at io.vertx.core.json.Json.decodeValue(Json.java:124)
        at io.vertx.core.json.JsonObject.fromJson(JsonObject.java:956)
        at io.vertx.core.json.JsonObject.<init>(JsonObject.java:48)
        at com.codingchili.Model.Configuration.getConfiguration(Configuration.java:46)
        at com.codingchili.Model.Configuration.<clinit>(Configuration.java:32)
        ... 11 more

/opt/excelastic # 

After run "envsubst" I run command "cat configuration.json", but don't show me more the texts.

Thanks for the info!

How can the same command produce different outcomes for the same image? Docker version and host system? I will try and reproduce it on another system.

There is probably a race condition here with the <> business. We should not write to the same file we are reading from. I remember having this issue before but then dismissing it because it was seemingly working in docker on my machine.

Let's rename configuration.json in /docker to configuration_template.json and update the bootstrap.sh script to read from it, and overwrite configuration.json when run multiple times.

@matheussl22 I updated the docker image on the hub on the latest tag with the change.

8043390

Good work, now is running.
Much thanks!!!

Nice, thanks for the help. 👍