fabric8io-images / s2i

OpenShift S2I images for Java and Karaf applications
Apache License 2.0
70 stars 84 forks source link

Why isn't Jolokia accessible? #141

Closed tadayosi closed 6 years ago

tadayosi commented 6 years ago

I tried s2i/java/example with Docker as follows:

cd s2i/java/example
s2i build --copy . fabric8/s2i-java fabric8/s2i-java-example
docker run -d -p 8080:8080 -p 8778:8778 -e AB_JOLOKIA_USER=admin -e AB_JOLOKIA_PASSWORD=admin --name s2i-java-example fabric8/s2i-java-example

The app looks working fine, as http://localhost:8080 returns hello, world. However, accessing Jolokia endpoint doesn't work:

$ curl -v -u admin:admin http://localhost:8778/jolokia/version
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8778 (#0)
* Server auth using Basic with user 'admin'
> GET /jolokia/version HTTP/1.1
> Host: localhost:8778
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
* Authentication problem. Ignoring this.
< Www-authenticate: Basic realm="jolokia"
< Date: Thu, 19 Apr 2018 02:53:27 GMT
< Content-length: 0
< 
* Connection #0 to host localhost left intact
tadayosi commented 6 years ago

Hmm, looks like I also need the env var AB_JOLOKIA_PASSWORD_RANDOM=false with the docker run command to make it work. Is it something documented somewhere?

rhuss commented 6 years ago

Env variables are describe here: https://github.com/fabric8io/agent-bond/blob/master/fish-pepper/jolokia/readme.md but AB_JOLOKIA_PASSWORD_RANDOM is not enabled by default (??)

Actually, I'm not happy with 'agent bond' anymore, which was a good idea at that time, but is not anymore. Instead, Jolokia and Prometheus should be configured/enabled individually, and we should cut out this middleman.

We have already partially moved away, but we should split up and then close the agent-bond repo soon.

rhuss commented 6 years ago

Ah, its because of this https://github.com/fabric8io-images/s2i/blob/38a32aaa6cf27de26939ccacdc44607bad562d57/java/templates/Dockerfile#L9

This has todo with the healthcheck we generate internally. I have to revive my memories how the while flow actually is.

vorburger commented 6 years ago

I don't about Jolokia, but am just happy that my s2i/java/example is helpful as a simple reproducer! :smiley:

tadayosi commented 6 years ago

@rhuss Thanks for the info. A bit surprised to hear that agent-bond will retire soon as I've been just getting used to this cool agent 😄 Good to know that anyway.

@vorburger Yes, it's really helpful. I like this simple example that I can play with 😄

rhuss commented 6 years ago

@tadayosi sorry for the bad news ;-( But I/we feel that the benefits of having a single agent compared to the maintenance cost to create a new agent-bond if either jmx_exporter or jolokia changes versions are really negligible. So its probably better to cut out that middleman.

That said, and with regard to the load of work I'm currently burried under, this change won't come soon though ;-)