Skip to content

Commit

Permalink
Merge pull request #27 from Marissa-working/master
Browse files Browse the repository at this point in the history
add logrotate & its cron job for log files in /var/log/httpd dir(test parameters)
  • Loading branch information
matyasselmeci authored Jul 18, 2024
2 parents da69526 + 5f0d4b7 commit 7b3f8ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN \
yum update -y && \
(yum install -y git-core || yum install -y git) && \
yum install -y --enablerepo=osg-upcoming condor && \
yum install -y python3-pip httpd mod_auth_openidc mod_ssl python3-mod_wsgi && \
yum install -y python3-pip httpd mod_auth_openidc mod_ssl python3-mod_wsgi logrotate && \
yum install -y make && \
yum clean all && rm -rf /var/cache/yum/*

Expand All @@ -28,8 +28,12 @@ RUN pip3 install -U pip && pip3 install -r /opt/registry/requirements.txt
# Use our weird grid-security cert/key location
RUN rm /etc/httpd/conf.d/ssl.conf

# Setup cron job for logrotate to run as root every day
RUN echo "0 0 * * * root /usr/sbin/logrotate /etc/logrotate.d/httpd >> /var/log/cron 2>&1" > /etc/cron.d/logrotate-httpd

COPY register.py /usr/bin
COPY supervisor-apache.conf /etc/supervisord.d/40-apache.conf
COPY logrotate-http.conf /etc/logrotate.d/httpd
COPY examples/apache.conf /etc/httpd/conf.d/

ENV CONFIG_DIR=/srv
Expand Down
12 changes: 12 additions & 0 deletions logrotate-http.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/var/log/httpd/*.log {
maxsize 100M
rotate 20
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
PID=$(pgrep -o httpd); if [ "$PID" ]; then kill -USR1 $PID; fi
endscript
}

0 comments on commit 7b3f8ee

Please sign in to comment.