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

Add MySQL into the build system #3736

Merged
merged 5 commits into from
Nov 23, 2023

Conversation

adetunjii
Copy link
Contributor

@adetunjii adetunjii commented Nov 22, 2023

Setup MySQL build tooling

Readiness checklist

  • I added/updated unit tests (and they pass).
  • I added/updated integration/compatibility tests (and they pass).
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Milestone (Next), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@adetunjii adetunjii requested review from AlekSi and a team as code owners November 22, 2023 11:24
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #3736 (63de70a) into main (7948d19) will decrease coverage by 0.18%.
The diff coverage is 4.54%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3736      +/-   ##
==========================================
- Coverage   76.43%   76.25%   -0.18%     
==========================================
  Files         323      325       +2     
  Lines       23069    23112      +43     
==========================================
- Hits        17632    17624       -8     
- Misses       4396     4447      +51     
  Partials     1041     1041              
Files Coverage Δ
internal/handlers/registry/registry.go 43.47% <100.00%> (ø)
internal/backends/mysql/backend.go 0.00% <0.00%> (ø)
internal/handlers/registry/mysql.go 3.70% <3.70%> (ø)

... and 7 files with indirect coverage changes

Flag Coverage Δ
filter-true 72.41% <2.27%> (-0.18%) ⬇️
hana-1 ?
integration 72.41% <2.27%> (-0.18%) ⬇️
mongodb-1 5.45% <2.27%> (-0.01%) ⬇️
postgresql-1 51.77% <2.27%> (-0.09%) ⬇️
postgresql-2 51.39% <2.27%> (-0.10%) ⬇️
postgresql-3 52.59% <2.27%> (+0.07%) ⬆️
sort-false 72.41% <2.27%> (-0.18%) ⬇️
sqlite-1 50.87% <2.27%> (-0.10%) ⬇️
sqlite-2 50.55% <2.27%> (-0.09%) ⬇️
sqlite-3 51.67% <2.27%> (-0.09%) ⬇️
unit 30.11% <4.54%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@AlekSi AlekSi changed the title Hook mysql into build system Add MySQL into the build system Nov 22, 2023
Taskfile.yml Outdated
@@ -18,7 +18,7 @@ vars:
TESTJS_PORT: 27017
RACE_FLAG: -race={{and (ne OS "windows") (ne ARCH "arm") (ne ARCH "riscv64")}}
BUILD_TAGS: ferretdb_debug,ferretdb_hana
SERVICES: postgres postgres_secured mongodb mongodb_secured jaeger
SERVICES: postgres postgres_secured mongodb mongodb_secured jaeger mysql
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
SERVICES: postgres postgres_secured mongodb mongodb_secured jaeger mysql
SERVICES: postgres postgres_secured mysql mongodb mongodb_secured jaeger

@@ -0,0 +1 @@
FROM mysql:8.2.0
Copy link
Member

Choose a reason for hiding this comment

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

Please add a line break there

@@ -0,0 +1,2 @@
-- grant super user privileges
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'
Copy link
Member

Choose a reason for hiding this comment

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

Let's do that in the envtool's setup

//
// See main_mysql.go.
var mySQLFlags struct {
MySQLURL string `name:"mysql-url" default:"127.0.0.1:3306/ferretdb" help:"MySQL URL for 'mysql' handler"`
Copy link
Member

Choose a reason for hiding this comment

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

Let's add hidden:"" for now.

Also, let's use mysql:// scheme for consistency with other backends

@adetunjii adetunjii force-pushed the feat/mysql-build-system branch from acad6b3 to 9e54f88 Compare November 22, 2023 17:12
@adetunjii adetunjii requested a review from AlekSi November 22, 2023 18:20
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

Almost there!

Comment on lines 218 to 220
setupMongodb,
setupMongodbSecured,
setupMySQL,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
setupMongodb,
setupMongodbSecured,
setupMySQL,
setupMySQL,
setupMongodb,
setupMongodbSecured,

To keep the same general order

return err
}

eval := "mysql -u root -ppassword -e \"GRANT ALL PRIVILEGES ON *.* TO 'username'@'%';\""
Copy link
Member

Choose a reason for hiding this comment

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

That's okay for now, but we should use the backend code once we have it.

Let's add a comment for that.

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'm not sure what you mean that we should use the backend code for this.

Copy link
Member

Choose a reason for hiding this comment

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

We should do a thing similar to setupAnyPostgres by using internal/backends/mysql/... package there instead of docker compose exec. But that's not possible now. So I think we should add a comment about that future change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh okay. Got it

@adetunjii adetunjii requested a review from AlekSi November 23, 2023 09:23
@AlekSi AlekSi merged commit c119f9e into FerretDB:main Nov 23, 2023
25 of 29 checks passed
@AlekSi AlekSi added the code/chore Code maintenance improvements label Nov 23, 2023
@AlekSi AlekSi added this to the Next milestone Nov 23, 2023
@adetunjii adetunjii deleted the feat/mysql-build-system branch November 23, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants