forked from Juniper/open-nti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
147 lines (118 loc) · 4.59 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
FROM phusion/baseimage:0.9.18
MAINTAINER Damien Garros <dgarros@gmail.com>
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get clean &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# dependencies
RUN apt-get -y update && \
apt-get -y install \
git adduser libfontconfig wget make curl && \
apt-get clean &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN rm -f /etc/service/sshd/down
RUN /usr/sbin/enable_insecure_key
# Latest version
ENV GRAFANA_VERSION 4.1.2-1486989747
ENV INFLUXDB_VERSION 1.2.0
ENV TELEGRAF_VERSION 1.2.1
RUN apt-get -y update && \
apt-get -y install \
build-essential \
python-simplejson \
python-support \
python-dev \
python-yaml \
python-pip \
python-dev \
libxml2-dev \
libxslt-dev \
tcpdump \
tree \
nginx-light \
snmp \
zlib1g-dev \
libffi-dev \
libssl-dev && \
apt-get clean &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# # Install some python modules
RUN pip install influxdb && \
pip install xmltodict && \
pip install pexpect && \
easy_install pysnmp && \
pip install lxml && \
pip install python-crontab && \
pip install junos-eznc && \
pip install pytest && \
pip install mock &&\
pip install cryptography==1.2.1
RUN mkdir /src
########################
### Install Grafana
########################
RUN mkdir /src/grafana &&\
mkdir /opt/grafana &&\
wget https://grafanarel.s3.amazonaws.com/builds/grafana-${GRAFANA_VERSION}.linux-x64.tar.gz -O /src/grafana.tar.gz &&\
tar -xzf /src/grafana.tar.gz -C /opt/grafana --strip-components=1 &&\
rm /src/grafana.tar.gz
RUN /opt/grafana/bin/grafana-cli plugins install grafana-piechart-panel
########################
### Install InfluxDB ###
########################
RUN curl -s -o /tmp/influxdb_latest_amd64.deb https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
dpkg -i /tmp/influxdb_latest_amd64.deb && \
rm /tmp/influxdb_latest_amd64.deb
ADD docker/influxdb/types.db /usr/share/collectd/types.db
ADD docker/influxdb/influxdb-config.toml /config/config.toml
ADD docker/influxdb/influxdbrun.sh /influxdbrun.sh
RUN mkdir /etc/service/influxdb
ADD docker/influxdb/influxdb.launcher.sh /etc/service/influxdb/run
########################
### Install telegraf ###
########################
RUN curl -s -o /tmp/telegraf_latest_amd64.deb https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}_amd64.deb && \
dpkg -i /tmp/telegraf_latest_amd64.deb && \
rm /tmp/telegraf_latest_amd64.deb
ADD docker/telegraf/telegraf.conf /etc/telegraf/telegraf.conf
RUN mkdir /etc/service/telegraf
ADD docker/telegraf/telegraf.launcher.sh /etc/service/telegraf/run
########################
### Configuration ###
########################
### Configure Grafana ###
ADD docker/grafana/custom.ini /opt/grafana/conf/custom.ini
ADD docker/grafana/run.sh /etc/service/grafana/run
ADD docker/grafana/grafana.init.sh /etc/my_init.d/grafana.init.sh
# Add the default dashboards
RUN mkdir /src/dashboards && \
mkdir /opt/grafana/data && \
chown -R www-data /opt/grafana/data
### Configure nginx ###
ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
ADD docker/nginx/run.sh /etc/service/nginx/run
### open-nti python scripts (for gathering informatino from server to router) ###
ADD open-nti/open-nti.py /opt/open-nti/open-nti.py
ADD open-nti/startcron.py /opt/open-nti/startcron.py
ADD tests/main/pyez_mock.py /opt/open-nti/pyez_mock.py
### Add test files
RUN mkdir /opt/open-nti/tests
# ################
RUN chmod +x /etc/service/nginx/run &&\
chmod +x /etc/service/grafana/run &&\
chmod +x /etc/my_init.d/grafana.init.sh &&\
chmod +x /etc/service/influxdb/run &&\
chmod +x /etc/service/telegraf/run &&\
chmod +x /influxdbrun.sh
WORKDIR /
ENV HOME /root
ENV SSL_SUPPORT **False**
ENV SSL_CERT **None**
RUN chmod -R 777 /var/log/
# ## Graphana
EXPOSE 80
EXPOSE 3000
# # Influxdb Admin server WebUI
EXPOSE 8083
EXPOSE 8086
CMD ["/sbin/my_init"]