-
Notifications
You must be signed in to change notification settings - Fork 189
/
Dockerfile
157 lines (147 loc) · 5.84 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
148
149
150
151
152
153
154
155
156
157
# Dockerfile for icinga2 with icingaweb2
# https://github.com/jjethwa/icinga2
FROM debian:bullseye
ENV APACHE2_HTTP=REDIRECT \
ICINGA2_FEATURE_GRAPHITE=false \
ICINGA2_FEATURE_GRAPHITE_HOST=graphite \
ICINGA2_FEATURE_GRAPHITE_PORT=2003 \
ICINGA2_FEATURE_GRAPHITE_URL=http://graphite \
ICINGA2_FEATURE_GRAPHITE_SEND_THRESHOLDS="true" \
ICINGA2_FEATURE_GRAPHITE_SEND_METADATA="false" \
ICINGA2_USER_FULLNAME="Icinga2" \
ICINGA2_FEATURE_DIRECTOR="true" \
ICINGA2_FEATURE_DIRECTOR_KICKSTART="true" \
ICINGA2_FEATURE_DIRECTOR_USER="icinga2-director" \
ICINGA2_LOG_LEVEL="information" \
MYSQL_ROOT_USER=root
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apache2 \
apt-transport-https \
bc \
ca-certificates \
curl \
dnsutils \
file \
gnupg \
jq \
libdbd-mysql-perl \
libdigest-hmac-perl \
libnet-snmp-perl \
locales \
logrotate \
lsb-release \
bsd-mailx \
mariadb-client \
mariadb-server \
netbase \
openssh-client \
openssl \
php-curl \
php-ldap \
php-mysql \
php-mbstring \
php-gmp \
procps \
pwgen \
python \
python3-requests \
snmp \
msmtp \
sudo \
supervisor \
telnet \
unzip \
wget \
cron \
&& apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive \
&& curl -s https://packages.icinga.com/icinga.key \
| apt-key add - \
&& echo "deb https://packages.icinga.com/debian icinga-$(lsb_release -cs) main" > /etc/apt/sources.list.d/$(lsb_release -cs)-icinga.list \
&& echo "deb-src https://packages.icinga.com/debian icinga-$(lsb_release -cs) main" >> /etc/apt/sources.list.d/$(lsb_release -cs)-icinga.list \
&& echo "deb http://deb.debian.org/debian $(lsb_release -cs)-backports main" > /etc/apt/sources.list.d/$(lsb_release -cs)-backports.list \
&& apt-get update \
&& apt-get install -y --install-recommends \
icinga2 \
icinga2-ido-mysql \
icingacli \
icingaweb2 \
monitoring-plugins \
nagios-nrpe-plugin \
nagios-plugins-contrib \
nagios-snmp-plugins \
libmonitoring-plugin-perl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ARG GITREF_MODGRAPHITE=master
ARG GITREF_MODAWS=master
ARG GITREF_REACTBUNDLE=v0.9.0
ARG GITREF_INCUBATOR=v0.18.0
ARG GITREF_IPL=v0.5.0
RUN mkdir -p /usr/local/share/icingaweb2/modules/ \
# Icinga Director
&& mkdir -p /usr/local/share/icingaweb2/modules/director/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-director/archive/v1.9.1.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/director --exclude=.gitignore -f - \
# Icingaweb2 Graphite
&& mkdir -p /usr/local/share/icingaweb2/modules/graphite \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-graphite/archive/v1.2.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/graphite -f - \
# Icingaweb2 AWS
&& mkdir -p /usr/local/share/icingaweb2/modules/aws \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-aws/archive/v1.1.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/aws -f - \
&& wget -q --no-cookies "https://github.com/aws/aws-sdk-php/releases/download/3.222.8/aws.zip" \
&& unzip -d /usr/local/share/icingaweb2/modules/aws/library/vendor/aws aws.zip \
&& rm aws.zip \
# Module Reactbundle
&& mkdir -p /usr/local/share/icingaweb2/modules/reactbundle/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-reactbundle/archive/v0.9.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/reactbundle -f - \
# Module Incubator
&& mkdir -p /usr/local/share/icingaweb2/modules/incubator/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-incubator/archive/v0.18.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/incubator -f - \
# Module Ipl
&& mkdir -p /usr/local/share/icingaweb2/modules/ipl/ \
&& wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-ipl/archive/v0.5.0.tar.gz" \
| tar xz --strip-components=1 --directory=/usr/local/share/icingaweb2/modules/ipl -f - \
# Module x509
&& mkdir -p /usr/local/share/icingaweb2/modules/x509/ \
&& wget -q --no-cookies "https://github.com/Icinga/icingaweb2-module-x509/archive/v1.1.2.zip" \
&& unzip -d /usr/local/share/icingaweb2/modules/x509 v1.1.2.zip \
&& mv /usr/local/share/icingaweb2/modules/x509/icingaweb2-module-x509-1.1.2/* /usr/local/share/icingaweb2/modules/x509/ \
&& rm -rf /usr/local/share/icingaweb2/modules/x509/icingaweb2-module-x509-1.1.2/ \
&& true
ADD content/ /
# Final fixes
RUN true \
&& sed -i 's/vars\.os.*/vars.os = "Docker"/' /etc/icinga2/conf.d/hosts.conf \
&& mv /etc/icingaweb2/ /etc/icingaweb2.dist \
&& mv /etc/icinga2/ /etc/icinga2.dist \
&& mkdir -p /etc/icinga2 \
&& usermod -aG icingaweb2 www-data \
&& usermod -aG nagios www-data \
&& usermod -aG icingaweb2 nagios \
&& mkdir -p /var/log/icinga2 \
&& chmod 755 /var/log/icinga2 \
&& chown nagios:nagios /var/log/icinga2 \
&& mkdir -p /var/cache/icinga2 \
&& chmod 755 /var/cache/icinga2 \
&& chown nagios:nagios /var/cache/icinga2 \
&& touch /var/log/cron.log \
&& rm -rf \
/var/lib/mysql/* \
&& chmod u+s,g+s \
/bin/ping \
/bin/ping6 \
/usr/lib/nagios/plugins/check_icmp \
&& /sbin/setcap cap_net_raw+p /bin/ping
EXPOSE 80 443 5665
# Initialize and run Supervisor
ENTRYPOINT ["/opt/run"]