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

fix: run MySQL 8.1 as a separate container during upgrade from Olive to Redwood #1140

Conversation

Danyal-Faheem
Copy link
Contributor

This PR is a fix for the issues brought forward in #1102.

We do this because MySQL 8.1 does not have the --mysql-native-password option and when upgrading from tutor v15 -> v18, this container would crash as the option does not exist.

We have this option turned on for backwards compatibility from tutor v18.1.1 onwards as users who have upgraded all the way from MySQL v5.7 -> v8.4 have their original users created using the mysql_native_password authentication plugin. See #1090 for more details.

After this PR is merged in nightly, we should make a backport to master as well coupled with the changes already made in #1102.

We do this because MySQL 8.1 does not have the --mysql-native-password option
We have this option turned on for backwards compatibility
@Danyal-Faheem Danyal-Faheem requested a review from regisb October 17, 2024 17:20
@Danyal-Faheem Danyal-Faheem changed the title fix: run MySQL 8.1 as a separate container fix: run MySQL 8.1 as a separate container when upgrading from Olive to Redwood Oct 17, 2024
@Danyal-Faheem Danyal-Faheem changed the title fix: run MySQL 8.1 as a separate container when upgrading from Olive to Redwood fix: run MySQL 8.1 as a separate container during upgrade from Olive to Redwood Oct 17, 2024
Comment on lines +183 to +184
--character-set-server=utf8mb3
--collation-server=utf8mb3_general_ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious: What happens here if someone has already changed the connection strings on their Mysql57?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure as I have not tested this out, however, we would want this container to be as similar to the one already being launched in tutor v17. I'm not sure we want to cater to every modification a user might have made.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

Comment on lines 174 to 199
hooks.Filters.ENV_PATCHES.add_item(
(
"local-docker-compose-services",
"""
mysql-8.1:
extends: mysql
image: docker.io/mysql:8.1.0
command: >
mysqld
--character-set-server=utf8mb3
--collation-server=utf8mb3_general_ci
--binlog-expire-logs-seconds=259200
""",
)
)
hooks.Filters.ENV_PATCHES.add_item(
(
"local-docker-compose-jobs-services",
"""
mysql-8.1-job:
image: docker.io/mysql:8.1.0
depends_on: {{ [("mysql-8.1", RUN_MYSQL)]|list_if }}
""",
)
)
hooks.Filters.CONFIG_DEFAULTS.add_item(("MYSQL_HOST", "mysql-8.1"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can't add_items be used for hooks.Filters.ENV_PATCHES here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! Thank you for reminding me.

tutor_env.save(context.obj.root, config)
context.invoke(jobs.initialise, limit="mysql")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is mysql version set to 8.4? Or is it 8.4 already before the code enters MySQL 8.1 context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already set prior to the context when the user installs tutor v18 onwards.

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Can you add a changelog entry?

@Danyal-Faheem
Copy link
Contributor Author

Updated with the changelog entry as well.

@DawoudSheraz DawoudSheraz merged commit 75aab6e into overhangio:nightly Oct 28, 2024
2 checks passed
@DawoudSheraz DawoudSheraz deleted the danyalfaheem/run-mysql-8.1-as-separate-container branch October 28, 2024 13:09
Danyal-Faheem added a commit to edly-io/tutor that referenced this pull request Oct 28, 2024
…to Redwood (overhangio#1140)

* ix: run MySQL 8.1 as a separate container during upgrade from Olive to Redwood
We do this because MySQL 8.1 does not have the --mysql-native-password option
We have this option turned on for backward compatibility
DawoudSheraz pushed a commit that referenced this pull request Oct 30, 2024
* fix: upgrade MySQL from 5.7 to 8.1 first and then to 8.4
This is required when upgrading from Tutor v15 to v18 directly
MySQL does not allow direct upgrades from v5.7 to v8.4

* fix: run MySQL 8.1 as a separate container during upgrade from Olive to Redwood (#1140)
We do this because MySQL 8.1 does not have the --mysql-native-password option
We have this option turned on for backward compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants