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

Install linux generic libc2.12 mysqlbinlog binary and libraries #15854

Closed
wants to merge 3 commits into from

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented May 7, 2024

Description

After merging #15620 we realized that mysqlbinlog was missing from the vitess/lite image, we decided to add it back to the image with #15775. However, we realized that mysqlbinlog is used by the mysqld container in K8S, and the image of this container is defined by the user (official MySQL image, Percona image, custom build, etc...), meaning that the when executing mysqlbinlog in the mysqld container we had 0 guarantee that all the required libraries were installed. For this reason, we are now installing a generic linux version of mysql based on libc2.12 (from 2010) in the base image of vitess/lite, this binary and libraries are going to be compatible with most x86_64 environments where Vitess will run.

The mysqlbinlog binary has two libraries that we need to copy from the downloaded tarball to the final Docker image: libcrypto.so.3 and libssl.so.3. The binary expect to find both libraries in the ../lib/private/ folder from where the binary is found. For this reason, in the final image, the libraries are copied into /vt/lib/private and mysqlbinlog to /vt/bin. The goal here, is for the vitess-operator to modify the vtRootInitScript to copy mysqlbinlog and the libraries. @mattlord is already working on this in planetscale/vitess-operator#541.

Docker Image tests

~/vitess# docker build -f docker/lite/Dockerfile -t frouioui/lite:test . 
[+] Building 85.9s (31/31) FINISHED                                                                                                             

~/vitess# docker run -it frouioui/lite:test bash 
vitess@4f6240a178e1:/$ mysqlbinlog -V
mysqlbinlog  Ver 8.0.37 for Linux on x86_64 (MySQL Community Server - GPL)
vitess@4f6240a178e1:/$ ldd /vt/bin/mysqlbinlog 
        linux-vdso.so.1 (0x00007fff6f5fa000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2210cd5000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2210ccf000)
        libcrypto.so.3 => /vt/bin/../lib/private/libcrypto.so.3 (0x00007f22106b7000)
        libssl.so.3 => /vt/bin/../lib/private/libssl.so.3 (0x00007f2210413000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f22103f9000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f22103ef000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2210220000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f22100dc000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f22100c2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f220feee000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2210cfc000)

Vitess-operator deployment tests

$> minikube start --kubernetes-version=v1.28.5 --cpus=4 --memory=11000 --disk-size=32g
$> cd examples/operator
$> kubectl apply -f operator.yaml
$> kubectl apply -f 101_initial_cluster.yaml
$> kubectl get pods
NAME                                                         READY   STATUS    RESTARTS        AGE
example-commerce-x-x-zone1-vtorc-c13ef6ff-5fd499c7db-2dp9n   1/1     Running   0               4m39s
example-etcd-faf13de3-1                                      1/1     Running   0               4m40s
example-etcd-faf13de3-2                                      1/1     Running   0               4m40s
example-etcd-faf13de3-3                                      1/1     Running   0               4m40s
example-vttablet-zone1-2469782763-bfadd780                   3/3     Running   1 (2m29s ago)   4m39s
example-vttablet-zone1-2548885007-46a852d0                   3/3     Running   1 (2m29s ago)   4m39s
example-zone1-vtadmin-c03d7eae-5dfd76fb6-5x2vx               2/2     Running   0               4m40s
example-zone1-vtctld-1d4dcad0-7744455bd6-dn8gd               1/1     Running   0               4m40s
example-zone1-vtgate-bc6cde92-7974f87944-szqf5               1/1     Running   0               4m39s
vitess-operator-6fcb7977c-mjr77                              1/1     Running   0               5m20s


Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Copy link
Contributor

vitess-bot bot commented May 7, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels May 7, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone May 7, 2024
@frouioui frouioui changed the title Install generic mysqlbinlog package and libraries Install linux generic libc2.12 mysqlbinlog binary and libraries May 7, 2024
@frouioui frouioui added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Build/CI Type: Internal Cleanup and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required Type: Enhancement Logical improvement (somewhere between a bug and feature) labels May 7, 2024
@@ -18,13 +18,20 @@

# Use a temporary layer for the build stage.
ARG bootstrap_version=31
ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"
ARG image="vitess/bootstrap:${bootstrap_version}-common"
Copy link
Member Author

Choose a reason for hiding this comment

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

This was reverted back to common as we no longer need to copy mysqlbinlog from the bootstrap image.

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@@ -51,16 +55,19 @@ RUN groupadd -r vitess && useradd -r -g vitess vitess
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt

# Set up Vitess environment (just enough to run pre-built Go binaries)
ENV VTROOT /vt/src/vitess.io/vitess
Copy link
Member Author

Choose a reason for hiding this comment

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

The only use was for the vtdataroot directory, but we might as well put everything under /vt instead of having two different directories.

Comment on lines +69 to +70
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libcrypto.so.3 $VTROOT/lib/private/libcrypto.so.3
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libssl.so.3 $VTROOT/lib/private/libssl.so.3
Copy link
Member Author

Choose a reason for hiding this comment

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

Copying the two libraries needed by mysqlbinlog into /vt/lib/private, the mysqlbinlog expects the libraires to be found there.

Copy link
Contributor

Choose a reason for hiding this comment

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

@frouioui This assumes we use always OpenSSL 3, which is not something we could assume yet I think? I don't think we can copy it like this tbh, those libraries themselves also then have dependencies and we suddenly would be responsible here for security issues in those versions and have to manage that? Which is a big pain since they are not versioned with apt-get at all.

@frouioui
Copy link
Member Author

frouioui commented May 9, 2024

Closing this as we are going to do another PR for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants