Files
eveAI/k8s/dev/static-files-service.yaml
Josako 4c00d33bc3 - Check-in voordat we aan bugfix beginnen te werken.
- Introductie van static-files serving met standaard nginx (niet ons docker nginx image), en een rsync service om static files te synchroniseren. Nog niet volledig afgewerkt!
2025-08-21 05:48:03 +02:00

122 lines
2.9 KiB
YAML

# Static Files Service for EveAI Dev Environment (v2 - PersistentVolume based)
# File: static-files-service.yaml
---
# Static Files ConfigMap (enhanced caching)
apiVersion: v1
kind: ConfigMap
metadata:
name: static-files-config
namespace: eveai-dev
data:
nginx.conf: |
server {
listen 80;
server_name _;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/css application/javascript application/json image/svg+xml;
location /static/ {
alias /usr/share/nginx/html/static/;
# Aggressive caching voor versioned assets
location ~* \.(js|css)$ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header X-Content-Type-Options nosniff;
}
# Moderate caching voor images
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
expires 30d;
add_header Cache-Control "public";
}
# Default caching
expires 1h;
add_header Cache-Control "public";
}
location /health {
return 200 'OK';
add_header Content-Type text/plain;
}
}
---
# Static Files Deployment (GEEN CUSTOM IMAGE!)
apiVersion: apps/v1
kind: Deployment
metadata:
name: static-files
namespace: eveai-dev
labels:
app: static-files
environment: dev
spec:
replicas: 2 # Voor high availability
selector:
matchLabels:
app: static-files
template:
metadata:
labels:
app: static-files
spec:
containers:
- name: nginx
image: nginx:alpine # 🎉 STANDARD IMAGE!
ports:
- containerPort: 80
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d
- name: static-files
mountPath: /usr/share/nginx/html
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 5
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "100m"
volumes:
- name: nginx-config
configMap:
name: static-files-config
- name: static-files
persistentVolumeClaim:
claimName: static-files-pvc
---
# Service (ongewijzigd)
apiVersion: v1
kind: Service
metadata:
name: static-files-service
namespace: eveai-dev
labels:
app: static-files
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: static-files