Front End

LogZilla documentation for Front End

Front end (NGINX) manifest

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: front-conf
data:
  nginx.conf: |
    worker_processes 2;
    
    user nginx nginx;
    pid /tmp/nginx.pid;
    error_log stderr info;
    
    events {
        worker_connections 1024;
        accept_mutex on;
    }
    
    http {
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        access_log /dev/stdout combined;
        sendfile on;
        client_body_buffer_size 50m;
        client_max_body_size 50m;
        proxy_buffers 16 1m;
        proxy_buffer_size 1m;
        
        proxy_redirect off;
        
        server {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-HTTPS-Protocol $ssl_protocol;
            proxy_set_header HTTP_INTERNAL_REQUEST_USERNAME "";
            
            root /usr/share/nginx/html;
            
            location /version {
                add_header Content-Type text/plain;
                add_header Cache-Control no-cache;
                try_files $uri /version.txt;
            }
            
            location /api/static/ {
                try_files $uri =404;
            }
            
            set $ui "ui1";
            if ($server_port = 80 ) { set $ui "ui1"; }
            if ($server_port = 8080 ) { set $ui "ui2"; }
            
            location / {
                root "/usr/share/nginx/html/$ui";
                try_files $uri /index.html;
            }
            
            listen 80 default_server;
            listen 8080;
        }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: front
spec:
  selector:
    matchLabels:
      name: front
  template:
    metadata:
      labels:
        name: front
    spec:
      containers:
      - name: front
        image: logzilla/front:stable
        imagePullPolicy: Always
        resources:
          requests:
            memory: "200Mi"
            cpu: "200m"
          limits:
            memory: "1Gi"
            cpu: "1000m"
        ports:
        - containerPort: 80
          protocol: TCP
          name: front-port
        - containerPort: 8080
          protocol: TCP
          name: new-front-port
        livenessProbe:
          httpGet:
            path: /version
            port: 80
            scheme: HTTP
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        startupProbe:
          httpGet:
            path: /version
            port: 80
            scheme: HTTP
          failureThreshold: 3
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        volumeMounts:
        - name: nginx-conf
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
          readOnly: true
      volumes:
      - name: nginx-conf
        configMap:
          name: front-conf
---
apiVersion: v1
kind: Service
metadata:
  name: front
spec:
  ports:
    - port: 80
      targetPort: front-port
      protocol: TCP
      name: ui-port
    - port: 8080
      targetPort: new-front-port
      protocol: TCP
      name: new-ui-port
  type: ClusterIP
  selector:
    name: front

Notes

  • The front end serves the UI and static assets and proxies to UI variants.
  • Ensure the front Deployment is applied after the LogZilla API is running.
Front End | LogZilla Documentation