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

db_ready fails for MySQL/Mariadb without SSL #13

Open
timwsuqld opened this issue Dec 11, 2024 · 3 comments
Open

db_ready fails for MySQL/Mariadb without SSL #13

timwsuqld opened this issue Dec 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@timwsuqld
Copy link

Summary

db_ready mariadb fails when the remote server doesn't support SSL

Steps to reproduce

Connecting to CloudSQL instance via cloudsqlproxy, no SSL supported. Error is [invoiceninja] MySQL/MariaDB Server 'cloud-sql-5896' is not accessible, retrying.. (5 seconds so far) which just continues.

Manually checking the command that tests if ready gives the following output

/usr/bin/mysqladmin: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-admin' instead
/usr/bin/mysqladmin: connect to server at 'cloud-sql-5896' failed
error: 'TLS/SSL error: SSL is required, but the server does not support it

What is the expected correct behavior?

Should get an OK response, e.g.
Uptime: 3873532 Threads: 29 Questions: 612692459 Slow queries: 5092 Opens: 29799041 Flush tables: 5313 Open tables: 2496 Queries per second avg: 158.174

Relevant logs and/or screenshots

Environment

  • Image version / tag: 1.0.149
  • Host OS: Ubuntu 22.04
Any logs | docker-compose.yml

Possible fixes

Need to add --skip-ssl to the /usr/bin/mysqladmin command. Probably also need to change that to /usr/bin/mariadb-admin

@timwsuqld timwsuqld added the bug Something isn't working label Dec 11, 2024
@tiredofit
Copy link
Owner

Thanks for the detailed report! This was caused upstream by the release of Alpine 3.21 last week and by the changing of some defaults which cascaded down 4 images (nginx, nginx-php-fpm, invoiceninja) to affect you. I've pinned the the dependent images to known working ones which do add the necessary arguments of --skip-ssl. There's an undocumented DB_MYSQL_ARGS variable in use now that can pass arguments like this - it's not fully fleshed out yet and will form much more usefulness in upcoming base image versions..

1.0.150 is the updated release.

@timwsuqld
Copy link
Author

Thanks for the update. I hit more issues with the artisan migrate:fresh command. So it appears the Alpine update is breaking a lot more by changing the defaults.

$ php artisan migrate:fresh --force
                                                                                                       
   INFO  Preparing database.                                                                           
                                                                                                                                                                                                              
  Creating migration table ............................................................................................................ 58.22ms DONE
                                                                                                       
   INFO  Loading stored database schemas.                                                              
                                                                                                                                                                                                              
  database/schema/mysql-schema.sql .................................................................................................... 57.13ms FAIL
                                                                                                       
In Process.php line 270:                                                                               
                                                                                                                                                                                                              
  The command "mysql  --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARA   
  VEL_LOAD_PATH}"" failed.                                                                                                                                                                                    
                                                                                                                                                                                                              
  Exit Code: 1(General error)                                                                                                                                                                                 
                                                                                                                                                                                                              
  Working directory: /www/html                                                                                                                                                                                
                                                                                                                                                                                                              
  Output:                                                                                                                                                                                                     
  ================                                                                                                                                                                                            
                                                                                                                                                                                                             
                                                                                                                                                                                                             
  Error Output:                                                                                                                                                                                              
  ================                                                                                                                                                                                           
  mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead                                                                                                     
  ERROR 2026 (HY000): TLS/SSL error: SSL is required, but the server does not support it                                                                                                                     
                                                                                           

The best solution I've found so far is to add ssl=FALSE in /etc/my.cnf under the [client-server] section. We can probably just create a file like /etc/my.cnf.d/disable-ssl.cnf to fix this.

[client]
ssl=FALSE

Not sure the best way for you to implement that, also not sure what other defaults upstream has changed that could cause issues. I can bind mount a file there to fix things, but most people aren't going to realise there is an an issue as all the errors are hidden until you run commands manually.

@tiredofit
Copy link
Owner

OK. That's a great interim solution and also a great way to work these changes in the upstream image as opposed to try to catch every instance of using mysql or its associated tools!.

Give me a bit to think this through and I'll work something in. I see you are active in another issue and think its time I put a bit more look into the later releases of this image. I've pinned to a version way back and maybe this is an excellent winter break opportunity to upgrade my stack to something more modern.

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

2 participants