-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upload file using an s3 client (#24)
* feat: upload file using an s3 client * test: update integration tests to spin up s3 server * docs: add key values * chore: lock mc version to be downloaded * fix: copy directory contents instead of directory
- Loading branch information
Showing
7 changed files
with
48 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
FROM ubuntu:bionic | ||
|
||
ENV GCSFUSE_REPO gcsfuse-bionic | ||
ARG MC_VERSION=RELEASE.2023-08-08T17-23-59Z | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN useradd -u 1234 notroot && \ | ||
RUN useradd -u 1234 -m notroot && \ | ||
mkdir -p /backups/tmp && \ | ||
mkdir -p /backups/output && \ | ||
mkdir -p /mnt/backup-bucket && \ | ||
chown notroot /backups -R && \ | ||
chown notroot /mnt/backup-bucket && \ | ||
apt-get update && apt-get install --yes --no-install-recommends \ | ||
ca-certificates=20230311ubuntu0.18.04.1 \ | ||
curl=7.58.0-2ubuntu3.24 \ | ||
gnupg=2.2.4-1ubuntu1.6 \ | ||
mydumper=0.9.1-5 \ | ||
mariadb-client=1:10.1.48-0ubuntu0.18.04.1 \ | ||
&& echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" \ | ||
| tee /etc/apt/sources.list.d/gcsfuse.list \ | ||
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install --yes gcsfuse=0.40.0 --no-install-recommends \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
mariadb-client=1:10.1.48-0ubuntu0.18.04.1 && \ | ||
curl -sSL "https://dl.min.io/client/mc/release/$TARGETOS-$TARGETARCH$TARGETVARIANT/archive/mc.$MC_VERSION" \ | ||
--create-dirs \ | ||
-o "$HOME/minio-binaries/mc" && \ | ||
chmod +x "$HOME/minio-binaries/mc" && \ | ||
mv "$HOME/minio-binaries/mc" /usr/bin/mc && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
USER notroot | ||
WORKDIR /app | ||
COPY src/ /app | ||
|
||
ENV DB_PORT=3306 \ | ||
ENV DB_PORT="3306" \ | ||
DB_HOST="localhost" \ | ||
DB_PASSWORD="" \ | ||
DB_USER="" \ | ||
DO_UPLOAD="1" \ | ||
GCS_BUCKET_NAME="" \ | ||
BACKUP_KEY="" \ | ||
MYDUMPER_VERBOSE_LEVEL="1" \ | ||
EXPECTED_FILES="" \ | ||
REPLICATION_THRESHOLD=60 \ | ||
SECONDARY_HOST=sql-mariadb-secondary.default.svc.cluster.local \ | ||
STORAGE_ENDPOINT="storage.googleapis.com" \ | ||
STORAGE_SIGNATURE_VERSION="S3v2" \ | ||
REPLICATION_THRESHOLD="60" \ | ||
SECONDARY_HOST="sql-mariadb-secondary.default.svc.cluster.local" \ | ||
DO_CHECK_SECONDARY="1" | ||
|
||
ENTRYPOINT [ "/app/entrypoint.sh" ] |
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
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,5 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
mc alias set remote "$STORAGE_ENDPOINT" "$STORAGE_ACCESS_KEY" "$STORAGE_SECRET_KEY" --api "$STORAGE_SIGNATURE_VERSION" | ||
mc cp --recursive /backups/output/ remote/"$STORAGE_BUCKET_NAME" |