File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,31 +10,36 @@ ARG PYTHON_VERSION="3.13" \
1010
1111ENV HOME=/data \
1212 PG_MAJOR=18 \
13- PG_MINOR=1
13+ PG_MINOR=1 \
14+ WAL_G_VERSIONR="3.0.5" \
15+ RCLONE_VERSION="1.71.1"
16+
1417ENV PGDATA $HOME/$PG_MAJOR
1518
1619RUN install-packages vim gcc \
1720 && install-stack python $PYTHON_VERSION \
1821 && install-stack postgresql $PG_MAJOR.$PG_MINOR \
22+ && install-stack wal-g $WAL_G_VERSIONR \
23+ && install-stack rclone $RCLONE_VERSION \
1924 && install-stack postgres_exporter $POSTGRES_EXPORTER_VERSION \
2025 && . init-stack \
2126 && set -eux; pip3 install --disable-pip-version-check --no-cache-dir psycopg[binary] patroni[kubernetes] 2>/dev/null; set +eux \
2227 && apt-get purge -y --auto-remove gcc \
2328 && apt-get autoremove -y \
2429 && apt-get clean -y \
2530 && rm -rf \
26- /usr/share/doc \
27- /usr/share/man \
28- /usr/share/info \
29- /usr/share/locale \
30- /var/lib/apt/lists/* \
31- /var/log/* \
32- /var/cache/debconf/* \
33- /etc/systemd \
34- /lib/lsb \
35- /lib/udev \
36- /usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
37- /usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
31+ /usr/share/doc \
32+ /usr/share/man \
33+ /usr/share/info \
34+ /usr/share/locale \
35+ /var/lib/apt/lists/* \
36+ /var/log/* \
37+ /var/cache/debconf/* \
38+ /etc/systemd \
39+ /lib/lsb \
40+ /lib/udev \
41+ /usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
42+ /usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
3843 && mkdir -p /usr/share/man/man{1..8} \
3944 && mkdir -p $PGDATA \
4045 && groupadd postgres && useradd -g postgres postgres \
Original file line number Diff line number Diff line change 11{{- define " database.envs" }}
22env:
3+ - name: USE_WALG
4+ value: " true"
5+ {{- if (.Values.storageEndpoint ) }}
6+ - name: " DRYCC_STORAGE_BUCKET"
7+ valueFrom:
8+ secretKeyRef:
9+ name: database-creds
10+ key: storage-bucket
11+ - name: " DRYCC_STORAGE_ENDPOINT"
12+ valueFrom:
13+ secretKeyRef:
14+ name: database-creds
15+ key: storage-endpoint
16+ - name: " DRYCC_STORAGE_ACCESSKEY"
17+ valueFrom:
18+ secretKeyRef:
19+ name: database-creds
20+ key: storage-accesskey
21+ - name: " DRYCC_STORAGE_SECRETKEY"
22+ valueFrom:
23+ secretKeyRef:
24+ name: database-creds
25+ key: storage-secretkey
26+ - name: " DRYCC_STORAGE_PATH_STYLE"
27+ valueFrom:
28+ secretKeyRef:
29+ name: database-creds
30+ key: storage-path-style
31+ {{- else if .Values.storage.enabled }}
32+ - name: " DRYCC_STORAGE_BUCKET"
33+ value: " database"
34+ - name: " DRYCC_STORAGE_ENDPOINT"
35+ value: http://drycc-storage:9000
36+ - name: " DRYCC_STORAGE_ACCESSKEY"
37+ valueFrom:
38+ secretKeyRef:
39+ name: storage-creds
40+ key: accesskey
41+ - name: " DRYCC_STORAGE_SECRETKEY"
42+ valueFrom:
43+ secretKeyRef:
44+ name: storage-creds
45+ key: secretkey
46+ - name: " DRYCC_STORAGE_PATH_STYLE"
47+ value: " true"
48+ {{- end }}
349{{- if eq .Values.debug " true" }}
450- name: PATRONI_LOG_LEVEL
551 value: DEBUG
Original file line number Diff line number Diff line change 1212 replicator-password : {{ include "common.secrets.lookup" (dict "secret" "database-creds" "key" "replicator-password" "defaultValue" (.Values.replicatorPassword | default (randAlphaNum 32) | lower) "context" $) }}
1313 user : {{ include "common.secrets.lookup" (dict "secret" "database-creds" "key" "user" "defaultValue" (.Values.user | default (randAlpha 32) | lower) "context" $) }}
1414 password : {{ include "common.secrets.lookup" (dict "secret" "database-creds" "key" "password" "defaultValue" (.Values.password | default (randAlphaNum 32)) "context" $) }}
15+ {{- if (.Values.storageEndpoint) }}
16+ storage-bucket : {{ .Values.storageBucket | b64enc }}
17+ storage-endpoint : {{ .Values.storageEndpoint | b64enc }}
18+ storage-accesskey : {{ .Values.storageAccesskey | b64enc }}
19+ storage-secretkey : {{ .Values.storageSecretkey | b64enc }}
20+ storage-path-style : {{ .Values.storagePathStyle | b64enc }}
21+ {{- end }}
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ diagnosticMode:
2020 args :
2121 - infinity
2222
23- resources : {}
23+ resources :
24+ {}
2425 # limits:
2526 # cpu: 200m
2627 # memory: 50Mi
@@ -32,7 +33,7 @@ nodeAffinityPreset:
3233 key : " drycc.cc/node"
3334 type : " soft"
3435 values :
35- - " true"
36+ - " true"
3637
3738podAffinityPreset :
3839 type : " "
@@ -45,7 +46,16 @@ podAntiAffinityPreset:
4546 app : " drycc-database"
4647
4748debug : " false"
49+ # Patroni pg_ctl timeout
4850timeout : " 1200"
51+
52+ # The following parameters will no longer use the built-in storage component.
53+ storageBucket : " database"
54+ storageEndpoint : " "
55+ storageAccesskey : " "
56+ storageSecretkey : " "
57+ storagePathStyle : " true"
58+
4959# Service
5060service :
5161 # Provide any additional service annotations
@@ -66,7 +76,7 @@ persistence:
6676 storageClass : " "
6777# The username and password to be used by the on-cluster database.
6878# If left empty they will be generated
69- # The user name should be set to lowercase letters
79+ # The user name should be set to lowercase letters
7080superuser : " postgres"
7181superuserPassword : " "
7282replicator : " standby"
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ /bin/create_bucket
4+
35if [[ $UID -ge 10000 ]]; then
46 GID=$( id -g)
57 sed -e " s/^postgres:x:[^:]*:[^:]*:/postgres:x:$UID :$GID :/" /etc/passwd > /tmp/passwd
@@ -46,7 +48,7 @@ postgresql:
4648 track_commit_timestamp: "off"
4749 archive_mode: "on"
4850 archive_timeout: 300s
49- archive_command: "/bin/true "
51+ archive_command: "/usr/share/scripts/wal-g/wal_push.sh %p "
5052 log_min_duration_statement: 1000
5153 log_lock_waits: on
5254 log_statement: 'ddl'
You can’t perform that action at this time.
0 commit comments