Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: Add ability to run elasticbeat in a docker container #35

Open
ericslandry opened this issue Feb 21, 2017 · 2 comments

Comments

@ericslandry
Copy link

I'd love to see this beat be docker-able like:
https://github.com/Ingensi/dockbeat

@ericslandry
Copy link
Author

I got it to work by following dockbeat pattern and adding 2 files - Dockerfile and elasticbeat-docker.yml. Not sure how to do a clean PR cause of docker namespacing issues, but here's the quick and dirty (I'm sure these files could be cleaned up a lot).

Dockerfile:

FROM golang:1.7

# install pyyaml
RUN cd /tmp && wget http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz && tar -zxvf PyYAML-3.11.tar.gz
RUN cd /tmp/PyYAML-3.11 && python setup.py install
# install glide
RUN go get github.com/Masterminds/glide

COPY . $GOPATH/src/github.com/radoondas/elasticbeat
RUN cd $GOPATH/src/github.com/radoondas/elasticbeat && make && make

RUN mkdir -p /etc/elasticbeat/ \
    && cp $GOPATH/src/github.com/radoondas/elasticbeat/elasticbeat /usr/local/bin/elasticbeat \
    && cp $GOPATH/src/github.com/radoondas/elasticbeat/elasticbeat-docker.yml /etc/elasticbeat/elasticbeat.yml \
    && cp $GOPATH/src/github.com/radoondas/elasticbeat/etc/elasticbeat.template.json /etc/elasticbeat/

WORKDIR /etc/elasticbeat
ENTRYPOINT elasticbeat

CMD [ "-c", "elasticbeat.yml", "-e" ]

elasticbeat-docker.yml

input:
  period: ${ELASTICBEAT_PERIOD:10} 
  urls:
    - http://${ELASTICBEAT_URL:127.0.0.1:9200}
  stats:
    cluster: ${ELASTICBEAT_CLUSTER:true}
    nodes: ${ELASTICBEAT_NODES:true}
    health: ${ELASTICBEAT_HEALTH:true}
output:
  elasticsearch:
    hosts: ["${ELASTICBEAT_URL:localhost:9200}"]
    template:
      name: "elasticbeat"
      path: "elasticbeat.template.json"
      overwrite: false
shipper:
logging:
  files:
    rotateeverybytes: 10485760 # = 10MB

Then a few docker cmds:

  • docker build -t elasticbeat .
  • docker run -e ELASTICBEAT_URL='192.168.1.2:9200' elasticbeat

@radoondas
Copy link
Owner

Thanks @ericslandry !
I am about to play with docker and your input will be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants