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 #1644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julianvmodesto
Copy link

@julianvmodesto julianvmodesto commented Apr 12, 2018

Addresses #1535.

Tested with

# build Docker image
$ docker build . -t yelp/elastalert
...

# test Docker image by printing help output
$ docker run --rm yelp/elastalert:mine python -m elastalert -h
usage: elastalert.py [-h] [--config CONFIG] [--debug] [--rule RULE]
                     [--silence SILENCE] [--start START] [--end END]
                     [--verbose] [--patience TIMEOUT] [--pin_rules]
                     [--es_debug] [--es_debug_trace ES_DEBUG_TRACE]
...

@julianvmodesto
Copy link
Author

Could a maintainer please set up a Docker automated build based off of this Dockerfile after merging? It should build from this Dockerfile with docker build . and tag it with each git commit and tag (release).

https://hub.docker.com/u/yelp/
https://docs.docker.com/docker-hub/builds/

@julianvmodesto
Copy link
Author

@Qmando

@hackery
Copy link

hackery commented Sep 4, 2018

@julianvmodesto This works for me, but only if the elastalert_* indices are already created in ES; what's the preferred way with this to run elastalert-create-index within the container? These, for example, don't work:

$ docker run --rm julianvmodesto/elastalert elastalert-create-index
Traceback (most recent call last):
...
ImportError: No module named elastalert.create_index

$ docker run --rm julianvmodesto/elastalert python -m elastalert.create_index
/usr/bin/python: No module named elastalert.create_index

This is the best I've found, but seems unwieldy:

$ docker run --rm julianvmodesto/elastalert python /opt/elastalert/create_index.py --host $ESHOST --port 9200 --no-ssl --no-auth --url-prefix '' --index elastalert --old-index ''

@kshcherban
Copy link

Here's a bit improved Dockerfile based on https://github.com/bitsensor/elastalert/blob/master/Dockerfile

FROM alpine:3.8 as build

ENV ELASTALERT_HOME /opt/elastalert
WORKDIR "${ELASTALERT_HOME}"

RUN apk add --update --no-cache ca-certificates openssl-dev openssl python2-dev python2 py2-pip py2-yaml libffi-dev gcc musl-dev libmagic

COPY . ./

RUN pip install --upgrade pip && \
    pip install -r requirements.txt && \
    python setup.py install

RUN elastalert-test-rule --help && elastalert --help

# Multistage build, copy build results from first intermediate image
FROM alpine:3.8

ENV ELASTALERT_HOME /opt/elastalert
WORKDIR "${ELASTALERT_HOME}"

RUN apk add --update --no-cache python2 libmagic
COPY --from=build /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages
COPY --from=build /opt/elastalert /opt/elastalert
COPY --from=build /usr/bin/elastalert* /usr/bin/

ENTRYPOINT ["/usr/bin/elastalert"]

@thommor
Copy link
Contributor

thommor commented Jan 25, 2019

@Qmando Any update on this being merged?

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.

4 participants