File tree Expand file tree Collapse file tree 3 files changed +19
-32
lines changed Expand file tree Collapse file tree 3 files changed +19
-32
lines changed Original file line number Diff line number Diff line change 1- # With Python 3.12.4 on Alpine 3.20, s3cmd 2.4.0 fails with an AttributeError.
2- # See ITSE-1440 for details.
31FROM python:3.12.4-alpine
42
5- # Current version of s3cmd is in edge/testing repo
6- RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
3+ RUN <<EOF
4+ apk update
5+ apk add --no-cache \
6+ bash \
7+ curl \
8+ postgresql14-client \
9+ py3-pip
710
8- # Install everything via repo because repo & pip installs can break things
9- RUN apk update \
10- && apk add --no-cache \
11- bash \
12- postgresql14-client \
13- py3-magic \
14- py3-dateutil \
15- curl \
16- jq
17-
18- RUN wget https://github.com/s3tools/s3cmd/archive/refs/tags/v2.4.0.tar.gz \
19- && tar xzf v2.4.0.tar.gz \
20- && cd s3cmd-2.4.0 \
21- && python setup.py install \
22- && cd .. \
23- && rm -rf s3cmd-2.4.0 v2.4.0.tar.gz
24- # Install sentry-cli
25- RUN curl -sL https://sentry.io/get-cli/ | bash
11+ curl -sL https://sentry.io/get-cli/ | bash
12+
13+ pip3 install awscli
14+ EOF
2615
2716COPY application/ /data/
2817WORKDIR /data
Original file line number Diff line number Diff line change 121121
122122# Upload compressed backup file to S3
123123start=$( date +%s) ;
124- s3cmd put /tmp/${DB_NAME} .sql.gz ${S3_BUCKET} || STATUS=$? ;
124+ aws s3 cp " /tmp/${DB_NAME} .sql.gz" " s3:// ${S3_BUCKET} / ${DB_NAME} .sql.gz " || STATUS=$?
125125if [ $STATUS -ne 0 ]; then
126126 error_message=" ${MYNAME} : FATAL: Copy backup to ${S3_BUCKET} of ${DB_NAME} returned non-zero status ($STATUS ) in $( expr ${end} - ${start} ) seconds." ;
127127 log " ERROR" " ${error_message} " ;
@@ -130,7 +130,7 @@ if [ $STATUS -ne 0 ]; then
130130fi
131131
132132# Upload checksum file
133- s3cmd put /tmp/${DB_NAME} .sql.sha256.gz ${S3_BUCKET} || STATUS=$? ;
133+ aws s3 cp " /tmp/${DB_NAME} .sql.sha256.gz" " s3:// ${S3_BUCKET} / ${DB_NAME} .sql.sha256.gz " || STATUS=$? ;
134134end=$( date +%s) ;
135135if [ $STATUS -ne 0 ]; then
136136 error_message=" ${MYNAME} : FATAL: Copy checksum to ${S3_BUCKET} of ${DB_NAME} returned non-zero status ($STATUS )." ;
144144# Backblaze B2 Upload
145145if [ " ${B2_BUCKET} " != " " ]; then
146146 start=$( date +%s) ;
147- s3cmd \
148- --access_key=${B2_APPLICATION_KEY_ID} \
149- --secret_key=${B2_APPLICATION_KEY} \
150- --host=${B2_HOST} \
151- --host-bucket=' %(bucket)s.' " ${B2_HOST} " \
152- put /tmp/${DB_NAME} .sql.gz s3://${B2_BUCKET} /${DB_NAME} .sql.gz;
147+ AWS_ACCESS_KEY_ID=" ${B2_APPLICATION_KEY_ID} " \
148+ AWS_SECRET_ACCESS_KEY=" ${B2_APPLICATION_KEY} " \
149+ aws s3 cp " /tmp/${DB_NAME} .sql.gz" " s3://${B2_BUCKET} /${DB_NAME} .sql.gz" \
150+ --endpoint-url " https://${B2_HOST} "
153151 STATUS=$? ;
154152 end=$( date +%s) ;
155153 if [ $STATUS -ne 0 ]; then
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ log "INFO" "${MYNAME}: copying database ${DB_NAME} backup and checksum from ${S3
9595start=$( date +%s)
9696
9797# Download database backup
98- s3cmd get -f ${S3_BUCKET} /${DB_NAME} .sql.gz /tmp/${DB_NAME} .sql.gz || STATUS=$?
98+ aws s3 cp s3:// ${S3_BUCKET} /${DB_NAME} .sql.gz /tmp/${DB_NAME} .sql.gz || STATUS=$?
9999if [ $STATUS -ne 0 ]; then
100100 error_message=" ${MYNAME} : FATAL: Copy backup of ${DB_NAME} from ${S3_BUCKET} returned non-zero status ($STATUS ) in $( expr $( date +%s) - ${start} ) seconds."
101101 log " ERROR" " ${error_message} "
@@ -104,7 +104,7 @@ if [ $STATUS -ne 0 ]; then
104104fi
105105
106106# Download checksum file
107- s3cmd get -f ${S3_BUCKET} /${DB_NAME} .sql.sha256.gz /tmp/${DB_NAME} .sql.sha256.gz || STATUS=$?
107+ aws s3 cp s3:// ${S3_BUCKET} /${DB_NAME} .sql.sha256.gz /tmp/${DB_NAME} .sql.sha256.gz || STATUS=$?
108108end=$( date +%s)
109109if [ $STATUS -ne 0 ]; then
110110 error_message=" ${MYNAME} : FATAL: Copy checksum of ${DB_NAME} from ${S3_BUCKET} returned non-zero status ($STATUS ) in $( expr ${end} - ${start} ) seconds."
You can’t perform that action at this time.
0 commit comments