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

[bitnami/wordpress] how to add define('WP_ALLOW_REPAIR', true) after first deployment #21659

Closed
xyfleet opened this issue Dec 20, 2023 · 12 comments
Assignees
Labels
solved stale 15 days without activity tech-issues The user has a technical issue about an application wordpress

Comments

@xyfleet
Copy link

xyfleet commented Dec 20, 2023

Name and Version

bitnami/wordpress 18.1.29

What architecture are you using?

amd64

What steps will reproduce the bug?

1: install the wordpress by helm chart
After the first deployment, I want to add the WP_ALLOW_REPAIR' into the existing wordpress pod
2: I updated the values.yaml file in the chart and applied.

wordpressExtraConfigContent: |
  define('WP_ALLOW_REPAIR', true);

3: however in the pod, I did not see the new configuration( define('WP_ALLOW_REPAIR', true);
), in the file, wp-config.php. Looks like the change did not take effect in the pod

Are you using any custom parameters or values?

wordpressExtraConfigContent: |
  define('WP_ALLOW_REPAIR', true);

What is the expected behavior?

After we adding, define('WP_ALLOW_REPAIR', true, I should be able to access the repair page:
http://your-site.com/wp-admin/maint/repair.php".

What do you see instead?

Not able to access this page.

Additional information

After the first deployment, can I use these the parameters, wordpressExtraConfigContent to configure the wordpress pod? Do I have to completely delete the wordpress and re-install the chart with this change wordpressExtraConfigContent at the same time?

@xyfleet xyfleet added the tech-issues The user has a technical issue about an application label Dec 20, 2023
@github-actions github-actions bot added the triage Triage is needed label Dec 20, 2023
@xyfleet
Copy link
Author

xyfleet commented Dec 20, 2023

For this deployment, I am using an external mysql DB to store data. There is also a volume allocated to the wordpress pod in the K8s cluster. I have several articles, plugins installed, users registered in my blog. If I cannot modify the setting of wordpress, is it safe for me to delete the helm chart and reinstall it? If I delete the chart, the volume will be removed automatically. Is there any data loss if the volume got deleted?
What kind of data stored in this volume? (The external DB will not be impacted.)

@github-actions github-actions bot removed the triage Triage is needed label Dec 20, 2023
@github-actions github-actions bot assigned juan131 and unassigned javsalgar Dec 20, 2023
@juan131
Copy link
Contributor

juan131 commented Dec 21, 2023

Hi @xyfleet

You could try the workaround below to customize the wp-config.php and adapt it to your needs once the chart has been installed:

  • Install chart
helm install wordpress oci://registry-1.docker.io/bitnamicharts/wordpress
  • Wait for pods to be ready and extract wp-config.php with kubectl cp:
kubectl cp "$(kubectl get pod -o jsonpath='{.items[0].metadata.name}' -l app.kubernetes.io/name=wordpress)":/bitnami/wordpress/wp-config.php wp-config.php
  • Edit wp-config.php and create a secret including it:
kubectl create secret generic wordpress-config --from-file=wp-config.php
  • Upgrade chart using the new secret:
helm upgrade wordpress oci://registry-1.docker.io/bitnamicharts/wordpress --set existingWordPressConfigurationSecret=wordpress-config --set wordpressSkipInstall=true

Copy link

github-actions bot commented Jan 6, 2024

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 Jan 6, 2024
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 Jan 11, 2024
@xyfleet
Copy link
Author

xyfleet commented May 18, 2024

@juan131 Thanks a lot.
This time I want to enlarge the PHP memory limit from 512MB to 6G. I followed the instruction and found something interesting.
First, I created a new secret, wordpress-custom-config, with the new updated wp-config.php. In the wp-config.php, I added one line,
define( 'WP_MEMORY_LIMIT', '6G' );

After upgrade the chart with the secret, wordpress-custom-config, the pod was installed successfully. However, in the wp-config.php, there is no the new update, define( 'WP_MEMORY_LIMIT', '6G' );.
In the pod, I run a command to check the memory limit of PHP:


php -i | grep "memory_limit"
memory_limit => 512M => 512M

But in the web portal of the blog, I found this. From the screenshot, I can see the max memory is 6,144 MB. Previous it was 512MB. Really confused. Not sure which one is right. Does my change take effective?

Screenshot2024_05_18_105027

Thanks,

@juan131
Copy link
Contributor

juan131 commented May 20, 2024

Hi @xyfleet

However, in the wp-config.php, there is no the new update, define( 'WP_MEMORY_LIMIT', '6G' );.

Did you check its content in this path: /opt/bitnami/wordpress/wp-config.php?

I run a command to check the memory limit of PHP

Please note you're not limiting PHP memory, see https://wordpress.stackexchange.com/questions/131179/php-memory-limit-vs-wp-memory-limit

@xyfleet
Copy link
Author

xyfleet commented May 20, 2024

@juan131
You are right. I see the define( 'WP_MEMORY_LIMIT', '6G' ) in this path, /opt/bitnami/wordpress/wp-config.php. I am wondering if this setting is OK, given the php limit is only 512MB.

Based on what I found that the wp memory limit must be less than php limit, my setting (memory limit 6G) is not gonna work when the php limit is only 512MB.

So, what configuration should I have here for memory limit?

@xyfleet
Copy link
Author

xyfleet commented May 20, 2024

One more question here:
what's the difference between two wp-config.php files? (one is in the path/bitnami/wordpress, another is in the path, /opt/bitnami/wordpress)

@juan131
Copy link
Contributor

juan131 commented May 21, 2024

Hi @xyfleet

Based on what I found that the wp memory limit must be less than php limit, my setting (memory limit 6G) is not gonna work when the php limit is only 512MB.
So, what configuration should I have here for memory limit?

If you have any questions about the application itself, customizing its content, or questions about technology and infrastructure usage, we highly recommend that you refer to the forums and user guides provided by the project responsible for the application or technology.

They'll provide better advisement about the memory limits to set for both WordPress and PHP.

what's the difference between two wp-config.php files? (one is in the path/bitnami/wordpress, another is in the path, /opt/bitnami/wordpress)

The data /bitnami/wordpress is that data to be persisted. The 1st time you deployed WordPress, a configuration file was generated based on the env. variables set in the container, then it was persisted at bitnami/wordpress/wp-config.php, finally a symbolic link was created so /opt/bitnami/wordpress/wp-config.php pointed to bitnami/wordpress/wp-config.php.

However, when the existingWordPressConfigurationSecret parameter is set, the custom wp-config.php is directly mounted at /opt/bitnami/wordpress/wp-config.php, see:

No symbolic link is created and the bitnami/wordpress/wp-config.php that was previously persisted is ignored. Indeed, you could safely remove it if you want since it won't be persisted anymore, see:

@xyfleet
Copy link
Author

xyfleet commented May 22, 2024

@juan131 Thank you so much. Really appreciate it.

By default, the php memory limit is 512MB. Even I configure define( 'WP_MEMORY_LIMIT', '6G' ) , that will not work.

How can I try to modify the php memory limit? I see the php.ini under /opt/bitnami/php/etc. Looks like in the values.yaml, there is no parameter for php.ini. (I want to know if there is any workaround I can do similar as you mentioned for wp-config.php.)

@juan131
Copy link
Contributor

juan131 commented May 22, 2024

Hi @xyfleet

Try setting the PHP_MEMORY_LIMIT environment variable (you can make use of the extraEnvVars parameter in your values.yaml):

extraEnvVars:
  - name: PHP_MEMORY_LIMIT
    value: "1G"

We also recommend to browse the existing issues, it's very likely that this kind of questions have been previously answered. For instance, this particular topic was covered at #6310 (comment).

Thanks!

@xyfleet
Copy link
Author

xyfleet commented May 22, 2024

@juan131 Thanks a lot. 👍

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