-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from zhl003/graceful_failover
*: Prevent Leader from accidentally hanging up data inconsistency
- Loading branch information
Showing
14 changed files
with
705 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM golang:1.16 as builder | ||
|
||
WORKDIR / | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go env -w GOPROXY=https://goproxy.cn,direct; | ||
# go mod download | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY cmd/healthcheck/main.go cmd/healthcheck/main.go | ||
COPY utils/ utils/ | ||
COPY internal/ internal/ | ||
# COPY api/ api/ | ||
# COPY mysqlcluster/ mysqlcluster/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o bin/healthcheck cmd/healthcheck/main.go | ||
|
||
FROM percona/percona-server:5.7.34 | ||
|
||
COPY --from=builder /bin/healthcheck /healthcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,48 @@ | ||
FROM golang:1.16 as builder | ||
############################################################################## | ||
# Build Xenon | ||
############################################################################### | ||
|
||
WORKDIR / | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go env -w GOPROXY=https://goproxy.cn,direct; | ||
# go mod download | ||
RUN go mod download | ||
FROM golang:1.16 as builder | ||
|
||
ARG XENON_BRANCH=origin_test | ||
RUN go env -w GOPROXY=https://goproxy.cn,direct && go env -w GO111MODULE=off; | ||
RUN set -ex; \ | ||
mkdir -p /go/src/github.com/radondb; \ | ||
cd /go/src/github.com/radondb; \ | ||
git clone --branch $XENON_BRANCH https://github.com/zhl003/xenon.git; \ | ||
cd xenon; \ | ||
make build | ||
WORKDIR /workspace | ||
# Copy the go source | ||
COPY cmd/xenon/main.go cmd/xenon/main.go | ||
COPY utils/ utils/ | ||
|
||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
RUN go env -w GO111MODULE=on && go mod download | ||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o bin/xenonchecker cmd/xenon/main.go | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o xenonchecker cmd/xenon/main.go | ||
############################################################################### | ||
# Docker image for Xenon | ||
############################################################################### | ||
|
||
FROM alpine:3.13 | ||
|
||
FROM radondb/xenon:1.1.5-alpha | ||
RUN set -ex \ | ||
&& addgroup -g 1001 mysql && adduser -u 1001 -g 1001 -S mysql \ | ||
&& apk add --no-cache curl bash jq \ | ||
&& mkdir -p /etc/xenon /var/lib/xenon /lib64 \ | ||
&& ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 \ | ||
&& echo "/etc/xenon/xenon.json" > /config.path \ | ||
# allow to change config files | ||
&& chown -R 1001:1001 /etc/xenon /var/lib/xenon | ||
|
||
COPY --from=builder /go/src/github.com/radondb/xenon/bin/xenon /usr/local/bin/xenon | ||
COPY --from=builder /go/src/github.com/radondb/xenon/bin/xenoncli /usr/local/bin/xenoncli | ||
COPY --from=builder /workspace/xenonchecker /xenonchecker | ||
USER 1001 | ||
WORKDIR / | ||
EXPOSE 8801 | ||
VOLUME ["/var/lib/xenon", "/etc/xenon"] | ||
|
||
COPY --from=builder /bin/xenonchecker /xenonchecker | ||
ENTRYPOINT ["xenon"] | ||
CMD ["-c", "/etc/xenon/xenon.json"] |
Oops, something went wrong.