瀏覽代碼

Helm de Collabora y nueva versión nextcloud

Celestino Rey 11 小時之前
父節點
當前提交
21221bfbe6

+ 23 - 0
HelmCharts/collabora-chart/.helmignore

@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/

+ 24 - 0
HelmCharts/collabora-chart/Chart.yaml

@@ -0,0 +1,24 @@
+apiVersion: v2
+name: collabora-chart
+description: A Helm chart for Kubernetes
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+# It is recommended to use it with quotes.
+appVersion: "24.04"

+ 61 - 0
HelmCharts/collabora-chart/README.md

@@ -0,0 +1,61 @@
+# Collabora Online (CODE) — chart de despliegue
+
+Alternativa a ONLYOFFICE para editar documentos desde Nextcloud.
+
+## Descripción
+
+- Imagen: `collabora/code:latest` (Community Edition, gratuita, sin licencia).
+- Namespace: `collabora`.
+- Service: NodePort `30980` → puerto interno `9980`.
+- PVC `collabora-config-claim` (5Gi, `local-path`) en `/opt/coolwsd`.
+- `privileged: true` en el `securityContext` del contenedor (lo exige el sandbox de CODE).
+- Entorno relevante en `templates/collabora-deployment.yaml`:
+  - `server_name=collabora.reymota.es`
+  - `aliasgroup1=https://nextcloud.reymota.es`
+  - TLS delegado al nginx externo: `--o:ssl.enable=false --o:ssl.termination=true`
+  - `dictionaries=es_ES en_GB en_US`, `TZ=Europe/Madrid`
+
+## Instalación
+
+```bash
+helm install collabora ./collabora-chart --namespace collabora --create-namespace
+helm upgrade collabora ./collabora-chart --namespace collabora   # tras editar el chart
+```
+
+## Configuración en el nodo (k8s-server)
+
+1. Copiar el vhost proxy al nginx externo:
+   ```bash
+   cp NginxConf202311/nginx/collabora.conf /etc/nginx/sites-available/
+   ln -s /etc/nginx/sites-available/collabora.conf /etc/nginx/sites-enabled/
+   nginx -t && systemctl reload nginx
+   ```
+2. DNS: `collabora.reymota.es` → `192.168.1.147`.
+3. Certificado TLS:
+   ```bash
+   certbot --nginx -d collabora.reymota.es
+   ```
+
+## Configuración en Nextcloud
+
+1. Instalar la app **Collabora Online** (`richdocuments`) desde Apps.
+2. En *Administración → Colaboración Online*: usar *Use your own server* y poner WOPI URL:
+   ```
+   https://collabora.reymota.es
+   ```
+3. Verificar creando/abriendo un documento desde Files.
+
+## Operación
+
+- Panel `/admin` de Collabora: usuario `admin`, password del secret `collabora-creds` (clave `admin-pass`).
+- Cambiar contraseña:
+  ```bash
+  kubectl -n collabora create secret generic collabora-creds \
+    --from-literal=admin-pass='TuNuevaPassword' --dry-run=client -o yaml | kubectl replace -f -
+  kubectl -n collabora rollout restart deploy/collabora-server
+  ```
+
+## Notas
+
+- Constituye la **alternativa** a ONLYOFFICE (`office.reymota.es`), que al ser *Developer Edition* requiere licencia comercial / prueba de 30 días.
+- Límite de CODE: 20 conexiones concurrentes (suficiente para uso doméstico).

+ 78 - 0
HelmCharts/collabora-chart/templates/collabora-deployment.yaml

@@ -0,0 +1,78 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: collabora-server
+  namespace: collabora
+  labels:
+    app: collabora
+spec:
+  selector:
+    app: collabora
+  type: NodePort
+  ports:
+    - port: 9980
+      nodePort: 30980
+      targetPort: cool
+      name: cool
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: collabora-server
+  namespace: collabora
+  labels:
+    app: collabora
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: collabora
+  template:
+    metadata:
+      labels:
+        app: collabora
+    spec:
+      containers:
+      - name: collabora
+        image: collabora/code:latest
+        imagePullPolicy: IfNotPresent
+        securityContext:
+          privileged: true # CODE necesita privilegios para el sandbox (kit jail)
+        ports:
+        - containerPort: 9980
+          name: cool
+        env:
+        - name: username
+          value: "admin"
+        - name: password
+          valueFrom:
+            secretKeyRef:
+              name: collabora-creds
+              key: admin-pass
+        - name: server_name
+          value: "collabora.reymota.es"
+        # Host que puede usar Collabora (tu Nextcloud). Añade más aliases si hace falta
+        - name: aliasgroup1
+          value: "https://nextcloud.reymota.es"
+        # TLS lo gestiona el nginx externo, no Collabora
+        - name: DONT_EXIT_ON_SSL_ERROR
+          value: "true"
+        - name: extra_params
+          value: "--o:ssl.enable=false --o:ssl.termination=true --o:welcome.enable=false"
+        - name: dictionaries
+          value: "es_ES en_GB en_US"
+        - name: TZ
+          value: "Europe/Madrid"
+        resources:
+          requests:
+            cpu: 500m
+            memory: 1Gi
+          limits:
+            memory: 2Gi
+        volumeMounts:
+        - name: config
+          mountPath: /opt/coolwsd
+      volumes:
+      - name: config
+        persistentVolumeClaim:
+          claimName: collabora-config-claim

+ 9 - 0
HelmCharts/collabora-chart/templates/collabora-secrets.yaml

@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: collabora-creds
+  namespace: collabora
+type: Opaque
+stringData:
+  # Cambia esta contraseña antes de desplegar. Se usa en /admin de Collabora
+  admin-pass: "CambiarMe123"

+ 13 - 0
HelmCharts/collabora-chart/templates/pvc-collabora.yaml

@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: collabora-config-claim
+  namespace: collabora
+  labels:
+    app: collabora
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 5Gi

+ 78 - 0
HelmCharts/collabora-chart/values.yaml

@@ -0,0 +1,78 @@
+# Default values for collabora-chart.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+image:
+  repository: collabora/code
+  pullPolicy: IfNotPresent
+  # Overrides the image tag whose default is the chart appVersion.
+  tag: ""
+
+imagePullSecrets: []
+nameOverride: ""
+fullnameOverride: ""
+
+serviceAccount:
+  # Specifies whether a service account should be created
+  create: true
+  # Annotations to add to the service account
+  annotations: {}
+  # The name of the service account to use.
+  # If not set and create is true, a name is generated using the fullname template
+  name: ""
+
+podAnnotations: {}
+
+podSecurityContext: {}
+  # fsGroup: 2000
+
+securityContext: {}
+  # capabilities:
+  #   drop:
+  #   - ALL
+  # readOnlyRootFilesystem: true
+  # runAsNonRoot: true
+  # runAsUser: 1000
+
+service:
+  type: NodePort
+  port: 9980
+  nodePort: 30980
+
+ingress:
+  enabled: false
+  className: ""
+  annotations: {}
+    # kubernetes.io/ingress.class: nginx
+    # kubernetes.io/tls-acme: "true"
+  hosts:
+    - host: chart-example.local
+      paths:
+        - path: /
+          pathType: ImplementationSpecific
+  tls: []
+  #  - secretName: chart-example-tls
+  #    hosts:
+  #      - chart-example.local
+
+resources:
+  requests:
+    cpu: 500m
+    memory: 1Gi
+  limits:
+    memory: 2Gi
+
+autoscaling:
+  enabled: false
+  minReplicas: 1
+  maxReplicas: 100
+  targetCPUUtilizationPercentage: 80
+  # targetMemoryUtilizationPercentage: 80
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}

+ 1 - 1
HelmCharts/nextcloud-chart/templates/nextcloud-cron.yaml

@@ -15,7 +15,7 @@ spec:
           restartPolicy: OnFailure
           containers:
             - name: nextcloud-cron
-              image: nextcloud:34.0.3-apache # Usa la misma etiqueta (tag) que tu pod principal
+              image: nextcloud:34.0.4-apache # Usa la misma etiqueta (tag) que tu pod principal
               imagePullPolicy: IfNotPresent
               command:
                 - /usr/local/bin/php

+ 1 - 1
HelmCharts/nextcloud-chart/templates/nextcloud-deployment.yaml

@@ -33,7 +33,7 @@ spec:
     spec:
       containers:
       - name: nextcloud
-        image: nextcloud:34.0.3-apache
+        image: nextcloud:34.0.4-apache
         volumeMounts:
         - name: server-storage
           mountPath: /var/www/html

+ 22 - 0
NginxConf202311/nginx/collabora.conf

@@ -0,0 +1,22 @@
+server {
+    ##
+    # Collabora Online (CODE) - WebSocket + HTTP
+    ##
+    server_name collabora.reymota.es;
+
+    location / {
+        proxy_pass http://192.168.1.147:30980/;
+        proxy_set_header Host $host;
+        proxy_set_header X-Forwarded-Host $host;
+        proxy_set_header X-Forwarded-Server $host;
+        proxy_set_header X-Forwarded-Proto $scheme;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "Upgrade";
+        proxy_buffering off;
+        proxy_read_timeout 3600s;
+        client_max_body_size 0;
+    }
+
+}