Files
sbbb/base/lasuite/patch-drive-wopi-init.yaml

90 lines
3.2 KiB
YAML
Raw Normal View History

# Init container that waits for Collabora and configures WOPI on every pod start.
#
# The Drive chart's configure_wopi Job is designed for ArgoCD PostSync hooks
# and only runs on `sunbeam apply`. On server restart, no one re-triggers it,
# so WOPI editing silently breaks. This init container fixes that — every time
# a Drive backend pod starts (restart, rollout, scale-up), it waits for
# Collabora and runs trigger_wopi_configuration before the main container.
apiVersion: apps/v1
kind: Deployment
metadata:
name: drive-backend
namespace: lasuite
spec:
template:
spec:
initContainers:
- name: configure-wopi
image: lasuite/drive-backend:latest
command:
- "/bin/sh"
- "-c"
- |
echo "Waiting for Collabora..."
for i in $(seq 1 36); do
if wget -qO /dev/null --timeout=5 http://collabora.lasuite.svc.cluster.local:9980/hosting/discovery 2>/dev/null; then
echo "Collabora ready — configuring WOPI..."
python manage.py trigger_wopi_configuration
exit $?
fi
echo "Attempt $i/36: not ready, retrying in 5s..."
sleep 5
done
echo "WARN: Collabora not ready after 3 minutes — starting without WOPI"
exit 0
env:
# Database — minimum needed for Django manage.py
- name: DB_ENGINE
value: django.db.backends.postgresql
- name: DB_NAME
value: drive_db
- name: DB_USER
value: drive
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: lasuite-postgres
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: lasuite-postgres
key: DB_PORT
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: drive-db-credentials
key: password
# Django
- name: DJANGO_CONFIGURATION
value: Production
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
name: drive-django-secret
key: DJANGO_SECRET_KEY
# Redis/Celery — trigger_wopi_configuration dispatches a Celery task
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: lasuite-valkey
key: REDIS_URL
- name: DJANGO_CELERY_BROKER_URL
valueFrom:
configMapKeyRef:
name: lasuite-valkey
key: CELERY_BROKER_URL
# WOPI
- name: WOPI_CLIENTS
value: collabora
- name: WOPI_COLLABORA_DISCOVERY_URL
value: http://collabora.lasuite.svc.cluster.local:9980/hosting/discovery
- name: WOPI_SRC_BASE_URL
value: https://drive.DOMAIN_SUFFIX
resources:
limits:
memory: 128Mi
requests:
memory: 64Mi
cpu: 25m