fabric8io / docker-kibana4

4 stars 7 forks source link

The run.sh script for ELASTICSEARCH_SERVICE_NAME is wrong for 4.3.0 #2

Closed chiippy closed 8 years ago

chiippy commented 8 years ago

This has been changed if using the Docker run : sed -i 's|^# elasticsearch.url:.*$|elasticsearch.url: '"\"${ELASTICSEARCH_URL}\""'|' /opt/kibana4/config/kibana.yml

However, if using Kibana4 inside Openshift, then the sed line hasn't been modified :

SVC_HOST=${ELASTICSEARCH_SERVICE_NAME}_SERVICE_HOST
SVC_PORT=${ELASTICSEARCH_SERVICE_NAME}_SERVICE_PORT
sed -i 's|^elasticsearch_url:.*$|elasticsearch_url: '"\"http://${!SVC_HOST}:${!SVC_PORT}\""'|' /opt/kibana4/config/kibana.yml

In Kibana 4.3.0, the elasticsearch URL changed as

# The Elasticsearch instance to use for all your queries.
# elasticsearch.url: "http://localhost:9200"
jimmidyson commented 8 years ago

Thanks! Fixed...

Even if running on OpenShift I'd recommend using the DNS name rather than the service name as this gets rid of service deployment dependencies. Kibana will retry connections to ES if it's not up when it's started, but service env vars won't exist if the ES service isn't created when the Kibana pod is created.

jimmidyson commented 8 years ago

There'll be a new image available soon for 4.3.0 at fabric8/kibana4:v4.3.0_01. & v4.4.0 as well but be aware that requires Elasticsearch 2.2.

chiippy commented 8 years ago

Hi Jimmi Thanks for the quick fix. Just try, but this is still not working. I think you have missed "# " in the sed line. This is in the image

#!/bin/bash                                                                     

if [[ -n "${ELASTICSEARCH_URL}" ]]; then                                        
    sed -i 's|^# elasticsearch\.url:.*$|elasticsearch.url: '"\"${ELASTICSEARCH_U
RL}\""'|' /opt/kibana4/config/kibana.yml                                        
elif [[ -n "${ELASTICSEARCH_SERVICE_NAME}" ]]; then                             
    SVC_HOST=${ELASTICSEARCH_SERVICE_NAME}_SERVICE_HOST                         
    SVC_PORT=${ELASTICSEARCH_SERVICE_NAME}_SERVICE_PORT                         
    sed -i 's|^elasticsearch\.url:.*$|elasticsearch.url: '"\"http://${!SVC_HOST}
:${!SVC_PORT}\""'|' /opt/kibana4/config/kibana.yml                              
fi              

thanks.

jimmidyson commented 8 years ago

Sorry! I'm actually on vacation so can't look at this for a couple of weeks. Happy to accept a PR to fix it. Would be grateful if @rawlingsj or @rhuss could help get this merged/fixed/tagged on docker hub?

rawlingsj commented 8 years ago

@chiippy if you can put a PR together thats tested I can merge and include it in the next release (later today).

rhuss commented 8 years ago

@chiippy @jimmidyson @rawlingsj sorry missed that. Hopefully I can have a look at it later today.

jimmidyson commented 8 years ago

I'm back, albeit jetlagged! I can look now but thanks anyway @rhuss.

rhuss commented 8 years ago

ok ;-). Good to know that the expert is back. welcome ;-)

jimmidyson commented 8 years ago

"Expert"

jimmidyson commented 8 years ago

Should be fixed now - tagging now

jimmidyson commented 8 years ago

v4.3.0_02 & v4.4.0_01 (note ES 2.2.x only) will be available with this fix on Docker hub soon - build details at https://hub.docker.com/r/fabric8/kibana4/builds/.

chiippy commented 8 years ago

Thanks Jimmi. This works nicely.

jimmidyson commented 8 years ago

Glad to hear that - thanks for letting me know.