Skip to content

Commit

Permalink
Setup cron, logging and logrotate to work with supervisord and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
bensinober committed Aug 4, 2016
1 parent 0c6f732 commit 456758b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y wget less curl git nmap socat netcat tree htop \
unzip python-software-properties libswitch-perl \
libnet-ssleay-perl libcrypt-ssleay-perl apache2 \
supervisor && \
supervisor inetutils-syslogd && \
apt-get clean

ARG KOHA_BUILD
Expand Down Expand Up @@ -79,6 +79,13 @@ ADD ./files/Authen_CAS_Client_Response_Success.pm /usr/share/perl5/Authen/CAS/Cl
ENV HOME /root
WORKDIR /root

#############
# LOGGING AND CRON
#############

COPY ./files/logrotate.config /etc/logrotate.d/syslog.conf
COPY ./files/syslog.config /etc/syslog.conf

# Setup cron job to sync holdingbranches to services
COPY holdingbranches.sh /root/holdingbranches.sh
COPY update_holdingbranches.sh /root/update_holdingbranches.sh
Expand All @@ -92,5 +99,4 @@ EXPOSE 6001 8080 8081

# Script and deps for checking if koha is up & ready (to be executed using docker exec)
RUN apt-get install -y python-requests && apt-get clean
COPY docker-wait_until_ready.py /root/wait_until_ready.py
RUN apt-get install -y inetutils-syslogd
COPY docker-wait_until_ready.py /root/wait_until_ready.py
9 changes: 8 additions & 1 deletion Dockerfile.debianfiles
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y wget less curl git nmap socat netcat tree htop \
unzip python-software-properties libswitch-perl \
libnet-ssleay-perl libcrypt-ssleay-perl apache2 \
supervisor && \
supervisor inetutils-syslogd && \
apt-get clean

ARG KOHA_BUILD
Expand Down Expand Up @@ -81,6 +81,13 @@ ADD ./files/Authen_CAS_Client_Response_Success.pm /usr/share/perl5/Authen/CAS/Cl
ENV HOME /root
WORKDIR /root

#############
# LOGGING AND CRON
#############

COPY ./files/logrotate.config /etc/logrotate.d/syslog.conf
COPY ./files/syslog.config /etc/syslog.conf

# Setup cron job to sync holdingbranches to services
COPY holdingbranches.sh /root/holdingbranches.sh
COPY update_holdingbranches.sh /root/update_holdingbranches.sh
Expand Down
7 changes: 7 additions & 0 deletions files/logrotate.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
29 changes: 29 additions & 0 deletions files/syslog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# /etc/syslog.conf Configuration file for inetutils-syslogd.
#
# For more information see syslog.conf(5) manpage.


auth,authpriv.* /var/log/auth.log
cron.* /var/log/cron.log
*.*;cron,auth,authpriv.none -/var/log/syslog

#
# Some `catch-all' logfiles.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages

#
# It was simpler to redirect all logs directly to docker pid 1 file descriptor
# for docker logs to pick it up
#
daemon,cron,auth,mail.*;\
news.=crit;news.=err;news.=notice;\
*.=debug;*.=info;\
*.=notice;*.=warn /proc/1/fd/1

0 comments on commit 456758b

Please sign in to comment.