Commit be194b45 authored by William Tucker's avatar William Tucker
Browse files

Swapped pipes for files and logrotate in data containers

parent 5363c65b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -32,10 +32,10 @@
        src: /dev/stderr
        force: yes

    - name: Make the access log pipe
      command: mkfifo /esg/logs/fileserver/access.log
      args:
        creates: /esg/logs/fileserver/access.log
    - name: Ensure access log file exists
      file:
        path: /esg/logs/fileserver/access.log
        state: touch

    - name: Transfer ownership of logs to security context user
      file:
+8 −0
Original line number Diff line number Diff line
---

- name: Ensure logrotate is installed
  command: dnf install -y logrotate

- name: Install the logrotate configuration file
  template:
    src: esg.logrotate.j2
    dest: /etc/logrotate.d/esg

- name: Create Docker network
  docker_network:
    name: esgf
+23 −0
Original line number Diff line number Diff line
{% set containers = [] %}
{% if 'data' in group_names and fileserver_enabled %}
{{ containers.append(['fileserver', 'access.log']) }}
{% endif %}
{% if 'data' in group_names and thredds_enabled %}
{{ containers.append(['thredds', 'localhost_access_log.txt']) }}
{% endif %}
{% for container in containers %}
/esg/logs/{{ container.0 }}/{{ container.1 }} {
    create 0640 root root
    daily
    rotate 10
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    postrotate
        /usr/bin/docker restart {{ container.0 }} > /dev/null 2>/dev/null || true
    endscript
}

{% endfor %}