- 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!
106 lines
2.5 KiB
YAML
106 lines
2.5 KiB
YAML
# Static Files Access Pod for EveAI Dev Environment
|
|
# File: static-files-access.yaml
|
|
# Provides rsync daemon access to static files PVC
|
|
---
|
|
# Rsync Access Deployment
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: static-files-access
|
|
namespace: eveai-dev
|
|
labels:
|
|
app: static-files-access
|
|
environment: dev
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: static-files-access
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: static-files-access
|
|
spec:
|
|
containers:
|
|
- name: rsync-daemon
|
|
image: alpine:latest
|
|
command: ["/bin/sh"]
|
|
args:
|
|
- -c
|
|
- |
|
|
# Install rsync
|
|
apk add --no-cache rsync
|
|
|
|
# Create rsync configuration
|
|
cat > /etc/rsyncd.conf << 'RSYNC_EOF'
|
|
pid file = /var/run/rsyncd.pid
|
|
lock file = /var/run/rsync.lock
|
|
log file = /var/log/rsyncd.log
|
|
port = 873
|
|
|
|
[static]
|
|
path = /data/static
|
|
comment = Static Files Volume
|
|
uid = nobody
|
|
gid = nobody
|
|
read only = false
|
|
list = yes
|
|
auth users =
|
|
secrets file =
|
|
hosts allow = *
|
|
RSYNC_EOF
|
|
|
|
# Create target directory
|
|
mkdir -p /data/static
|
|
chown nobody:nobody /data/static
|
|
|
|
# Start rsync daemon
|
|
echo "Starting rsync daemon..."
|
|
rsync --daemon --no-detach --config=/etc/rsyncd.conf
|
|
ports:
|
|
- containerPort: 873
|
|
name: rsync
|
|
volumeMounts:
|
|
- name: static-files
|
|
mountPath: /data
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: 873
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 30
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: 873
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
resources:
|
|
requests:
|
|
memory: "32Mi"
|
|
cpu: "25m"
|
|
limits:
|
|
memory: "64Mi"
|
|
cpu: "50m"
|
|
volumes:
|
|
- name: static-files
|
|
persistentVolumeClaim:
|
|
claimName: static-files-pvc
|
|
|
|
---
|
|
# NodePort Service for external rsync access
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: static-files-access-service
|
|
namespace: eveai-dev
|
|
labels:
|
|
app: static-files-access
|
|
spec:
|
|
type: NodePort
|
|
ports:
|
|
- port: 873
|
|
targetPort: 873
|
|
nodePort: 30873
|
|
protocol: TCP
|
|
name: rsync
|
|
selector:
|
|
app: static-files-access |