This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
forked from Zuhkov/docker-containers
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from setiseta/restructure
Restructure
- Loading branch information
Showing
6 changed files
with
201 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,105 +3,57 @@ | |
# See https://github.com/phusion/baseimage-docker/blob/master/Changelog.md for | ||
# a list of version numbers. | ||
FROM phusion/baseimage:0.9.16 | ||
MAINTAINER Seti <[email protected]> | ||
MAINTAINER Seti <[email protected]> | ||
|
||
# Set correct environment variables. | ||
ENV HOME /root | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LC_ALL C.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US.UTF-8 | ||
ENV HOME=/root \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
LC_ALL=C.UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
LANGUAGE=en_US.UTF-8 | ||
|
||
COPY init.sh /etc/my_init.d/init.sh | ||
COPY apache2.sh /etc/service/apache2/run | ||
COPY cron-observium /etc/cron.d/observium | ||
|
||
# Use baseimage-docker's init system | ||
CMD ["/sbin/my_init"] | ||
|
||
# Configure user nobody to match unRAID's settings | ||
RUN \ | ||
usermod -u 99 nobody && \ | ||
usermod -g 100 nobody && \ | ||
usermod -d /home nobody && \ | ||
chown -R nobody:users /home | ||
|
||
# Disable SSH | ||
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh | ||
|
||
# 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 | ||
|
||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0xcbcb082a1bb943db && \ | ||
echo "deb http://mariadb.mirror.iweb.com/repo/5.5/ubuntu `lsb_release -cs` main" \ | ||
> /etc/apt/sources.list.d/mariadb.list | ||
|
||
# Install Observium prereqs | ||
RUN apt-get update -q && \ | ||
apt-get install -y --no-install-recommends mariadb-server mariadb-client \ | ||
libapache2-mod-php5 php5-cli php5-json wget unzip software-properties-common pwgen \ | ||
php5-mysql php5-gd php5-mcrypt python-mysqldb rrdtool subversion whois mtr-tiny at \ | ||
nmap ipmitool graphviz imagemagick php5-snmp php-pear snmp graphviz fping libvirt-bin && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Tweak my.cnf | ||
RUN sed -i -e 's#\(bind-address.*=\).*#\1 127.0.0.1#g' /etc/mysql/my.cnf && \ | ||
sed -i -e 's#\(log_error.*=\).*#\1 /config/databases/mysql_safe.log#g' /etc/mysql/my.cnf && \ | ||
sed -i -e 's/\(user.*=\).*/\1 nobody/g' /etc/mysql/my.cnf && \ | ||
echo '[mysqld]' > /etc/mysql/conf.d/innodb_file_per_table.cnf && \ | ||
echo 'innodb_file_per_table' >> /etc/mysql/conf.d/innodb_file_per_table.cnf | ||
|
||
RUN mkdir -p /opt/observium/firstrun /opt/observium/logs /opt/observium/rrd /config && \ | ||
RUN \ | ||
usermod -u 99 nobody && usermod -g 100 nobody && usermod -d /home nobody && \ | ||
chown -R nobody:users /home && \ | ||
rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh && \ | ||
locale-gen de_DE.UTF-8 && locale-gen en_US.UTF-8 && \ | ||
apt-get update -q && \ | ||
apt-get install -y --no-install-recommends \ | ||
mysql-client libapache2-mod-php5 php5-cli php5-json wget unzip software-properties-common \ | ||
php5-mysql php5-gd php5-mcrypt python-mysqldb rrdtool subversion whois mtr-tiny at \ | ||
nmap ipmitool graphviz imagemagick php5-snmp php-pear snmp graphviz fping libvirt-bin && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ | ||
mkdir -p /data/logs /data/rrd /data/config && \ | ||
cd /opt && \ | ||
wget http://www.observium.org/observium-community-latest.tar.gz && \ | ||
tar zxvf observium-community-latest.tar.gz && \ | ||
rm observium-community-latest.tar.gz | ||
|
||
RUN php5enmod mcrypt && \ | ||
a2enmod rewrite | ||
|
||
RUN mkdir /etc/service/apache2 | ||
COPY apache2.sh /etc/service/apache2/run | ||
RUN chmod +x /etc/service/apache2/run | ||
|
||
COPY firstrun.sh /etc/my_init.d/firstrun.sh | ||
COPY mariadb.sh /etc/service/mariadb/run | ||
RUN chmod +x /etc/my_init.d/firstrun.sh && \ | ||
chmod +x /etc/service/mariadb/run && \ | ||
rm observium-community-latest.tar.gz && \ | ||
php5enmod mcrypt && a2enmod rewrite && \ | ||
rm /etc/apache2/sites-available/default-ssl.conf && \ | ||
rm -Rf /var/www && chmod +x /etc/service/apache2/run && \ | ||
chmod +x /etc/my_init.d/init.sh && \ | ||
chown -R nobody:users /opt/observium && \ | ||
chmod 755 -R /opt/observium && \ | ||
chown -R nobody:users /config && \ | ||
chmod 755 -R /config && \ | ||
chown -R nobody:users /var/log/mysql* && \ | ||
chown -R nobody:users /var/lib/mysql && \ | ||
chown -R nobody:users /etc/mysql && \ | ||
chown -R nobody:users /var/run/mysqld | ||
|
||
# Configure apache2 to serve Observium app | ||
COPY apache2.conf /etc/apache2/apache2.conf | ||
COPY ports.conf /etc/apache2/ports.conf | ||
COPY apache-observium /etc/apache2/sites-available/000-default.conf | ||
RUN rm /etc/apache2/sites-available/default-ssl.conf && \ | ||
echo www-data > /etc/container_environment/APACHE_RUN_USER && \ | ||
chown -R nobody:users /data/config && \ | ||
chmod 755 -R /data/config && 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 | ||
|
||
|
||
# Setup Observium cron jobs | ||
COPY cron-observium /etc/cron.d/observium | ||
COPY apache2.conf ports.conf /etc/apache2/ | ||
COPY apache-observium /etc/apache2/sites-available/000-default.conf | ||
|
||
EXPOSE 80/tcp | ||
|
||
VOLUME ["/config","/opt/observium/logs","/opt/observium/rrd"] | ||
VOLUME ["/data"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
Observium | ||
==== | ||
|
||
Dockerfile for Observium with embedded MariaDB (MySQL) Database | ||
|
||
Observium is an autodiscovering network monitoring platform supporting a wide range of hardware platforms and operating systems | ||
|
||
--- | ||
###Forked from | ||
###Originally forked from | ||
|
||
Zuhkov <[email protected]> | ||
|
||
--- | ||
Usage example | ||
=== | ||
###Needed directories on host: | ||
- config | ||
- logs | ||
- rrd | ||
- data | ||
- mysql | ||
|
||
### with sameersbn/mysql as database | ||
|
||
``` | ||
docker run -d \ | ||
-v /hostDir/config:/config \ | ||
-v /hostDir/logs:/opt/observium/logs \ | ||
-v /hostDir/rrd:/opt/observium/rrd \ | ||
-p 80:80 \ | ||
-e POLLER=24 \ | ||
--name observium \ | ||
seti/observium | ||
NAME="observium" | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
docker run -d -m 1g \ | ||
-v $DIR/mysql:/var/lib/mysql \ | ||
-e DB_USER=$NAME \ | ||
-e DB_PASS=observiumpwd \ | ||
-e DB_NAME=$NAME \ | ||
--name $NAME-db \ | ||
sameersbn/mysql:latest | ||
``` | ||
###with custom timezone | ||
|
||
``` | ||
NAME="observium" | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
docker run -d \ | ||
-v /hostDir/config:/config \ | ||
-v /hostDir/logs:/opt/observium/logs \ | ||
-v /hostDir/rrd:/opt/observium/rrd \ | ||
-v $DIR/data:/data \ | ||
-p 80:80 \ | ||
-e TZ="America/Chicago" \ | ||
-e TZ="Europe/Austria" \ | ||
--link $NAME-db:mysql \ | ||
-e POLLER=24 \ | ||
--name observium \ | ||
--name $NAME \ | ||
seti/observium | ||
``` | ||
|
||
|
@@ -49,6 +50,27 @@ Environment Vars | |
- **POLLER**: Set poller count. Defaults to `16` | ||
- **TZ**: Set timezone. Defaults to `UTC` | ||
|
||
--- | ||
Convert from older version with integrated DB to new container | ||
=== | ||
- we use "ocontainer" as container name. replace it with your name. | ||
``` | ||
mkdir mysql | ||
docker exec -it ocontainer mysqldump observium > mysql/observiumdb.sql | ||
mkdir data | ||
mv config data/ && mv rrd data/ && mv logs data/ | ||
chown nobody:users data -R | ||
``` | ||
- now run your db container, we use the example from above, then run this command (observium-db is the container name) | ||
``` | ||
echo "#!/bin/bash" > mysql/import.sh | ||
echo "mysql -u observium -pobserviumpwd observium < /var/lib/mysql/observiumdb.sql" >> mysql/import.sh | ||
chmod 0755 mysql/import.sh | ||
docker exec -it observium-db bash /var/lib/mysql/import.sh | ||
rm -f mysql/import.sh mysql/observiumdb.sql | ||
``` | ||
- now run your observium container, like the example from above | ||
|
||
--- | ||
Credits | ||
=== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.