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

Unable to add extra WordPress config in wp-config.php file #16084

Closed
ayush-sachdev opened this issue Apr 17, 2023 · 3 comments
Closed

Unable to add extra WordPress config in wp-config.php file #16084

ayush-sachdev opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
solved stale 15 days without activity tech-issues The user has a technical issue about an application wordpress

Comments

@ayush-sachdev
Copy link

ayush-sachdev commented Apr 17, 2023

Name and Version

bitnami/wordpress:latest

What architecture are you using?

amd64

What steps will reproduce the bug?

Set up Kubernetes pods using bitnami/wordpress:latest docker image and add WORDPRESS_EXTRA_WP_CONFIG_CONTENT in the deployment manifest file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      securityContext:
        fsGroup: 1001
      containers:
        - name: wordpress
          image: bitnami/wordpress:latest
          securityContext:
            runAsUser: 1001
            allowPrivilegeEscalation: false
          ports:
          - containerPort: 8080
            name: wordpress
          env:
            - name: WORDPRESS_EXTRA_WP_CONFIG_CONTENT
              value: "define( 'WP_AUTO_UPDATE_CORE', false ); \
                      define( 'WP_CACHE', true); \
                      define( 'WPCACHEHOME', '/bitnami/wordpress/wp-content/plugins/wp-super-cache/'); \ "
            - name: WORDPRESS_DATABASE_HOST
              value: <DB Host>
            - name: WORDPRESS_DATABASE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: wp-db-secrets
                  key: MYSQL_ROOT_PASSWORD
            - name: WORDPRESS_DATABASE_USER
              value: <DB User>
            - name: WORDPRESS_DATABASE_NAME
              value: <DB Name>
          resources:
            requests:
              memory: "500Mi"
              cpu: "200m"
            limits:
              memory: "500Mi"
              cpu: "200m"
          volumeMounts:
            - name: wordpress-pvc
              mountPath: "/bitnami/wordpress"
      volumes:
        - name: wordpress-pvc
          persistentVolumeClaim:
            claimName: wordpress-pvc-claim

Are you using any custom parameters or values?

I am adding Extra config environment in deployment manifest file.

env:
            - name: WORDPRESS_EXTRA_WP_CONFIG_CONTENT
              value: "define( 'WP_AUTO_UPDATE_CORE', false ); \
                      define( 'WP_CACHE', true); \
                      define( 'WPCACHEHOME', '/bitnami/wordpress/wp-content/plugins/wp-super-cache/'); \ "

What is the expected behavior?

We should be able to see the added extra WordPress config values in wp-config.php file.

What do you see instead?

I am using WordPress docker image to build my Kubernetes application. But when I am adding value to the env variable WORDPRESS_EXTRA_WP_CONFIG_CONTENT they are not appending in the wp-config.php.
I can see the values inside the pod but not in the wp-config.php file.
image

@ayush-sachdev ayush-sachdev added the tech-issues The user has a technical issue about an application label Apr 17, 2023
@bitnami-bot bitnami-bot added this to Triage in Support Apr 17, 2023
@github-actions github-actions bot added the triage Triage is needed label Apr 17, 2023
@carrodher carrodher moved this from Triage to In progress in Support Apr 18, 2023
@github-actions github-actions bot added in-progress and removed triage Triage is needed labels Apr 18, 2023
@bitnami-bot bitnami-bot assigned dgomezleon and unassigned javsalgar Apr 18, 2023
@dgomezleon
Copy link
Member

dgomezleon commented Apr 18, 2023

Hello @ayush-sachdev ,

I was not able to reproduce the error by applying the following change in the chart:

diff --git a/bitnami/wordpress/values.yaml b/bitnami/wordpress/values.yaml
index ab5b2979f..faa2c0b6f 100644
--- a/bitnami/wordpress/values.yaml
+++ b/bitnami/wordpress/values.yaml
@@ -230,7 +230,11 @@ args: []
 ##   - name: FOO
 ##     value: "bar"
 ##
-extraEnvVars: []
+extraEnvVars:
+  - name: WORDPRESS_EXTRA_WP_CONFIG_CONTENT
+    value: "define( 'WP_AUTO_UPDATE_CORE', false ); \
+                      define( 'WP_CACHE', true); \
+                      define( 'WPCACHEHOME', '/bitnami/wordpress/wp-content/plugins/wp-super-cache/'); \ "
 ## @param extraEnvVarsCM Name of existing ConfigMap containing extra env vars
 ##
 extraEnvVarsCM: ""

With this. result:

$ kubectl exec wp-wordpress-58677795f8-tp96b -- cat /opt/bitnami/wordpress/wp-config.php | grep CACHE

define( 'WP_AUTO_UPDATE_CORE', false ); define( 'WP_CACHE', true); define( 'WPCACHEHOME', '/bitnami/wordpress/wp-content/plugins/wp-super-cache/');

Could you please double-check it by removing the existing PVC?

@github-actions github-actions bot moved this from In progress to Pending in Support Apr 18, 2023
@github-actions
Copy link

github-actions bot commented May 6, 2023

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label May 6, 2023
@github-actions
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
@bitnami-bot bitnami-bot moved this from Pending to Solved in Support May 11, 2023
@github-actions github-actions bot removed this from Solved in Support May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved stale 15 days without activity tech-issues The user has a technical issue about an application wordpress
Projects
None yet
Development

No branches or pull requests

5 participants