Skip to content

Commit

Permalink
new xtrabackup
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer committed Aug 8, 2024
1 parent 9801e77 commit 6c88825
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 15 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release_manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
- 'logical-backup'
- 'ci-builder'
- 'elasticsearch-with-s3-plugin'
- 'mysql-operator-sidecar-80'
upstream-ref:
description: 'upstream ref'
required: false
Expand All @@ -42,6 +43,38 @@ env:
BUILD_PLATFORM: linux/amd64,linux/arm64

jobs:
mysql-operator-sidecar-80:
if : ${{ inputs.job == 'mysql-operator-sidecar-80' }}
runs-on: ubuntu-latest
steps:
- name: Git clone repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: ci-builder
uses: docker/[email protected]
with:
context: ./arm64/images/mysql-operator-sidecar-8.0
file: ./arm64/images/mysql-operator-sidecar-8.0/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
push: true
platforms: ${{ env.BUILD_PLATFORM }}
tags: |
${{ env.ONLINE_REGISTER }}/mysql-operator-sidecar-8.0:${{ inputs.tag }}
${{ env.ONLINE_REGISTER }}/mysql-operator-sidecar-8.0:latest
cache-from: type=gha
cache-to: type=gha,mode=max

ci-builder:
if : ${{ inputs.job == 'ci-builder' }}
runs-on: ubuntu-latest
Expand Down
38 changes: 23 additions & 15 deletions arm64/images/mysql-operator-sidecar-8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ENV GOPROXY=https://goproxy.cn
ENV GOPATH=/build

WORKDIR /build
RUN wget -O arm64.zip https://github.com/ksmartdata/mysql-operator/archive/refs/heads/arm64.zip
RUN unzip arm64.zip
WORKDIR /build/mysql-operator-arm64
RUN wget -O extra_image.zip https://github.com/ksmartdata/mysql-operator/archive/refs/heads/extra_image.zip
RUN unzip extra_image.zip
WORKDIR /build/mysql-operator-extra_image
RUN go mod tidy
RUN CGO_ENABLED=0 go build -o /mysql-operator-sidecar cmd/mysql-operator-sidecar/main.go

Expand All @@ -26,6 +26,7 @@ FROM --platform=$TARGETPLATFORM centos:8.3.2011 as all

USER root

ARG XTRABACKUP_VERSION=8.0.35-31

COPY rootfs/ /

Expand Down Expand Up @@ -57,17 +58,17 @@ RUN chmod +x /usr/local/bin/rclone

# percona-xtrabackup
WORKDIR /build
RUN wget -O percona-xtrabackup-8.0.29-22.zip https://github.com/percona/percona-xtrabackup/archive/refs/tags/percona-xtrabackup-8.0.29-22.zip
RUN unzip percona-xtrabackup-8.0.29-22
WORKDIR /build/percona-xtrabackup-percona-xtrabackup-8.0.29-22
RUN wget -O percona-xtrabackup-${XTRABACKUP_VERSION}.zip https://github.com/percona/percona-xtrabackup/archive/refs/tags/percona-xtrabackup-${XTRABACKUP_VERSION}.zip
RUN unzip percona-xtrabackup-${XTRABACKUP_VERSION}
WORKDIR /build/percona-xtrabackup-percona-xtrabackup-${XTRABACKUP_VERSION}

RUN yum -y install cmake openssl-devel libaio libaio-devel automake autoconf \
bison libtool ncurses-devel libgcrypt-devel libev-devel libcurl-devel zlib-devel \
vim-common


WORKDIR /build/percona-xtrabackup-percona-xtrabackup-8.0.29-22/build
WORKDIR /build/percona-xtrabackup-percona-xtrabackup-8.0.29-22
WORKDIR /build/percona-xtrabackup-percona-xtrabackup-${XTRABACKUP_VERSION}/build
WORKDIR /build/percona-xtrabackup-percona-xtrabackup-${XTRABACKUP_VERSION}

RUN yum install -y gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-binutils

Expand All @@ -80,12 +81,12 @@ RUN wget -O libkmip.zip https://github.com/Percona-Lab/libkmip/archive/0ecda3359
RUN unzip libkmip.zip
RUN cp -r libkmip-0ecda33598838b67bb4bb7a0005c92eea8b7405a/. extra/libkmip/

RUN cmake -DWITH_BOOST=PATH-TO-BOOST-LIBRARY -DDOWNLOAD_BOOST=ON \
-DBUILD_CONFIG=xtrabackup_release -DWITH_MAN_PAGES=OFF -B ..

WORKDIR /build
RUN make -j4
RUN make install
#RUN cmake -DWITH_BOOST=PATH-TO-BOOST-LIBRARY -DDOWNLOAD_BOOST=ON \
#-DBUILD_CONFIG=xtrabackup_release -DWITH_MAN_PAGES=OFF -B ..
#
#WORKDIR /build
#RUN make -j4
#RUN make install

COPY --from=builder /mysql-operator-sidecar /usr/local/bin/

Expand All @@ -96,7 +97,7 @@ WORKDIR /build
RUN wget -O percona-toolkit.zip https://github.com/percona/percona-toolkit/archive/refs/heads/3.x.zip
RUN unzip percona-toolkit.zip
WORKDIR /build/percona-toolkit-3.x
RUN yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y
RUN yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker golang -y
RUN perl Makefile.PL
RUN make
RUN make test
Expand Down Expand Up @@ -139,6 +140,13 @@ RUN cd /etc/yum.repos.d/ && sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d
&& yum makecache
RUN yum install -y perl perl-DBI perl-DBD-MySQL

# 换成直接用 yum 安装
# date: 2024年 08月 08日 星期四 17:37:18 CST, 最新版本是 8.0.35-31
# https://docs.percona.com/percona-xtrabackup/8.0/release-notes/8.0/8.0.35-31.0.html
RUN yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
RUN percona-release enable-only tools
RUN yum install percona-xtrabackup-80 -y

COPY rootfs/ /

COPY --from=all /usr/local/ /usr/local/
Expand Down

0 comments on commit 6c88825

Please sign in to comment.