ClusterHQ/docker-images — pull request #10 by wallrj (2014-11-19 19:38:01+00:00)
Title: [FLOC-1013] Add an Elasticsearch connection test to the Logstash startup script

Here's a version of the logstash image which checks that a connection can be established to elasticsearch before starting logstash.

I switched the entrypoint script to python to make things clearer.

I also now exec the logstash binary rather than forking so that logstash can receive signals from docker ...which allows it to be more easily killed when launched as a foreground docker process.

I tested this by
* building the image `docker build --tag clusterhq/logstash `
* running the image in the absence of elastic search `time docker run --interactive --tty --env=ES_PORT_9200_TCP_ADDR=10.0.126.72 --env=ES_PORT_9200_TCP_PORT=9200 clusterhq/logstash`
* running it after starting elastic search `docker run -p 9200:9200 clusterhq/elasticsearch`
* running it after dropping port 9200 packets `sudo iptables -I INPUT -p tcp --dport 9200 -j DROP`
* running it and then starting ES 10s later.

It seems to work.