Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
pg_cron fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dqii committed Apr 16, 2024
1 parent 159b2b1 commit c1ba94f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
type: string
description: "Lantern Suite version to tag"
required: true
default: "11"
default: "12"
IMAGE_NAME:
type: string
description: "Container image name to tag"
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ RUN git clone https://github.com/citusdata/pg_cron.git /tmp/pg_cron && \
cd /tmp/pg_cron && \
git checkout ${PG_CRON_VERSION} && \
make -j && \
make install && \
echo "shared_preload_libraries = 'pg_cron'" >> /var/lib/postgresql/data/postgresql.conf
make install

# Install Lantern
RUN cd /tmp && \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
timeout: 5s
retries: 5
http_server:
image: lanterndata/lantern-cli:0.1.9-cpu
image: lanterndata/lantern-cli:0.1.15-cpu
ports:
- "8080:8080"
volumes:
Expand Down
30 changes: 30 additions & 0 deletions scripts/configure-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@
set -euo pipefail

POSTGRESQL_CONF_FILE="/var/lib/postgresql/data/postgresql.conf"

########################
# Update the shared_preload_libraries configuration
# Globals:
# POSTGRESQL_*
# Arguments:
# $1 - library to add
# $2 - Path to configuration file (default: $POSTGRESQL_CONF_FILE)
# Returns:
# None
#########################
postgresql_update_shared_preload_libraries() {
local -r library="${1:?missing library}"
local -r conf_file="${2:-$POSTGRESQL_CONF_FILE}"
local libraries

if grep -qE "^shared_preload_libraries" "$conf_file"; then
libraries=$(sed -E "s/^shared_preload_libraries\s*=\s*'(.*)'/\1/" "$conf_file")
if [[ " $libraries " != *" $library "* ]]; then
libraries="$libraries, $library"
replace_in_file "$conf_file" "^shared_preload_libraries\s*=.*" "shared_preload_libraries = '$libraries'" false
fi
else
echo "shared_preload_libraries = '$library'" >> "$conf_file"
fi
}

########################
# Replace a regex-matching string in a file
# Arguments:
Expand Down Expand Up @@ -73,3 +100,6 @@ if [ "$work_mem_mb" -gt "64" ]; then
echo "Set work_mem to ${work_mem_mb}MB"
fi
echo "Set shared_buffers and effective_cache_size to ${shared_buffers_mb}MB"

# Enable pg_cron
postgresql_update_shared_preload_libraries "pg_cron"

0 comments on commit c1ba94f

Please sign in to comment.