forked from Yelp/docker-observium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
152 lines (137 loc) · 4.42 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
# == Observium
#
# Provide the following environment variables to source Observium from your
# Professional Edition subscription instead of the Community Edition upstream:
#
# USE_SVN=true
# SVN_USER=username
# SVN_PASS=password
# SVN_REPO=http://url/to/repo@rev
#
# If you don't have a subscription but run your own managed repository,
# SVN_REPO is arbritrarily accepted. If USE_SVN is specified, credentials and
# repository information must also be otherwise will fallback to community
# version.
#
# The following volumes may be used with their descriptions next to them:
#
# /config : Should contain your `config.php`, otherwise
# default will be used
# /opt/observium/html : Provided to ease adding plugis (weathermap!)
# /opt/observium/logs : Would be nice to store these somewhere
# non-volatile!
# /opt/observium/rrd : Will consume the most storage.
# /var/run/mysqld/mysqld.sock : If your MySQL server is on the same host that
# serves the container, setting 'localhost' in
# observium config will look for the unix
# socket instead of using TCP.
#
#
FROM phusion/baseimage:0.9.16
MAINTAINER Codey Oxley <codey@yelp.com>
EXPOSE 8000/tcp
VOLUME ["/config", \
"/opt/observium/html", \
"/opt/observium/logs", \
"/opt/observium/rrd", \
"/var/run/mysqld/mysqld.sock"]
# === phusion/baseimage pre-work
CMD ["/sbin/my_init"]
# === General System
# yelp/observium env mostly for reference
ENV WORKERS 2
ENV WEATHERMAP false
ENV CUSTOM_PHP_INI false
ENV HOUSEKEEPING_ARGS '-yet'
ENV USE_SVN false
ENV SVN_USER ''
ENV SVN_PASS ''
ENV SVN_REPO ''
# Avoid any interactive prompting
ENV DEBIAN_FRONTEND noninteractive
# Language specifics
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Install locales
RUN locale-gen cs_CZ.UTF-8
RUN locale-gen de_DE.UTF-8
RUN locale-gen en_US.UTF-8
RUN locale-gen es_ES.UTF-8
RUN locale-gen fr_FR.UTF-8
RUN locale-gen it_IT.UTF-8
RUN locale-gen pl_PL.UTF-8
RUN locale-gen pt_BR.UTF-8
RUN locale-gen ru_RU.UTF-8
RUN locale-gen sl_SI.UTF-8
RUN locale-gen uk_UA.UTF-8
# Install Observium prereqs
RUN apt-get update -q && \
apt-get install -y --no-install-recommends \
at \
fping \
git \
graphviz \
graphviz \
imagemagick \
ipmitool \
libapache2-mod-php5 \
libvirt-bin \
mariadb-client \
mtr-tiny \
nmap \
php5-cli \
php5-gd \
php5-json \
php5-ldap \
php5-mcrypt \
php5-mysql \
php5-snmp \
php-pear \
pwgen \
python-mysqldb \
rrdcached \
rrdtool \
snmp \
software-properties-common \
subversion \
unzip \
wget \
whois
RUN mkdir -p \
/config \
/opt/observium/html \
/opt/observium/logs \
/opt/observium/rrd \
# === Webserver - Apache + PHP5
RUN php5enmod mcrypt && \
a2enmod rewrite
RUN mkdir /etc/service/apache2
COPY bin/service/apache2.sh /etc/service/apache2/run
RUN chmod +x /etc/service/apache2/run
# Boot-time init scripts for phusion/baseimage
COPY bin/my_init.d /etc/my_init.d/
RUN chmod +x /etc/my_init.d/* && \
chown -R nobody:users /opt/observium && \
chown -R nobody:users /config && \
chmod 755 -R /opt/observium && \
chmod 755 -R /config
# Configure apache2 to serve Observium app
COPY ["conf/apache2.conf", "conf/ports.conf", "/etc/apache2/"]
COPY conf/apache-observium /etc/apache2/sites-available/000-default.conf
COPY conf/rrdcached /etc/default/rrdcached
RUN rm /etc/apache2/sites-available/default-ssl.conf && \
echo www-data > /etc/container_environment/APACHE_RUN_USER && \
echo www-data > /etc/container_environment/APACHE_RUN_GROUP && \
echo /var/log/apache2 > /etc/container_environment/APACHE_LOG_DIR && \
echo /var/lock/apache2 > /etc/container_environment/APACHE_LOCK_DIR && \
echo /var/run/apache2.pid > /etc/container_environment/APACHE_PID_FILE && \
echo /var/run/apache2 > /etc/container_environment/APACHE_RUN_DIR && \
chown -R www-data:www-data /var/log/apache2 && \
rm -Rf /var/www && \
ln -s /opt/observium/html /var/www
# === Cron and finishing
COPY cron.d /etc/cron.d/
# === phusion/baseimage post-work
# Clean up APT when done
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*