fix: k8s on-premise deployment and session persistence
Some checks failed
scrum-manager/pipeline/head There was a failure building this commit

Database fixes:
- Add hostPath.type=DirectoryOrCreate so kubelet auto-creates /mnt/data/mysql
- Add fsGroup=999 so MySQL process can write to the hostPath volume
- Add MYSQL_ROOT_HOST=% to allow backend pods to authenticate as root
- Fix liveness/readiness probes to include credentials (-p$MYSQL_ROOT_PASSWORD)
- Increase probe initialDelaySeconds (30/60s) for slow first-run init
- Add 15s grace sleep in backend initContainer after MySQL TCP is up
- Add persistentVolumeReclaimPolicy=Retain to prevent accidental data loss
- Explicit accessModes+resources in PVC patch to avoid list merge ambiguity
- Add nodeAffinity comment in PV for multi-node cluster guidance

Ingress/nginx fixes:
- Remove broken rewrite-target=/ that was rewriting all paths (incl /api) to /
- Route /socket.io directly to backend for WebSocket support
- Add /socket.io/ proxy location to both nginx.conf and K8s ConfigMap

Frontend fix:
- Persist currentUser to localStorage on login so page refresh no longer
  clears session and redirects users back to the login page

Tooling:
- Add k8s/overlays/on-premise/deploy.sh for one-command deployment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
tusuii
2026-02-27 21:00:10 +05:30
parent fa8efe874e
commit 73bd35173c
9 changed files with 222 additions and 129 deletions

View File

@@ -24,14 +24,14 @@ spec:
- sh
- -c
- |
echo "Waiting for MySQL port to open..."
echo "Waiting for MySQL TCP to be available..."
until nc -z mysql 3306; do
echo "MySQL not ready yet, retrying in 5s..."
sleep 5
echo "MySQL not reachable yet, retrying in 3s..."
sleep 3
done
echo "Port open — waiting 15s for MySQL to finish initializing..."
echo "MySQL TCP is up. Waiting 15s for full initialization..."
sleep 15
echo "MySQL is ready!"
echo "Proceeding to start backend."
containers:
- name: backend
image: scrum-backend:latest
@@ -48,12 +48,12 @@ spec:
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_USER # matches new secret key
key: DB_USER
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_PASSWORD # matches new secret key
key: DB_PASSWORD
- name: DB_NAME
valueFrom:
secretKeyRef:
@@ -72,7 +72,7 @@ spec:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 30
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
@@ -80,7 +80,7 @@ spec:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 15
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 5
failureThreshold: 5