Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.python-version
venv/
*.swp
62 changes: 62 additions & 0 deletions ansible/tasks/postgres-extensions/22-pg_jsonschema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# pg_jsonschema
- name: pg_jsonschema - download & install dependencies
apt:
pkg:
- make
- gcc
- pkg-config
- clang
- libssl-dev
update_cache: yes
install_recommends: no

- name: download rust/cargo installer
become: yes
get_url:
url: https://sh.rustup.rs
dest: /tmp/sh.rustup.rs
mode: '0755'
owner: postgres
group: postgres

- name: install rust/cargo
become: yes
become_user: postgres
shell: /tmp/sh.rustup.rs -y

- name: install cargo-pgx
become: yes
become_user: postgres
shell:
cmd: "~/.cargo/bin/cargo install --version '={{ pgx_version }}' cargo-pgx && ~/.cargo/bin/cargo pgx init --pg{{ postgresql_major }} pg_config"

- name: pg_jsonschema - download release
become: yes
git:
repo: https://github.com/supabase/pg_jsonschema.git
dest: /tmp/pg_jsonschema
version: "{{ pg_jsonschema_release }}"

- name: pg_jsonschema - temporarily transfer ownership to postgres
file:
path: '{{ item }}'
recurse: yes
owner: postgres
group: postgres
with_items:
- /tmp/pg_jsonschema
- /usr/lib/postgresql/lib

- name: pg_jsonschema - install
become: yes
become_user: postgres
shell:
cmd: "~/.cargo/bin/cargo pgx install --release"
chdir: /tmp/pg_jsonschema

- name: pg_jsonschema - return ownership to root
file:
path: /usr/lib/postgresql/lib
recurse: yes
owner: root
group: root
3 changes: 3 additions & 0 deletions ansible/tasks/setup-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@

- name: Install auto_explain
import_tasks: tasks/postgres-extensions/21-auto_explain.yml

- name: Install pg_jsonschema
import_tasks: tasks/postgres-extensions/22-pg_jsonschema.yml
3 changes: 3 additions & 0 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@ libgraphqlparser_commit_sha: 3b64cd52d13621921990a5801ba019e8a9402599

pg_graphql_release: "v0.4.0"

pgx_version: "0.4.5"
pg_jsonschema_release: "v0.1.0"

pg_stat_monitor_release: "1.0.1"
2 changes: 1 addition & 1 deletion common.vars.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
postgres-version = "14.1.0.50"
postgres-version = "14.1.0.51"