Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Cache Path and DB Connection Timeout in Mixpost (when deploying in Kubernetes) #120

Open
cypr0 opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cypr0
Copy link

cypr0 commented Nov 26, 2024

Steps to reproduce the problem

  1. Deploy Mixpost via Helm chart (app-template from bjw-s) in a Kubernetes cluster using the following configuration:
    env:
      DB_HOST: "mixpost-mysql.productivity.svc.cluster.local"
      DB_PORT: 3306
      DB_DATABASE: mixpostdb
      DB_USERNAME: mixpostusr
      REDIS_HOST: "dragonfly.database.svc.cluster.local"
      REDIS_PORT: 6379
    

Expected behaviour

Laravel initializes with a valid cache path (when the storage directory is mounted). The application connects to the MySQL database and Redis using the configured hostnames and ports.

Actual behaviour

Laravel throws the following error: production.ERROR: Please provide a valid cache path. The application logs indicate a connection timeout while trying to connect to MySQL: wait-for-it.sh: waiting 60 seconds for mysql:3306 wait-for-it.sh: timeout occurred after waiting 60 seconds for mysql:3306

Detailed description

The Mixpost application encounters two issues during deployment in a Kubernetes environment using a custom Helm chart:

  1. Invalid Cache Path: Laravel throws an error stating that no valid cache path is provided, despite the storage directory being configured and mounted as well as a REDIS_HOST variable is configured.

  2. Connection Timeout: The application fails to connect to the MySQL database, resulting in a connection timeout, even though the environment variables for database and Redis hosts are configured.

This report is based on the usage of the bjw-s Helm Chart, specifically the app-template chart v 3.5.1 and the following manifest:

---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: mixpost
spec:
  interval: 1m
  chart:
    spec:
      chart: app-template
      version: 3.5.1
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
      interval: 15m
  maxHistory: 2
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      retries: 3
  uninstall:
    keepHistory: false
  values:
    defaultPodOptions:
      annotations:
        reloader.stakater.com/auto: "true"
      securityContext:
          runAsNonRoot: false
          runAsUser: 0
          runAsGroup: 0
    controllers:
      main:
        replicas: 1
        strategy: RollingUpdate
        containers:
          mixpost:
            image:
              repository: inovector/mixpost
              tag: v1.7.2
            probes:
              startup:
                enabled: true
                spec:
                  failureThreshold: 30
                  periodSeconds: 5
              liveness:
                enabled: true
              readiness:
                enabled: true
                spec:
                  exec:
                    command:
                      - sh
                      - -c
                      - |
                        curl -s mixpost-mysql:3306 >/dev/null
                  initialDelaySeconds: 10
                  periodSeconds: 5
                  failureThreshold: 3
            env:
              APP_NAME: Mixpost
              APP_DEBUG: false
              APP_DOMAIN: mixpost.${SECRET_DOMAIN}
              APP_URL: https://mixpost.${SECRET_DOMAIN}
              DB_HOST: "mixpost-mysql.productivity.svc.cluster.local"
              DB_PORT: 3306
              DB_DATABASE: &dbname mixpostdb
              DB_USERNAME: &dbuser mixpostusr
              QUEUE_CONNECTION: redis
              REDIS_HOST: "dragonfly.database.svc.cluster.local"
              REDIS_PORT: 6379
            envFrom:
              - secretRef:
                  name: mixpost-secret
          mysql:
            image:
              repository: mysql/mysql-server
              tag: 8.0.32
            probes:
              startup:
                enabled: true
                spec:
                  failureThreshold: 30
                  periodSeconds: 5
              liveness:
                enabled: true
              readiness:
                enabled: true
                spec:
                  tcpSocket:
                    port: 3306
                  initialDelaySeconds: 5
                  periodSeconds: 10
                  failureThreshold: 3
            env:
              MYSQL_DATABASE: *dbname
              MYSQL_USER: *dbuser
            envFrom:
              - secretRef:
                  name: mixpost-secret
    service:
      mixpost:
        controller: main
        ports:
          http:
            port: 80
      mysql:
        controller: main
        ports:
          mysql:
            port: 3306
    ingress:
      main:
        enabled: true
        className: internal
        annotations:
          external-dns.alpha.kubernetes.io/target: "internal.${SECRET_DOMAIN}"
        hosts:
          - host: &host mixpost.${SECRET_DOMAIN}
            paths:
              - path: /
                pathType: Prefix
                service:
                  identifier: mixpost
                  port: http
        tls:
          - hosts:
              - *host
    persistence:
      storage:
        type: persistentVolumeClaim
        existingClaim: mixpost-data-pvc
        advancedMounts:
          main:
            mixpost:
              - path: /var/www/html/storage
                subPath: storage
                readOnly: false
            mysql:
              - path: /var/lib/mysql
                subPath: mysql
                readOnly: false


### Specifications

mixpost 1.7.2
mysql-server 8.0.32
kubernetes v1.31.2
bjw-s template v3.5.1
@cypr0 cypr0 added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant