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

Can't connect to MySQL server on 'mysql' (111) #7

Open
mtnstar opened this issue Feb 9, 2022 · 0 comments
Open

Can't connect to MySQL server on 'mysql' (111) #7

mtnstar opened this issue Feb 9, 2022 · 0 comments

Comments

@mtnstar
Copy link

mtnstar commented Feb 9, 2022

when running bleib @ hitobito demo prod inside migration container init step 'wait-for-database' the following error occurs if the mysql db is not available yet:

Mysql2::Error::ConnectionError: Can't connect to MySQL server on 'mysql' (111)
/opt/app-root/src/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
/opt/app-root/src/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/mysql2_adapter.rb:40:in `new_client'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/mysql2_adapter.rb:23:in `mysql2_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:283:in `connection'
/opt/app-root/src/bundle/ruby/2.7.0/gems/bleib-0.0.10/lib/bleib/database.rb:38:in `database_down?'
/opt/app-root/src/bundle/ruby/2.7.0/gems/bleib-0.0.10/lib/bleib/database.rb:15:in `wait_for_connection'

so the init container is being restarted until the mysql service is available.

bleib should not raise an error in that case, is should just wait until service is available 🐕 bleib!

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

1 participant