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

Add Dockerfile for an Alpine Linux based image. #408

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

GerardoNevarez
Copy link

I've been using a small (65Mb) elastalert Docker image for basic monitoring on our test EFK stack (Elasticsearch-Fluentd-Kibana). The image clones the Yelp/elastalert repo and builds everything from source. To build it:

docker build --no-cache=true -t elastalert:onbuild .

The resulting image can be the base for an environment specific image: a new Dockerfile (below) must reference it, and the config.yaml and rules (inside a /rules folder) would be added as a new layer.

FROM elastalert:onbuild

The image can also be executed with a mounted config.yaml and rules folder. First step is creating the ES index for elastalert:

docker run --rm -v /opt/elastalert/config.yaml:/opt/elastalert/config.yaml -v /opt/elastalert/rules:/opt/elastalert/rules elastalert:onbuild bash -c "elastalert-create-index"

and then run a container:

docker run -d --name elastalert -v /opt/elastalert/config.yaml:/opt/elastalert/config.yaml -v /opt/elastalert/rules:/opt/elastalert/rules elastalert:onbuild

Although my current approach is mounting rules and config from a local volume, some additional ENV variables could be added to customize it (i.e. retrieve config.yaml from a remote URL, ES url, etc)

Might be a starting point for a small, official image in the future. Thoughts?

Gerardo

Dockerfile Outdated
rm -rf /usr/src/elastalert && \
apk del python-dev git && \
rm -rf /var/cache/apk/* && \
cp /usr/share/zoneinfo/America/New_York /etc/localtime && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this read the timezone from the build machine instead of hardcoding EST?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want things like timezone setting, I suggest you look at https://github.com/krizsan/elastalert-docker and see if you can bring in some of what is done there, such as checking if the Elastalert index exists in Elasticsearch and create it if it does not. That project also does allows for setting timezone.

But maybe this project already does than anyways? In either case, I think an alpine linux container

@bean5
Copy link
Contributor

bean5 commented Sep 6, 2017

Anything blocking this besides the hardcoded timezone?

@bean5
Copy link
Contributor

bean5 commented Jul 24, 2024

@GerardoNevarez . Sorry I missed @mentioning the first time around.

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

Successfully merging this pull request may close these issues.

3 participants