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

entrypoint MySQL connection try and SSL #530

Closed
jfcoz opened this issue Sep 16, 2020 · 4 comments
Closed

entrypoint MySQL connection try and SSL #530

jfcoz opened this issue Sep 16, 2020 · 4 comments

Comments

@jfcoz
Copy link

jfcoz commented Sep 16, 2020

MySQL SSL connection

When using WORDPRESS_CONFIG_EXTRA ( #142 ) to force MySQL SSL connection (because the server require this) via :

define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);

The MySQL connection try in entrypoint will not use this setting and slow down the startup by 30 seconds :

$maxTries = 10;
do {
$mysql = new mysqli($host, $user, $pass, '', $port, $socket);
if ($mysql->connect_error) {
fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
--$maxTries;
if ($maxTries <= 0) {
exit(1);
}
sleep(3);
}
} while ($mysql->connect_error);

During this time the container will loop on this kind of errors :

MySQL Connection Error: (9002) SSL connection is required. Please specify SSL options and retry.
@wglambert
Copy link

Related to #264 and https://github.com/docker-library/wordpress/issues/299#issuecomment-412201734

I think we should consider updating our documentation to make it clear that if you need SSL for your MySQL connection, you should not set the environment variables we provide and should instead modify wp-config.php

@jfcoz
Copy link
Author

jfcoz commented Sep 17, 2020

Do you think the connection test could include the wp-config to use strictly the same settings ?

@tianon
Copy link
Member

tianon commented Sep 17, 2020

We wanted to do so, and tried, but because wp-config.php isn't strictly a configuration file and ends with require_once ABSPATH . 'wp-settings.php';, it ends up not being something we can include directly. 😞

@tianon
Copy link
Member

tianon commented Jan 8, 2021

This is fixed by #557, and should be available for testing under the beta tags on Docker Hub soon!

@tianon tianon closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants