File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ RUN apt-get update \
19
19
&& curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
20
20
&& apt-get update \
21
21
&& apt-get install --no-install-recommends -y \
22
+ postgresql-client-12 \
22
23
postgresql-client-11 \
23
24
postgresql-client-10 \
24
25
postgresql-client-9.6 \
@@ -28,6 +29,6 @@ RUN apt-get update \
28
29
29
30
COPY dump.sh ./
30
31
31
- ENV PG_DIR=/usr/lib/postgresql/
32
+ ENV PG_DIR=/usr/lib/postgresql
32
33
33
34
ENTRYPOINT ["/dump.sh" ]
Original file line number Diff line number Diff line change @@ -6,12 +6,10 @@ set -o nounset
6
6
set -o pipefail
7
7
IFS=$' \n\t '
8
8
9
- # make script trace visible via `kubectl logs`
10
- set -o xtrace
11
-
12
9
ALL_DB_SIZE_QUERY=" select sum(pg_database_size(datname)::numeric) from pg_database;"
13
10
PG_BIN=$PG_DIR /$PG_VERSION /bin
14
11
DUMP_SIZE_COEFF=5
12
+ ERRORCOUNT=0
15
13
16
14
TOKEN=$( cat /var/run/secrets/kubernetes.io/serviceaccount/token)
17
15
K8S_API_URL=https://$KUBERNETES_SERVICE_HOST :$KUBERNETES_SERVICE_PORT /api/v1
@@ -42,9 +40,9 @@ function aws_upload {
42
40
43
41
[[ ! -z " $EXPECTED_SIZE " ]] && args+=(" --expected-size=$EXPECTED_SIZE " )
44
42
[[ ! -z " $LOGICAL_BACKUP_S3_ENDPOINT " ]] && args+=(" --endpoint-url=$LOGICAL_BACKUP_S3_ENDPOINT " )
45
- [[ ! " $LOGICAL_BACKUP_S3_SSE " == " " ]] && args+=(" --sse=$LOGICAL_BACKUP_S3_SSE " )
43
+ [[ ! -z " $LOGICAL_BACKUP_S3_SSE " ]] && args+=(" --sse=$LOGICAL_BACKUP_S3_SSE " )
46
44
47
- aws s3 cp - " $PATH_TO_BACKUP " " ${args[@]// \' / } " --debug
45
+ aws s3 cp - " $PATH_TO_BACKUP " " ${args[@]// \' / } "
48
46
}
49
47
50
48
function get_pods {
@@ -93,4 +91,9 @@ for search in "${search_strategy[@]}"; do
93
91
94
92
done
95
93
94
+ set -x
96
95
dump | compress | aws_upload $(( $(estimate_size) / DUMP_SIZE_COEFF))
96
+ [[ ${PIPESTATUS[0]} != 0 || ${PIPESTATUS[1]} != 0 || ${PIPESTATUS[2]} != 0 ]] && (( ERRORCOUNT += 1 ))
97
+ set +x
98
+
99
+ exit $ERRORCOUNT
You can’t perform that action at this time.
0 commit comments