aptly docker: change nginx log files to /var/aptly

The original log files of nginx are under '/var/log/nginx/'
which is not in local disk and it hard to collect these logs.
This commit changed these logs to the shared volume 'var/aptly'
of aptly docker.

Test Plan:
Pass: Create a new build environment and check with:
      $stx control enter --dockername repomgr
      $cat /var/aptly/nginx_error.log
      $cat /var/aptly/nginx_access.log
      exit from the repomgr:
      $cd ${STX_BUILD_HOME}
      $cat aptly/nginx_error.log
      $cat aptly/nginx_access.log
      nginx works and it logs into the above files

Story: 2008846
Task: 46647

Signed-off-by: Haiqing Bai <haiqing.bai@windriver.com>
Change-Id: Ibeeb7e1c2b98c3a5d8a78acd5bb269b45550589c
This commit is contained in:
Haiqing Bai 2022-10-25 21:20:35 +08:00
parent 8dd6eedf8f
commit d9bcb8b10e
3 changed files with 18 additions and 2 deletions

View File

@ -58,6 +58,7 @@ COPY stx/toCOPY/aptly/supervisord.aptly.conf /etc/supervisor/conf.d/aptly.conf
COPY stx/toCOPY/aptly/nginx.conf.template /etc/nginx/nginx.conf.template
COPY stx/toCOPY/aptly/supervisord.nginx.conf /etc/supervisor/conf.d/nginx.conf
COPY stx/toCOPY/aptly/nginx.conf /etc/nginx/nginx.conf
COPY stx/toCOPY/aptly/nginx.logrotate /etc/logrotate.d/nginx
# Bind mount locations
VOLUME [ "/var/aptly" ]

View File

@ -2,7 +2,7 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
error_log /var/aptly/nginx_error.log notice;
pid /var/run/nginx.pid;
@ -19,7 +19,7 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
access_log /var/aptly/nginx_access.log main;
sendfile on;
#tcp_nopush on;

View File

@ -0,0 +1,15 @@
/var/aptly/nginx_*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 nginx adm
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}