File tree Expand file tree Collapse file tree
usr/share/scripts/patroni Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,15 +3,15 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
33
44COPY rootfs/usr /usr/
55COPY rootfs/entrypoint.sh /entrypoint.sh
6- ENV PYTHON_VERSION= "3.11" \
7- PG_MAJOR=14 \
8- POSTGRESQL_VERSION= "15.3 "
6+ ENV PG_MAJOR=15 \
7+ PG_MINOR=3 \
8+ PYTHON_VERSION= "3.11 "
99
1010ENV PGDATA /data/${PG_MAJOR}
1111
1212RUN install-packages gcc \
1313 && install-stack python $PYTHON_VERSION \
14- && install-stack postgresql $POSTGRESQL_VERSION \
14+ && install-stack postgresql $PG_MAJOR.$PG_MINOR \
1515 && . init-stack \
1616 && set -eux; pip3 install --disable-pip-version-check --no-cache-dir psycopg[binary] patroni[kubernetes] 2>/dev/null; set +eux \
1717 && apt-get purge -y --auto-remove gcc \
Original file line number Diff line number Diff line change 3838 value: '0.0.0.0 :8008'
3939- name: " DRYCC_DATABASE_INIT_NAMES"
4040 value: " {{.Values.initDatabases}}"
41+ - name: " DRYCC_DATABASE_EXTENSIONS"
42+ value: " {{.Values.databaseExtensions}}"
4143- name: DRYCC_DATABASE_SUPERUSER
4244 valueFrom:
4345 secretKeyRef:
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ replicator: "standby"
5656replicatorPassword : " "
5757user : " "
5858password : " "
59- initDatabases : " controller,passport"
59+ initDatabases : " controller,passport,monitor"
60+ databaseExtensions : " postgis,timescaledb"
6061
6162global :
6263 # Set the location of Workflow's Object Storage
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ restapi:
2626 connect_address: '${PATRONI_KUBERNETES_POD_IP} :8008'
2727postgresql:
2828 data_dir: '${PGDATA} '
29+ parameters:
30+ timescaledb.license: 'timescale'
31+ shared_preload_libraries: 'auto_explain,timescaledb,pg_stat_statements'
2932 connect_address: '${PATRONI_KUBERNETES_POD_IP} :5432'
3033 authentication:
3134 superuser:
Original file line number Diff line number Diff line change @@ -4,11 +4,18 @@ set -Eeu
44if [[ ( -n " $DRYCC_DATABASE_USER " ) && ( -n " $DRYCC_DATABASE_PASSWORD " )]]; then
55 echo " Creating user ${DRYCC_DATABASE_USER} "
66 psql " $1 " -w -c " create user ${DRYCC_DATABASE_USER} WITH LOGIN ENCRYPTED PASSWORD '${DRYCC_DATABASE_PASSWORD} '"
7-
87 for dbname in ${DRYCC_DATABASE_INIT_NAMES// ,/ }
98 do
109 echo " Creating database ${dbname} "
1110 psql " $1 " -w -c " CREATE DATABASE ${dbname} OWNER ${DRYCC_DATABASE_USER} "
11+ for extension in ${DRYCC_DATABASE_EXTENSIONS// ,/ }
12+ do
13+ echo " Creating extension ${extension} "
14+ psql " $1 " -w << EOF
15+ \c ${dbname} ;
16+ create extension ${extension} ;
17+ EOF
18+ done
1219 done
1320else
1421 echo " Skipping user creation"
You can’t perform that action at this time.
0 commit comments