Skip to content

Commit

Permalink
Merge pull request #1 from planetscale/enisoc-vtbackup
Browse files Browse the repository at this point in the history
vtbackup: Clean up and add policy enforcement
  • Loading branch information
Daniel Kozlowski authored Jun 10, 2019
2 parents 70a2509 + 62fd75c commit 3151386
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 67 deletions.
4 changes: 4 additions & 0 deletions docker/k8s/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ COPY --from=base /vt/bin/vtctlclient /vt/bin/
COPY --from=base /vt/bin/vtgate /vt/bin/
COPY --from=base /vt/bin/vttablet /vt/bin/
COPY --from=base /vt/bin/vtworker /vt/bin/
COPY --from=base /vt/bin/vtbackup /vt/bin/

# copy web admin files
COPY --from=base $VTTOP/web /vt/web/
Expand All @@ -57,6 +58,9 @@ COPY --from=base $VTTOP/config/mycnf/backup.cnf /vt/config/mycnf/
# settings to support rbr
COPY --from=base $VTTOP/config/mycnf/rbr.cnf /vt/config/mycnf/

# recommended production settings
COPY --from=base $VTTOP/config/mycnf/production.cnf /vt/config/mycnf/

# add vitess user and add permissions
RUN groupadd -r --gid 2000 vitess && useradd -r -g vitess --uid 1000 vitess && \
chown -R vitess:vitess /vt;
25 changes: 25 additions & 0 deletions docker/k8s/vtbackup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM vitess/k8s AS k8s

FROM debian:stretch-slim

# Set up Vitess environment (just enough to run pre-built Go binaries)
ENV VTROOT /vt
ENV VTDATAROOT /vtdataroot

# Prepare directory structure.
RUN mkdir -p /vt/bin && mkdir -p /vtdataroot

# Copy binaries
COPY --from=k8s /vt/bin/vtbackup /vt/bin/

# Copy certs to allow https calls
COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# Copy vitess config
COPY --from=k8s /vt/config /vt/config

# add vitess user/group and add permissions
RUN groupadd -r --gid 2000 vitess && \
useradd -r -g vitess --uid 1000 vitess && \
chown -R vitess:vitess /vt && \
chown -R vitess:vitess /vtdataroot
3 changes: 2 additions & 1 deletion docker/lite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down Expand Up @@ -51,4 +52,4 @@ COPY --from=staging /vt/ /vt/

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
USER vitess
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

FROM alpine:3.8

Expand Down
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.mariadb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/
RUN chown -R vitess:vitess /vt

FROM debian:stretch-slim
Expand Down
3 changes: 2 additions & 1 deletion docker/lite/Dockerfile.mysql56
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down Expand Up @@ -51,4 +52,4 @@ COPY --from=staging /vt/ /vt/

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
USER vitess
3 changes: 2 additions & 1 deletion docker/lite/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down Expand Up @@ -51,4 +52,4 @@ COPY --from=staging /vt/ /vt/

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
USER vitess
3 changes: 2 additions & 1 deletion docker/lite/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down Expand Up @@ -51,4 +52,4 @@ COPY --from=staging /vt/ /vt/

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
USER vitess
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.percona
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down
1 change: 1 addition & 0 deletions docker/lite/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY --from=builder /vt/bin/vtctlclient /vt/bin/
COPY --from=builder /vt/bin/vtgate /vt/bin/
COPY --from=builder /vt/bin/vttablet /vt/bin/
COPY --from=builder /vt/bin/vtworker /vt/bin/
COPY --from=builder /vt/bin/vtbackup /vt/bin/

RUN chown -R vitess:vitess /vt

Expand Down
Loading

0 comments on commit 3151386

Please sign in to comment.