-
Notifications
You must be signed in to change notification settings - Fork 217
Description
I am working to use the bitsensor Elastalert for Docker setup. Unfortunately I have to build on a Windows WSL Linux. My corporate RHEL servers don't have a high enough version of Docker to build there, and I can't upgrade them.
I am able to build an image using Dockerfile from pull request #174. This is working great to build. I docker save the image and move it to my RHEL server. Loading the image is fine, but running it I am getting the following error.
Any guidance would be appreciated. I am not too familiar with Python to understand the versioning and packaging.
server:/elk/docker> dc_reup elastalert
No stopped containers
Creating elastalert ... done
Creating elastalert ...
Attaching to elastalert
elastalert |
elastalert | > @bitsensor/[email protected] start /opt/elastalert-server
elastalert | > sh ./scripts/start.sh "sh" "./scripts/start.sh"
elastalert |
: not found | ./scripts/start.sh: line 2:
"lastalert | bunyan: error: unknown output mode: "short
elastalert | events.js:292
elastalert | throw er; // Unhandled 'error' event
elastalert | ^
elastalert |
elastalert | Error: write EPIPE
elastalert | at afterWriteDispatched (internal/stream_base_commons.js:154:25)
elastalert | at writeGeneric (internal/stream_base_commons.js:145:3)
elastalert | at Socket._writeGeneric (net.js:782:11)
elastalert | at Socket._write (net.js:794:8)
elastalert | at writeOrBuffer (_stream_writable.js:352:12)
elastalert | at Socket.Writable.write (_stream_writable.js:303:10)
elastalert | at Logger._emit (/opt/elastalert-server/node_modules/bunyan/lib/bunyan.js:923:22)
elastalert | at Logger.info (/opt/elastalert-server/node_modules/bunyan/lib/bunyan.js:1045:24)
elastalert | at Logger.info (/opt/elastalert-server/src/common/logger/index.js:9:5)
elastalert | at /opt/elastalert-server/src/common/config/server_config.js:115:22
elastalert | Emitted 'error' event on Socket instance at:
elastalert | at emitErrorNT (internal/streams/destroy.js: 100:8)
elastalert | at emitErrorCloseNT (internal/streams/destroy.js:68:3)
elastalert | at processTicksAndRejections (internal/process/task_queues.js:84:21) {
elastalert | errno: -32,
elastalert | code: 'EPIPE',
elastalert | syscall: 'write'
elastalert | }
elastalert | npm ERR! code ELIFECYCLE
elastalert | npm ERR! errno 1
elastalert | npm ERR! @bitsensor/[email protected] start:sh ./scripts/start.sh "sh" "./scripts/start.sh"
elastalert | npm ERR! Exit status 1
elastalert | npm ERR!
elastalert | npm ERR! Failed at the @bitsensor/[email protected] start script.
elastalert | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
elastalert exited with code 1
My Dockerfile is below.
FROM alpine:3.11 as py-ea
ARG ELASTALERT_VERSION=v0.2.4
ENV ELASTALERT_VERSION=${ELASTALERT_VERSION}
# URL from which to download Elastalert.
ARG ELASTALERT_URL=https://github.com/Yelp/elastalert/archive/$ELASTALERT_VERSION.zip
ENV ELASTALERT_URL=${ELASTALERT_URL}
# Elastalert home directory full path.
ENV ELASTALERT_HOME /opt/elastalert
WORKDIR /opt
RUN apk add --update --no-cache ca-certificates openssl-dev openssl python3-dev python3 py3-pip py3-yaml libffi-dev gcc musl-dev wget && \
# Download and unpack Elastalert.
wget -O elastalert.zip "${ELASTALERT_URL}" && \
unzip elastalert.zip && \
rm elastalert.zip && \
mv e* "${ELASTALERT_HOME}"
WORKDIR "${ELASTALERT_HOME}"
# Install Elastalert.
RUN python3 setup.py install
FROM node:14-alpine
LABEL maintainer="BitSensor <[email protected]>"
# Set timezone for this container
ENV TZ Etc/UTC
RUN apk add --update --no-cache curl tzdata python3 make libmagic && \
ln -s /usr/bin/python3 /usr/bin/python
COPY --from=py-ea /usr/lib/python3.8/site-packages /usr/lib/python3.8/site-packages
COPY --from=py-ea /opt/elastalert /opt/elastalert
COPY --from=py-ea /usr/bin/elastalert* /usr/bin/
WORKDIR /opt/elastalert-server
COPY . /opt/elastalert-server
RUN npm install --production --quiet
COPY config/elastalert.yaml /opt/elastalert/config.yaml
COPY config/elastalert-test.yaml /opt/elastalert/config-test.yaml
COPY config/config.json config/config.json
COPY rule_templates/ /opt/elastalert/rule_templates
COPY elastalert_modules/ /opt/elastalert/elastalert_modules
# Add default rules directory
# Set permission as unpriviledged user (1000:1000), compatible with Kubernetes
RUN mkdir -p /opt/elastalert/rules/ /opt/elastalert/server_data/tests/ \
&& chown -R node:node /opt
USER node
EXPOSE 3030
ENTRYPOINT ["npm", "start"]