seyren是一款开源的监控报警系统,采用java开发,从graphite读取指标。下面说一下如何进行docker化运行。

dockerfile

FROM java:8

ADD https://github.com/scobal/seyren/releases/download/1.5.0/seyren-1.5.0.jar /opt/seyren.jar
ADD run-seyren.sh /usr/bin/run-seyren.sh
RUN chmod +x /usr/bin/run-seyren.sh

ENTRYPOINT ["/usr/bin/run-seyren.sh"]
EXPOSE 8080

run-seyren.sh

#!/bin/sh
set -o errexit

if [ -z ${GRAPHITE_URL} ]
   then
       if [ $# -ne 1 ]
       then
           echo "Usage: run-seyren.sh GRAPHITE_URL"
       fi
       export GRAPHITE_URL=$1
fi

export MONGO_URL=mongodb://$MONGODB_PORT_27017_TCP_ADDR:$MONGODB_PORT_27017_TCP_PORT/seyren

echo "Graphite URL $GRAPHITE_URL"
echo "Mongo URL $MONGO_URL"

env

java -jar /opt/seyren.jar

运行

docker run --rm -p 8080:8080 --name seyren \
-e GRAPHITE_URL=http://192.168.99.100:8070 \
-e MONGODB_PORT_27017_TCP_ADDR=192.168.99.100 \
-e MONGODB_PORT_27017_TCP_PORT=27017 \
-e SMTP_HOST=smtp.126.com \
-e SMTP_PORT=25 \
-e SMTP_FROM=xxxx@126.com \
-e SMTP_USERNAME=xxxx \
-e SMTP_PASSWORD=xxxx \
-e SMTP_PROTOCOL=smtp \
-e SLACK_TOKEN=xxxxx \
registry.cn-hangzhou.aliyuncs.com/codecraft/seyren:1.5.0

doc


想获取最新内容,请关注微信公众号
图片描述

codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...