-
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 opinkerfi/docker-adagios-centos7-systemd
Adagios running on Centos7 with systemd
- Loading branch information
Showing
5 changed files
with
33 additions
and
125 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,7 +3,7 @@ | |
# Based on appcontainers/nagios | ||
############################################################ | ||
|
||
FROM centos:latest | ||
FROM centos/systemd | ||
MAINTAINER "Gardar Thorsteinsson" <[email protected]> | ||
|
||
ENV ADAGIOS_HOST adagios.local | ||
|
@@ -29,11 +29,11 @@ RUN yum --enablerepo=ok-testing install -y naemon naemon-livestatus git adagios | |
# Lets make sure adagios can write to naemon configuration files, and that | ||
# it is a valid git repo so we have audit trail | ||
WORKDIR /etc/naemon | ||
#RUN git config user.name "admin" | ||
#RUN git config user.email "admin@adagios.local" | ||
#RUN git init /etc/naemon | ||
#UN git add . | ||
#RUN git commit -a -m "Initial commit" | ||
RUN git init /etc/naemon | ||
RUN git config user.name "admin" | ||
RUN git config user.email "[email protected]" | ||
RUN git add . | ||
RUN git commit -a -m "Initial commit" | ||
|
||
# Fix permissions for naemon and pnp4nagios | ||
RUN chown -R naemon:naemon /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig | ||
|
@@ -109,38 +109,29 @@ RUN pynag config --append cfg_dir=/etc/naemon/commands/ | |
|
||
RUN mv /etc/httpd/conf.d/thruk_cookie_auth_vhost.conf /etc/httpd/conf.d/thruk_cookie_auth_vhost.conf.disabled | ||
|
||
RUN htpasswd -b /etc/thruk/htpasswd "$ADAGIOS_USER" "$ADAGIOS_PASS" | ||
RUN rm -f /etc/nagios/passwd | ||
RUN ln -s /etc/thruk/htpasswd /etc/nagios/passwd | ||
|
||
# Redirect root URL to /adagios | ||
RUN echo "RedirectMatch ^/$ /adagios" > /etc/httpd/conf.d/redirect.conf | ||
|
||
# Install supervisor and supervisor-quick. Service restarts are painfully slow | ||
# otherwise | ||
RUN pip install supervisor | ||
RUN pip install supervisor-quick | ||
|
||
# Remove cache and default passwd files | ||
RUN rm -rf /var/cache/yum /etc/nagios/passwd /etc/thruk/htpasswd | ||
|
||
# Copy supervisor config over to the container | ||
COPY supervisord.conf /etc/supervisord.conf | ||
|
||
# Copy custom supervisor init.d script (for nagios start|stop) | ||
COPY naemon-supervisor-wrapper.sh /usr/bin/naemon-supervisor-wrapper.sh | ||
RUN sed -i 's|^\(nagios_init_script\)=\(.*\)$|\1="sudo /usr/bin/naemon-supervisor-wrapper.sh"|g' /etc/adagios/adagios.conf | ||
RUN echo "naemon ALL=NOPASSWD: /usr/bin/naemon-supervisor-wrapper.sh" >> /etc/sudoers | ||
|
||
# Create childlogdir | ||
RUN mkdir /var/log/supervisor | ||
# Fix permissions for naemon and pnp4nagios | ||
RUN chown -R naemon:naemon /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig | ||
# ACL group permissions need g+rwx | ||
RUN chmod g+rwx -R /etc/naemon /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig | ||
RUN setfacl -R -m group:naemon:rwx -m d:group:naemon:rwx /etc/naemon/ /etc/adagios /var/lib/adagios /var/lib/pnp4nagios /var/log/pnp4nagios /var/spool/pnp4nagios /etc/pnp4nagios/process_perfdata.cfg /var/log/okconfig | ||
|
||
# Copy over our custom init script | ||
COPY run.sh /usr/bin/run.sh | ||
# Enable services | ||
RUN systemctl enable httpd | ||
RUN systemctl enable naemon | ||
RUN systemctl enable npcd | ||
|
||
# Make run.sh and supervisor wrapper script executable | ||
RUN chmod 755 /usr/bin/run.sh /usr/bin/naemon-supervisor-wrapper.sh | ||
# Remove yum cache | ||
RUN rm -rf /var/cache/yum | ||
|
||
WORKDIR /etc/naemon | ||
|
||
ENTRYPOINT ["/bin/bash", "/usr/bin/run.sh"] | ||
|
||
EXPOSE 80 | ||
|
||
VOLUME ["/etc/naemon", "/var/log/naemon"] | ||
|
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.
This file was deleted.
Oops, something went wrong.