Skip to content

Commit 600f588

Browse files
J0joel@joellee.org
andauthored
Make Updates To AMI To Support pg_stat_monitor (#215)
* chore: make ammendments for pg_stat_monitor * fix: add pg_stat_monitor task * refactor: switch to install form source instead of from apt * Update 20-pg_stat_monitor.yml * remove pg_stat_statements Co-authored-by: joel@joellee.org <joel@joellee.org>
1 parent eac61b8 commit 600f588

File tree

8 files changed

+31
-6
lines changed

8 files changed

+31
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
2929
| [rum](https://github.com/postgrespro/rum) | [1.3.9](https://github.com/postgrespro/rum/releases/tag/1.3.9) | An alternative to the GIN index. |
3030
| [pg_hashids](https://github.com/iCyberon/pg_hashids) | [commit](https://github.com/iCyberon/pg_hashids/commit/83398bcbb616aac2970f5e77d93a3200f0f28e74) | Generate unique identifiers from numbers. |
3131
| [pgsodium](https://github.com/michelp/pgsodium) | [2.0.0](https://github.com/michelp/pgsodium/releases/tag/2.0.0) | Modern encryption API using libsodium. |
32+
| [pg_stat_monitor](https://github.com/percona/pg_stat_monitor) | [1.0.1](https://github.com/percona/pg_stat_monitor/releases/tag/1.0.1) | Query Performance Monitoring Tool for PostgreSQL
3233

3334

3435
Can't find your favorite extension? Suggest for it to be added into future releases [here](https://github.com/supabase/supabase/discussions/679)!

ansible/files/postgres_exporter.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ StandardOutput=append:/var/log/postgres_exporter.stdout
99
StandardError=append:/var/log/postgres_exporter.error
1010
Restart=always
1111
RestartSec=3
12-
Environment="DATA_SOURCE_NAME=host=localhost dbname=postgres sslmode=disable user=supabase_admin pg_stat_statements.track=none application_name=postgres_exporter"
12+
Environment="DATA_SOURCE_NAME=host=localhost dbname=postgres sslmode=disable user=supabase_admin pg_stat_monitor.track=none application_name=postgres_exporter"
1313

1414
[Install]
1515
WantedBy=multi-user.target

ansible/files/postgresql_config/postgresql.conf.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ default_text_search_config = 'pg_catalog.english'
719719

720720
#local_preload_libraries = ''
721721
#session_preload_libraries = ''
722-
shared_preload_libraries = 'pg_stat_statements, pgaudit, plpgsql, plpgsql_check, pg_cron, pg_net, pgsodium, timescaledb' # (change requires restart)
722+
723+
shared_preload_libraries = 'pg_stat_monitor, pgaudit, plpgsql, plpgsql_check, pg_cron, pg_net, pgsodium, timescaledb' # (change requires restart)
723724
jit_provider = 'llvmjit' # JIT library to use
724725

725726
# - Other Defaults -

ansible/files/stat_extension.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CREATE SCHEMA IF NOT exists extensions;
2-
CREATE EXTENSION IF NOT EXISTS pg_stat_statements with schema extensions;
2+
CREATE EXTENSION IF NOT EXISTS pg_stat_monitor with schema extensions;

ansible/tasks/internal/supautils.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@
6565
lineinfile:
6666
path: /etc/postgresql/postgresql.conf
6767
state: present
68-
# full list: supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_net, pg_prewarm, pg_stat_statements, pg_surgery, pg_trgm, pg_visibility, pgaudit, pgcrypto, pgjwt, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supautils, tablefunc, tcn, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp'
68+
# full list: supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_net, pg_prewarm, pg_stat_monitor, pg_surgery, pg_trgm, pg_visibility, pgaudit, pgcrypto, pgjwt, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supautils, tablefunc, tcn, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp'
6969
#
7070
# omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_buffercache, pg_freespacemap, pg_prewarm, pg_surgery, pg_visibility, pgstattuple
7171
#
7272
# omitted because doesn't require superuser: pgjwt, pgtap, postgis_tiger_geocoder
7373
#
7474
# omitted because deprecated: intagg
7575
#
76-
line: supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, insert_username, intarray, isn, ltree, moddatetime, pg_cron, pg_graphql, pg_hashids, pg_net, pg_stat_statements, pg_trgm, pgaudit, pgcrypto, pgrouting, pgrowlocks, pgsodium, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supautils, tablefunc, tcn, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp'
76+
line: supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, insert_username, intarray, isn, ltree, moddatetime, pg_cron, pg_graphql, pg_hashids, pg_net, pg_stat_monitor, pg_trgm, pgaudit, pgcrypto, pgrouting, pgrowlocks, pgsodium, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supautils, tablefunc, tcn, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp'
7777

7878
- name: supautils - set supautils.privileged_extensions_superuser
7979
become: yes
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# pg_stat_monitor
2+
- name: pg_stat_monitor - download and install dependencies
3+
git:
4+
repo: https://github.com/percona/pg_stat_monitor.git
5+
dest: /tmp/pg_stat_monitor
6+
version: "{{ pg_stat_monitor_release }}"
7+
become: yes
8+
9+
- name: pg_stat_monitor build
10+
make:
11+
chdir: /tmp/pg_stat_monitor
12+
params: USE_PGXS=1
13+
14+
- name: pg_stat_monitor install
15+
make:
16+
chdir: /tmp/pg_stat_monitor
17+
target: install
18+
params: USE_PGXS=1

ansible/tasks/setup-extensions.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@
5353
import_tasks: tasks/postgres-extensions/18-pgsodium.yml
5454

5555
- name: Install pg_graphql
56-
import_tasks: tasks/postgres-extensions/19-pg_graphql.yml
56+
import_tasks: tasks/postgres-extensions/19-pg_graphql.yml
57+
58+
- name: Install pg_stat_monitor
59+
import_tasks: tasks/postgres-extensions/20-pg_stat_monitor.yml

ansible/vars.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,7 @@ libgraphqlparser_commit_sha: 3b64cd52d13621921990a5801ba019e8a9402599
9898

9999
pg_graphql_release: "v0.3.1"
100100

101+
pg_stat_monitor_release: "1.0.1"
102+
101103
osquery_deb: 'https://pkg.osquery.io/deb/osquery_5.1.0-1.linux_arm64.deb'
102104
osquery_deb_checksum: sha1:6b6fa49edcfad5d77aa1e59c75b8708de2f634ac

0 commit comments

Comments
 (0)