Skip to content

Commit

Permalink
Remove MySQL/Percona from the vitess/lite Docker image (#15605)
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed Apr 2, 2024
1 parent cef95ab commit 002ac54
Show file tree
Hide file tree
Showing 32 changed files with 174 additions and 754 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker_build_lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: true
matrix:
branch: [ latest, mysql57, mysql80, percona57, percona80 ]
branch: [ latest ]

steps:
- name: Check out code
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ $(PROTO_GO_OUTS): minimaltools install_protoc-gen-go proto/*.proto
# This rule builds the bootstrap images for all flavors.
DOCKER_IMAGES_FOR_TEST = mysql57 mysql80 percona57 percona80
DOCKER_IMAGES = common $(DOCKER_IMAGES_FOR_TEST)
BOOTSTRAP_VERSION=29
BOOTSTRAP_VERSION=30
ensure_bootstrap_version:
find docker/ -type f -exec sed -i "s/^\(ARG bootstrap_version\)=.*/\1=${BOOTSTRAP_VERSION}/" {} \;
sed -i 's/\(^.*flag.String(\"bootstrap-version\",\) *\"[^\"]\+\"/\1 \"${BOOTSTRAP_VERSION}\"/' test.go
Expand Down Expand Up @@ -331,7 +331,7 @@ docker_base_all: docker_base $(DOCKER_BASE_TARGETS)
docker_lite:
${call build_docker_image,docker/lite/Dockerfile,vitess/lite}

DOCKER_LITE_SUFFIX = mysql57 ubi7.mysql57 mysql80 ubi7.mysql80 percona57 ubi7.percona57 percona80 ubi7.percona80 testing ubi8.mysql80 ubi8.arm64.mysql80
DOCKER_LITE_SUFFIX = testing ubi7 ubi8 ubi8.arm64
DOCKER_LITE_TARGETS = $(addprefix docker_lite_,$(DOCKER_LITE_SUFFIX))
$(DOCKER_LITE_TARGETS): docker_lite_%:
${call build_docker_image,docker/lite/Dockerfile.$*,vitess/lite:$*}
Expand Down
45 changes: 45 additions & 0 deletions changelog/20.0/20.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Table of Contents

- **[Major Changes](#major-changes)**
- **[Deletions](#deletions)**
- [MySQL binaries in the vitess/lite Docker images](#vitess-lite)
- **[Breaking changes](#breaking-changes)**
- [`shutdown_grace_period` Default Change](#shutdown-grace-period-default)
- [New `unmanaged` Flag and `disable_active_reparents` deprecation](#unmanaged-flag)
Expand All @@ -26,6 +28,49 @@

## <a id="major-changes"/>Major Changes

### <a id="deletions"/>Deletion

#### <a id="vitess-lite"/>MySQL binaries in the `vitess/lite` Docker images

In `v19.0.0` we had deprecated the `mysqld` binary in the `vitess/lite` Docker image.
Making MySQL/Percona version specific image tags also deprecated.

Starting in `v20.0.0` we no longer build the MySQL/Percona version specific image tags.
Moreover, the `mysqld` binary is no longer present on the `vitess/lite` image.

Here are the images we will no longer build and push:

| Image | Available |
|---------------------------------|-----------|
| `vitess/lite:v20.0.0` | YES |
| `vitess/lite:v20.0.0-mysql57` | NO |
| `vitess/lite:v20.0.0-mysql80` | NO |
| `vitess/lite:v20.0.0-percona57` | NO |
| `vitess/lite:v20.0.0-percona80` | NO |


If you have not done it yet, you can use an official MySQL Docker image for your `mysqld` container now such as: `mysql:8.0.30`.
Below is an example of a kubernetes yaml file before and after upgrading to an official MySQL image:

```yaml
# before:

# you are still on v19 and are looking to upgrade to v20
# the image used here includes MySQL 8.0.30 and its binaries

mysqld:
mysql80Compatible: vitess/lite:v19.0.0-mysql80
```
```yaml
# after:

# if we still want to use MySQL 8.0.30, we now have to use the
# official MySQL image with the 8.0.30 tag as shown below

mysqld:
mysql80Compatible: mysql:8.0.30 # or even mysql:8.0.34 for instance
```
### <a id="breaking-changes"/>Breaking Changes
#### <a id="shutdown-grace-period-default"/>`shutdown_grace_period` Default Change
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-mysql57"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-percona57"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-percona80"

FROM "${image}"
Expand Down
6 changes: 5 additions & 1 deletion docker/bootstrap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@ List of changes between bootstrap image versions.

## [29] - 2024-03-05
### Changes
- Update build to golang 1.22.1
- Update build to golang 1.22.1

## [30] - 2024-04-01
### Changes
- Move the bootstrap phase to the common image so other Dockerfiles don't have to rely on the version based tags.
6 changes: 6 additions & 0 deletions docker/bootstrap/Dockerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ VOLUME /vt/vtdataroot
# Add compatibility to the previous layout for now
RUN su vitess -c "mkdir -p /vt/src/vitess.io/vitess/bin && rm -rf /vt/bin && ln -s /vt/src/vitess.io/vitess/bin /vt/bin"

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh

# If the user doesn't specify a command, load a shell.
CMD ["/bin/bash"]
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install MySQL 5.7
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gnupg dirmngr ca-certificates && \
for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com A8D3785C && break; done && \
Expand All @@ -18,8 +20,4 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev libdbd-mysql-perl rsync libev4 percona-xtrabackup-24 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install MySQL 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com 8C718D3B5072E1F5 && break; done && \
for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com A8D3785C && break; done && \
Expand All @@ -18,8 +20,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyser
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev libdbd-mysql-perl rsync libev4 libcurl4-openssl-dev percona-xtrabackup-80 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install Percona 5.7
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 9334A25F8507EFA5 && break; done && \
add-apt-repository 'deb http://repo.percona.com/apt bullseye main' && \
Expand All @@ -16,8 +18,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.c
apt-get install -y --no-install-recommends libperconaserverclient20-dev percona-xtrabackup-24 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install Percona 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 9334A25F8507EFA5 && break; done \
&& echo 'deb http://repo.percona.com/ps-80/apt bullseye main' > /etc/apt/sources.list.d/percona.list && \
Expand Down Expand Up @@ -31,8 +33,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.c
&& apt-get install -y --no-install-recommends percona-xtrabackup-80 \
&& rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
1 change: 0 additions & 1 deletion docker/lite/Dockerfile

This file was deleted.

54 changes: 54 additions & 0 deletions docker/lite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2019 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: We have to build the Vitess binaries from scratch instead of sharing
# a base image because Docker Hub dropped the feature we relied upon to
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}" AS builder

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

# Build and install Vitess in a temporary output directory.
USER vitess

RUN make install PREFIX=/vt/install

# Start over and build the final image.
FROM debian:bullseye-slim

# Set up Vitess user and directory tree.
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
ENV VTDATAROOT /vt/vtdataroot
ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
57 changes: 0 additions & 57 deletions docker/lite/Dockerfile.percona80

This file was deleted.

9 changes: 3 additions & 6 deletions docker/lite/Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
ARG bootstrap_version=29
ARG image="vitess/bootstrap:${bootstrap_version}-mysql57"
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}" AS builder

Expand All @@ -30,15 +30,12 @@ COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

# Build and install Vitess in a temporary output directory.
USER vitess

RUN make install-testing PREFIX=/vt/install

# Start over and build the final image.
FROM debian:bullseye-slim

# Install dependencies
COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh
RUN /vt/dist/install_dependencies.sh mysql57

# Set up Vitess user and directory tree.
RUN groupadd -r vitess && useradd -r -g vitess vitess
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
Expand Down
Loading

0 comments on commit 002ac54

Please sign in to comment.