From 57cfbfe88798fdce124de854af0a19bf56e74872 Mon Sep 17 00:00:00 2001 From: Amin Latifi Date: Mon, 12 Feb 2024 12:15:51 +0000 Subject: [PATCH 1/2] Revert "Revert "Feat: add support for pg_trgm"" --- Dockerfile | 2 +- README.md | 2 +- init-db/{001-setup.sh => 001-setup-pg_cron.sh} | 5 ++--- init-db/002-setup-pg_trgm.sql | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) rename init-db/{001-setup.sh => 001-setup-pg_cron.sh} (77%) create mode 100644 init-db/002-setup-pg_trgm.sql diff --git a/Dockerfile b/Dockerfile index c2be374..d6d58e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:13.8 +FROM postgres:13 RUN apt-get update RUN apt-get -y install postgresql-13-cron diff --git a/README.md b/README.md index 442f994..fc99cf2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Postgres givethio -We needed a postgres docker image with enabled pg_cron so we wrote and publish this docker image +We needed a postgres docker image with enabled pg_cron and pg_trgm so we wrote and publish this docker image to use it in https://github.com/Giveth/impact-graph related PR in impact-graph https://github.com/Giveth/impact-graph/pull/658 diff --git a/init-db/001-setup.sh b/init-db/001-setup-pg_cron.sh similarity index 77% rename from init-db/001-setup.sh rename to init-db/001-setup-pg_cron.sh index 92e840f..1b19da6 100755 --- a/init-db/001-setup.sh +++ b/init-db/001-setup-pg_cron.sh @@ -4,9 +4,8 @@ # Remove last line "shared_preload_libraries='citus'" sed -i '$ d' /var/lib/postgresql/data/pgdata/postgresql.conf cat <> /var/lib/postgresql/data/pgdata/postgresql.conf -shared_preload_libraries='pg_cron' -cron.database_name='givethio' +shared_preload_libraries = 'pg_cron,pg_trgm'; +cron.database_name = 'givethio' EOT # Required to load pg_cron pg_ctl restart - diff --git a/init-db/002-setup-pg_trgm.sql b/init-db/002-setup-pg_trgm.sql new file mode 100644 index 0000000..d497121 --- /dev/null +++ b/init-db/002-setup-pg_trgm.sql @@ -0,0 +1 @@ +CREATE EXTENSION pg_trgm; From c85bfeb05cb517581ebaa1467ca492885afaf6b7 Mon Sep 17 00:00:00 2001 From: Moe Shehab <52987806+mhmdksh@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:17:39 +0400 Subject: [PATCH 2/2] Update 001-setup-pg_cron.sh Fixing the colon in the postgres config while loading libraries --- init-db/001-setup-pg_cron.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-db/001-setup-pg_cron.sh b/init-db/001-setup-pg_cron.sh index 1b19da6..5875d59 100755 --- a/init-db/001-setup-pg_cron.sh +++ b/init-db/001-setup-pg_cron.sh @@ -4,7 +4,7 @@ # Remove last line "shared_preload_libraries='citus'" sed -i '$ d' /var/lib/postgresql/data/pgdata/postgresql.conf cat <> /var/lib/postgresql/data/pgdata/postgresql.conf -shared_preload_libraries = 'pg_cron,pg_trgm'; +shared_preload_libraries = 'pg_cron,pg_trgm' cron.database_name = 'givethio' EOT # Required to load pg_cron