Skip to content

Commit 6277e2f

Browse files
authored
feat: add optional pg_cron extension (#320)
1 parent eb69d22 commit 6277e2f

4 files changed

Lines changed: 25 additions & 0 deletions

File tree

adm/_create_plugin_database.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ EOF
9090
batch_psql "/tmp/extension.partman" "Creating pg_partman extension" "plugin_${NAME}" "metwork" || exit 1
9191
rm -f "/tmp/extension.partman"
9292
fi
93+
if test "${MFBASE_POSTGRESQL_PG_CRON}" = "1"; then
94+
cat >/tmp/extension.pg_cron <<EOF
95+
CREATE EXTENSION pg_cron;
96+
EOF
97+
batch_psql "/tmp/extension.pg_cron" "Creating pg_cron extension" "plugin_${NAME}" "metwork" || exit 1
98+
rm -f "/tmp/extension.pg_cron"
99+
fi
93100

94101

95102
_fix_plugin_owner.py "plugin_${NAME}" "plugin_${NAME}" >/dev/null

adm/mfxxx.init.custom

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ EOF
127127
batch_psql "/tmp/extension.partman" "Adding pg_partman extension" || exit 1
128128
rm -f "/tmp/extension.partman"
129129
fi
130+
if test "${MFBASE_POSTGRESQL_PG_CRON}" = "1"; then
131+
cat >/tmp/extension.pg_cron <<EOF
132+
CREATE EXTENSION pg_cron;
133+
EOF
134+
batch_psql "/tmp/extension.pg_cron" "Adding pg_cron extension" || exit 1
135+
rm -f "/tmp/extension.pg_cron"
136+
fi
130137

131138

132139
echo -n "- Stopping mfbase services..."

config/config.ini.custom

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ geohash=0
4040
# Change partman to 1 if you want to create the extension
4141
partman=0
4242

43+
# By default extension pg_cron is not created
44+
# Change pg_cron to 1 if you want to create the extension
45+
# See pg_cron usage here : https://github.com/citusdata/pg_cron
46+
pg_cron=0
47+
4348
##################
4449
##### CIRCUS #####
4550
##################

config/postgresql.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ logging_collector = off
66
log_min_messages = warning
77
unix_socket_directories = '{{MFMODULE_RUNTIME_HOME}}/var'
88
listen_addresses = '*'
9+
{% if MFBASE_POSTGRESQL_PG_CRON == "1" %}
10+
shared_preload_libraries = 'pg_stat_statements, pg_cron'
11+
cron.database_name = 'metwork'
12+
cron.timezone = 'GMT'
13+
{% else %}
914
shared_preload_libraries = 'pg_stat_statements'
15+
{% endif %}

0 commit comments

Comments
 (0)