agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 524 forks source link

Moving data to new infra causes some operations to time out requests #1367

Closed petrepopescu21 closed 4 years ago

petrepopescu21 commented 4 years ago

Weird title, but let me explain:

I've been running cockpit for a long while now successfully on an Azure App Service with SQLite, on Windows + IIS + FastCGI. Recently I have been working on moving the project to a Kubernetes Cluster.

What I did:

  1. Copy Storage and Config to an Azure Storage File Service
  2. Create my StatefulSet based on agentejo/cockpit:0.9.0 (same as the live version)
  3. Mount the File Service via PVC to the cockpit Pod
  4. Give www-data full permissions on /storage and /config

What happens: First hit goes ok, login dialog opens, I can login. I can open settings, view collections. When I try to open a singleton or an entry from a collection, my server request times out. I have 'debug'=>true turned on, but there is no error recorded.

TL;DR: Basically, opening any "edit" type view which uses the database will crash the app. The config editor works fine. Listing entries in a collection works fine, but not editing an entry. If I remove the volume mounts and start fresh with /install, everything works fine.

I have no idea where to start troubleshooting this given there is no actual error.

LE: I've ruled out ingress controller issues, exposed the pods via a LoadBalancer Service directly facing the same issue. I've also tried recovering each DB file with sqlite3 ".recover" - no dice.

My Persistent Volume:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: azurefile
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  storageClassName: azurefile
  azureFile:
    secretName: azure-secret
    shareName: cockpit
    readOnly: false
  mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=33
  - gid=33
  - mfsymlinks

My Stateful Set:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: cms-deployment
  labels:
    app: cms
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cms
  serviceName: cms
  template:
    metadata:
      labels:
        app: cms
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 33
      containers:
      - name: cms
        image: agentejo/cockpit
        ports:
        - containerPort: 80
        volumeMounts:
        - name: azure
          mountPath: /var/www/html/storage
          subPath: storage
          readOnly: false
        - name: azure
          mountPath: /var/www/html/config
          subPath: config
          readOnly: false
      volumes:
      - name: azure
        persistentVolumeClaim:
          claimName: azurefile
petrepopescu21 commented 4 years ago

Started working fine after adding the nobrl mountOptions flag.