Compare commits

..

No commits in common. "6d079718167361eda96df2688f2e6e6ecdba0a71" and "ee41e013de4b7316c9cebb07ae6ccff11c7cdd75" have entirely different histories.

4 changed files with 34 additions and 44 deletions

View File

@ -10,6 +10,7 @@ steps:
from_secret: docker_username from_secret: docker_username
password: password:
from_secret: docker_password from_secret: docker_password
auto_tag: true
tags: tags:
- ${DRONE_COMMIT_SHA} - ${DRONE_COMMIT_SHA}
- ${DRONE_BRANCH} - ${DRONE_BRANCH}

View File

@ -1,21 +1,16 @@
FROM debian:stretch FROM debian:jessie
ADD scripts/build.sh /build.sh ADD scripts/build.sh /build.sh
ADD scripts/run.sh /run.sh ADD scripts/run.sh /run.sh
RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh
RUN touch /etc/netdata/.opt-out-from-anonymous-statistics
WORKDIR / WORKDIR /
ENV NETDATA_PORT=19999 SMTP_TLS=on SMTP_STARTTLS=on SMTP_SERVER=smtp.example.com SMTP_PORT=587 SMTP_FROM=localhost ENV NETDATA_PORT=19999 SSMTP_TLS=YES SSMTP_SERVER=smtp.gmail.com SSMTP_PORT=587 SSMTP_HOSTNAME=localhost
# supposedly it now respects this
ENV DO_NOT_TRACK=1 ENV DO_NOT_TRACK=1
EXPOSE $NETDATA_PORT EXPOSE $NETDATA_PORT
VOLUME /etc/netdata/override
ENTRYPOINT ["/run.sh"] ENTRYPOINT ["/run.sh"]

View File

@ -2,20 +2,22 @@
set -e set -e
DEBIAN_FRONTEND=noninteractive DEBIAN_FRONTEND=noninteractive
# belt and suspenders # some mirrors have issues, i skipped httpredir in favor of an eu mirror
export DO_NOT_TRACK=1
echo "deb http://ftp.nl.debian.org/debian/ jessie main" > /etc/apt/sources.list
echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list
# install dependencies for build # install dependencies for build
apt-get -qq update apt-get -qq update
apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq libuv1-dev liblz4-dev libjudy-dev libssl-dev apt-get -y install zlib1g-dev uuid-dev libmnl-dev gcc make curl git autoconf autogen automake pkg-config netcat-openbsd jq
apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml libjudydebian1 libuv1 liblz4-1 openssl apt-get -y install autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml
apt-get -y install msmtp msmtp-mta apcupsd fping apt-get -y install ssmtp mailutils apcupsd
# fetch netdata # fetch netdata
git clone https://github.com/netdata/netdata.git /netdata.git git clone https://github.com/netdata/netdata.git /netdata.git
cd /netdata.git cd /netdata.git
# v1.19.0 release:
git checkout 5000257f0171271cb3ee2cf0fe02e8a2154ddf2e git checkout 5000257f0171271cb3ee2cf0fe02e8a2154ddf2e
# use the provided installer # use the provided installer
@ -24,18 +26,23 @@ git checkout 5000257f0171271cb3ee2cf0fe02e8a2154ddf2e
touch /etc/netdata/.opt-out-from-anonymous-statistics touch /etc/netdata/.opt-out-from-anonymous-statistics
# removed hack on 2017/1/3
#chown root:root /usr/libexec/netdata/plugins.d/apps.plugin
#chmod 4755 /usr/libexec/netdata/plugins.d/apps.plugin
# remove build dependencies # remove build dependencies
cd / cd /
rm -rf /netdata.git rm -rf /netdata.git
dpkg -P zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autogen automake pkg-config libuv1-dev liblz4-dev libjudy-dev libssl-dev dpkg -P zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autogen automake pkg-config
apt-get -y autoremove apt-get -y autoremove
apt-get clean apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# symlink access log and error log to stdout/stderr # symlink access log and error log to stdout/stderr
ln -sf /dev/stdout /var/log/netdata/access.log ln -sf /dev/stdout /var/log/netdata/access.log
ln -sf /dev/stdout /var/log/netdata/debug.log ln -sf /dev/stdout /var/log/netdata/debug.log
ln -sf /dev/stderr /var/log/netdata/error.log ln -sf /dev/stderr /var/log/netdata/error.log

View File

@ -4,41 +4,34 @@
chown root:root /usr/share/netdata/web/ -R chown root:root /usr/share/netdata/web/ -R
echo -n "" > /usr/share/netdata/web/version.txt echo -n "" > /usr/share/netdata/web/version.txt
# set up msmtp # set up ssmtp
if [[ $SMTP_TO ]]; then if [[ $SSMTP_TO ]]; then
cat << EOF > /etc/msmtprc cat << EOF > /etc/ssmtp/ssmtp.conf
account default root=$SSMTP_TO
aliases /etc/msmtp_aliases mailhub=$SSMTP_SERVER:$SSMTP_PORT
from $SMTP_FROM UseSTARTTLS=$SSMTP_TLS
host $SMTP_SERVER hostname=$SSMTP_HOSTNAME
port $SMTP_PORT FromLineOverride=NO
tls $SMTP_TLS
tls_starttls $SMTP_STARTTLS
tls_certcheck off
EOF EOF
cat << EOF > /etc/msmtp_aliases cat << EOF > /etc/ssmtp/revaliases
netdata: $SMTP_TO netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT
root: $SMTP_TO root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT
EOF EOF
fi fi
if [[ $SMTP_USER ]]; then if [[ $SSMTP_USER ]]; then
cat << EOF >> /etc/msmtprc cat << EOF >> /etc/ssmtp/ssmtp.conf
auth on AuthUser=$SSMTP_USER
user $SMTP_USER
EOF EOF
fi fi
if [[ $SMTP_PASS ]]; then if [[ $SSMTP_PASS ]]; then
cat << EOF >> /etc/msmtprc cat << EOF >> /etc/ssmtp/ssmtp.conf
password $SMTP_PASS AuthPass=$SSMTP_PASS
EOF EOF
fi fi
# copy conf from NETDATA_STOCK_CONFIG_DIR (normally under /usr/lib/netdata/conf.d) to NETDATA_USER_CONFIG_DIR (normally under /etc/netdata)
cp /usr/lib/netdata/conf.d/health_alarm_notify.conf /etc/netdata
if [[ $SLACK_WEBHOOK_URL ]]; then if [[ $SLACK_WEBHOOK_URL ]]; then
sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf
fi fi
@ -114,10 +107,4 @@ for f in /etc/netdata/override/*; do
done done
# main entrypoint # main entrypoint
touch /etc/netdata/python.d.conf
# belt and suspenders
export DO_NOT_TRACK=1
touch /etc/netdata/.opt-out-from-anonymous-statistics
exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@" exec /usr/sbin/netdata -D -u root -s /host -p ${NETDATA_PORT} ${NETDATA_ARGS} "$@"