Skip to content

Commit

Permalink
for #186, set up runtime-logs volume
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Apr 19, 2023
1 parent 7f7db0e commit a10e261
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfiles/nginx.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ RUN set -x ; \
zlib-dev \
; \
\
mkdir -p /usr/src/nginx-auth-ldap /usr/src/ngx_http_substitutions_filter_module /www /www/logs/nginx ; \
mkdir -p /usr/src/nginx-auth-ldap /usr/src/ngx_http_substitutions_filter_module /www /www/logs/nginx /var/log/nginx ; \
tar -zxC /usr/src -f /nginx.tar.gz ; \
tar -zxC /usr/src/nginx-auth-ldap --strip=1 -f /nginx-auth-ldap.tar.gz ; \
tar -zxC /usr/src/ngx_http_substitutions_filter_module --strip=1 -f /ngx_http_substitutions_filter_module-master.tar.gz ; \
Expand Down
43 changes: 43 additions & 0 deletions kubernetes/01-volumes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,49 @@ spec:
storage: 50Gi
volumeName: config-volume

---
apiVersion: v1
kind: PersistentVolume
metadata:
name: runtime-logs-volume
namespace: malcolm
labels:
namespace: malcolm
spec:
capacity:
storage: 50Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs
mountOptions:
- nfsvers=4.1
- soft
- noac
- timeo=600
- retrans=2
nfs:
path: /malcolm/runtime-logs
server: 10.9.0.226
readOnly: false

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: runtime-logs-claim
namespace: malcolm
spec:
storageClassName: nfs
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 50Gi
volumeName: runtime-logs-volume

---
apiVersion: v1
kind: PersistentVolume
Expand Down
8 changes: 7 additions & 1 deletion kubernetes/12-filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ spec:
name: filebeat-zeek-volume
- mountPath: "/suricata"
name: filebeat-suricata-volume
# TODO: live nginx-logs from nginx-proxy container
- name: filebeat-nginx-runtime-logs-volume
mountPath: /nginx
subPath: "nginx"
volumes:
- name: filebeat-var-local-catrust-volume
configMap:
Expand All @@ -93,3 +95,7 @@ spec:
- name: filebeat-suricata-volume
persistentVolumeClaim:
claimName: suricata-claim
- name: filebeat-nginx-runtime-logs-volume
persistentVolumeClaim:
readOnly: true
claimName: runtime-logs-claim
8 changes: 7 additions & 1 deletion kubernetes/99-nginx-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ spec:
subPath: "auth"
- name: nginx-etc-auth-default-volume
mountPath: /tmp/auth/default/configmap
- name: nginx-runtime-logs-volume
mountPath: /var/log/nginx
subPath: "nginx"
volumes:
- name: nginx-etc-nginx-volume
configMap:
Expand All @@ -107,4 +110,7 @@ spec:
claimName: config-claim
- name: nginx-etc-auth-default-volume
configMap:
name: etc-nginx-auth
name: etc-nginx-auth
- name: nginx-runtime-logs-volume
persistentVolumeClaim:
claimName: runtime-logs-claim
2 changes: 2 additions & 0 deletions nginx/scripts/docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,7 @@ if [[ ! -f /etc/nginx/auth/htpasswd ]] && [[ -f /tmp/auth/default/htpasswd ]]; t
rm -rf /tmp/auth/* || true
fi

rm -rf /var/log/nginx/* || true

# start supervisor (which will spawn nginx, stunnel, etc.) or whatever the default command is
exec "$@"

0 comments on commit a10e261

Please sign in to comment.