pblittle / docker-logstash

Docker image for Logstash 1.4
https://hub.docker.com/r/pblittle/docker-logstash
MIT License
236 stars 90 forks source link

Allow ability to define which Logstash services are run #61

Closed aidan- closed 9 years ago

aidan- commented 9 years ago

Allow users to specify which services they want to run on docker run, eg:

docker run --rm -ti --name log -p 9292:9292 pblittle/docker-logstash web

to only enable the kibana web interface.


I have been running a similar version to this diff for a couple of weeks now so I could use this container to check my Logstash configuration (using the agent --configtest parameters) as part of our internal CI process. After reading #57 it is clear that others would benefit from this functionality so I have expanded it to include other levels of Logstash operation (from looking at the command-line flags).

I've kept it quite verbose rather than building up a $CMD variable and executing it at the end as to keep it simple and easy to read if additional functionality needs to be added in the future.

At the moment it supports 4 modes of operation:

  1. agent - only run the Logstash agent
  2. configtest - run the agent with --configtest
  3. web - only run the Kibana web interface
  4. default, nothing, anything else. - run both the agent and web

I have kept the behaviour of no command the same as it is now to reduce impact when people upgrade.

aidan- commented 9 years ago

Please ignore the previously closed PR, I screwed it up.

pblittle commented 9 years ago

@aidan- thanks for the PR. I think this is a great idea. I don't have much free time tonight, but I will look over it tomorrow.

A few quick thoughts are that we'll need documentation and tests. I have a pretty basic test suite now that you can tie into.

For what it's worth, I'm considering moving to the Bats test framework in the near future.

pblittle commented 9 years ago

@aidan- I merged my latest changes into the develop branch this AM. Part of my push included moving the logstash related functions to a new logstash.sh file. This change cleaned up bin/boot significantly.

Do you mind rebasing your develop branch to get my changes. The end result should move your logstash_start_agent changes to the new location?

pblittle commented 9 years ago

@aidan- are you still interested in merging this feature in? I don't mind rebasing your changes onto the current develop branch.

aidan- commented 9 years ago

I'll try get this sorted out today.

aidan- commented 9 years ago

Alright, that should look a lot better now, @pblittle .

pblittle commented 9 years ago

@aidan- thanks for this PR. I appreciate it. I still need documentation and some basic tests before I release it. I should be able to work on the tests this week.