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
password:
from_secret: docker_password
auto_tag: true
tags:
- ${DRONE_COMMIT_SHA}
- ${DRONE_BRANCH}

View File

@ -1,21 +1,16 @@
FROM debian:stretch
FROM debian:jessie
ADD scripts/build.sh /build.sh
ADD scripts/run.sh /run.sh
RUN chmod +x /run.sh /build.sh && sync && sleep 1 && /build.sh
RUN touch /etc/netdata/.opt-out-from-anonymous-statistics
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
EXPOSE $NETDATA_PORT
VOLUME /etc/netdata/override
ENTRYPOINT ["/run.sh"]

View File

@ -2,20 +2,22 @@
set -e
DEBIAN_FRONTEND=noninteractive
# belt and suspenders
export DO_NOT_TRACK=1
# some mirrors have issues, i skipped httpredir in favor of an eu mirror
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
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 autoconf-archive lm-sensors nodejs python python-mysqldb python-yaml libjudydebian1 libuv1 liblz4-1 openssl
apt-get -y install msmtp msmtp-mta apcupsd fping
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
apt-get -y install ssmtp mailutils apcupsd
# fetch netdata
git clone https://github.com/netdata/netdata.git /netdata.git
cd /netdata.git
# v1.19.0 release:
git checkout 5000257f0171271cb3ee2cf0fe02e8a2154ddf2e
# use the provided installer
@ -24,18 +26,23 @@ git checkout 5000257f0171271cb3ee2cf0fe02e8a2154ddf2e
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
cd /
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 clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 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/debug.log
ln -sf /dev/stderr /var/log/netdata/error.log

View File

@ -4,41 +4,34 @@
chown root:root /usr/share/netdata/web/ -R
echo -n "" > /usr/share/netdata/web/version.txt
# set up msmtp
if [[ $SMTP_TO ]]; then
cat << EOF > /etc/msmtprc
account default
aliases /etc/msmtp_aliases
from $SMTP_FROM
host $SMTP_SERVER
port $SMTP_PORT
tls $SMTP_TLS
tls_starttls $SMTP_STARTTLS
tls_certcheck off
# set up ssmtp
if [[ $SSMTP_TO ]]; then
cat << EOF > /etc/ssmtp/ssmtp.conf
root=$SSMTP_TO
mailhub=$SSMTP_SERVER:$SSMTP_PORT
UseSTARTTLS=$SSMTP_TLS
hostname=$SSMTP_HOSTNAME
FromLineOverride=NO
EOF
cat << EOF > /etc/msmtp_aliases
netdata: $SMTP_TO
root: $SMTP_TO
cat << EOF > /etc/ssmtp/revaliases
netdata:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT
root:netdata@$SSMTP_HOSTNAME:$SSMTP_SERVER:$SSMTP_PORT
EOF
fi
if [[ $SMTP_USER ]]; then
cat << EOF >> /etc/msmtprc
auth on
user $SMTP_USER
if [[ $SSMTP_USER ]]; then
cat << EOF >> /etc/ssmtp/ssmtp.conf
AuthUser=$SSMTP_USER
EOF
fi
if [[ $SMTP_PASS ]]; then
cat << EOF >> /etc/msmtprc
password $SMTP_PASS
if [[ $SSMTP_PASS ]]; then
cat << EOF >> /etc/ssmtp/ssmtp.conf
AuthPass=$SSMTP_PASS
EOF
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
sed -i -e "s@SLACK_WEBHOOK_URL=\"\"@SLACK_WEBHOOK_URL=\"${SLACK_WEBHOOK_URL}\"@" /etc/netdata/health_alarm_notify.conf
fi
@ -114,10 +107,4 @@ for f in /etc/netdata/override/*; do
done
# 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} "$@"