-
Notifications
You must be signed in to change notification settings - Fork 11
Better support for ES running on OpenShift #1
base: master
Are you sure you want to change the base?
Changes from 6 commits
1ccbea9
0fd74f7
9ad4a71
5e88d68
fbcb9c6
97a2ee8
8de1238
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,22 @@ | ||
| #!/bin/bash | ||
|
|
||
| curl -s https://download.elasticsearch.org/logstash/logstash/logstash-1.4.1.tar.gz | tar xz | ||
| source $OPENSHIFT_CARTRIDGE_SDK_BASH | ||
|
|
||
| if ! [ ${OPENSHIFT_LOGSTASH_ES_HOST} ]; then | ||
| cat >&2 <<-EOF | ||
| Missing env var OPENSHIFT_LOGSTASH_ES_HOST. | ||
| Please execute the following command and try again: | ||
|
|
||
| \$ rhc env set OPENSHIFT_LOGSTASH_ES_HOST=<your.elasticsearch.hostname> -a $OPENSHIFT_APP_NAME -n $OPENSHIFT_NAMESPACE | ||
| EOF | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! [ ${OPENSHIFT_LOGSTASH_ES_PORT} ]; then | ||
| client_result "Env var OPENSHIFT_LOGSTASH_ES_PORT was not found." | ||
| client_result "If your Elasticsearch instance is running under OpenShift, chances are it is bound to port 80 instead 9200." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would it prefer port 80? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check out https:// ES is listening on HTTP in that cartridge. But I agree ES doesn't need to be running on OpenShift. In bin/install
Why would it prefer port 80? —
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Port 80 is the publicly exposed port. In fact I doubt it allows any other external port. |
||
| client_result "If this is the case, please run the following command and restart your app:" | ||
| client_result " \$ rhc env set OPENSHIFT_LOGSTASH_ES_PORT=80 -a $OPENSHIFT_APP_NAME -n $OPENSHIFT_NAMESPACE" | ||
| fi | ||
|
|
||
| curl -s https://download.elasticsearch.org/logstash/logstash/logstash-1.4.1.tar.gz | tar xz | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| input { | ||
|
|
||
| file { | ||
| path => "<%= ENV['OPENSHIFT_LOG_DIR'] %>*.log" | ||
| path => "<%= ENV['OPENSHIFT_PRIMARY_CARTRIDGE_DIR'] %>/logs/*" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This environment variable is not documented here, and it seems
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm running OpenShift release-3, back when OPENSHIFT_LOG_DIR didn't existed yet. Maybe a better approach is to look on both dirs: Please note that old log files may not be using that |
||
| tags => ["<%= ENV['OPENSHIFT_APP_NAME'] %>", "<%= ENV['OPENSHIFT_GEAR_NAME'] %>", "<%= ENV['OPENSHIFT_NAMESPACE'] %>"] | ||
| } | ||
|
|
||
|
|
@@ -13,6 +13,7 @@ output { | |
|
|
||
| elasticsearch_http { | ||
| host => "<%= ENV['OPENSHIFT_LOGSTASH_ES_HOST'] %>" | ||
| port => "<%= ENV['OPENSHIFT_LOGSTASH_ES_PORT'] || 9300 %>" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @caruccio defaults to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a typo-o-matic ;) Fixed. |
||
| <% if ENV['OPENSHIFT_LOGSTASH_ES_USER'] %> | ||
| user => "<%= ENV['OPENSHIFT_LOGSTASH_ES_USER'] %>" | ||
| <% end %> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It need not really be running on OpenShift to have a different port, though. A port config makes sense, though. :)