Skip to content

Commit 92e57a6

Browse files
authored
Allow pg_cron to work on any configured POSTGRES_DB (CircleCI-Public#95)
Due to incorrect ownership of /etc/postgresql/custom-postgresql.conf the pg_cron.sh script was not able to add POSTGRES_DB to the `cron.database_name` config. Thus the only DB that would work with pg_cron is the 'circle_test' DB, as this was hard-coded in the example file. This fixes ownership of the files in the /etc/postgresql directory, so the pg_cron.sh script can run as expected. Also remove the cron-related lines from custom-postgresql.conf since pg_cron.sh is adding those two lines and we don't want confusion around duplicate settings. (Last one wins, for what it's worth.)
1 parent b2c0be7 commit 92e57a6

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

Dockerfile.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ RUN ln -s usr/local/bin/docker-entrypoint.sh /
109109
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/pg_cron.sh && \
110110
mkdir -p /var/lib/postgresql && \
111111
chown -R postgres:postgres /var/lib/postgresql && \
112+
chown -R postgres:postgres /etc/postgresql && \
112113
chown -R postgres:postgres /usr/local/bin/docker-entrypoint.sh
113114

114115
ENTRYPOINT ["docker-entrypoint.sh"]

custom-postgresql.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ max_prepared_transactions = 200
44
max_locks_per_transaction = 512
55
max_pred_locks_per_transaction = 256
66
listen_addresses = '*'
7-
shared_preload_libraries = 'pg_cron'
8-
cron.database_name = 'circle_test'

0 commit comments

Comments
 (0)