Skip to content

Commit 8403890

Browse files
committed
install plrust as a standalone step due to runtime deps
1 parent 37eca0a commit 8403890

File tree

4 files changed

+21
-63
lines changed

4 files changed

+21
-63
lines changed

Dockerfile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ ARG pgvector_release=0.4.0
3737
ARG pg_tle_release=1.0.3
3838
ARG supautils_release=1.7.2
3939
ARG wal_g_release=2.0.1
40-
ARG plrust_release=1.2.3
41-
ARG plrust_release_checksum
42-
ARG plrust_language_version=1.70.0
43-
ARG plrust_pgrx_version=0.9.7
4440

4541

4642
####################
@@ -801,15 +797,6 @@ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccac
801797
# Create debian package
802798
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
803799

804-
####################
805-
# 30-plrust.yml
806-
####################
807-
FROM base as plrust-source
808-
ARG plrust_release
809-
ARG plrust_language_version=1.70.0
810-
ADD "https://github.com/tcdi/plrust/releases/download/v${plrust_release}/plrust-trusted-${plrust_release}_${plrust_language_version}-debian-pg${postgresql_major}-${TARGETARCH}.deb" \
811-
/tmp/plrust.deb
812-
813800
####################
814801
# internal/supautils.yml
815802
####################

ansible/tasks/postgres-extensions/30-plrust.yml

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,71 +19,39 @@
1919
state: present
2020
update_cache: yes
2121

22-
- name: plrust - install Rust
22+
- name: plrust - install plrust
23+
ansible.builtin.apt:
24+
deb: "https://github.com/tcdi/plrust/releases/download/v{{ plrust_release }/plrust-trusted-{ plrust_release }_{{ plrust_language_version }}-debian-pg{{ postgresql_major }}-{ platform }}.deb"
25+
26+
- name: plrust - install rust
27+
become: yes
28+
become_user: postgres
29+
become_method: su
2330
shell: |
2431
wget -qO- https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain={{ plrust_language_version }}
2532
echo 'source "$HOME/.cargo/env"' >> $HOME/.bashrc
2633
args:
2734
creates: "$HOME/.cargo"
2835

29-
- name: plrust - install Rust toolchain and set default
36+
- name: plrust - install rust toolchain and set default
37+
become: yes
38+
become_user: postgres
39+
become_method: su
3040
shell: |
3141
source $HOME/.cargo/env
3242
rustup toolchain install {{ plrust_language_version }}
3343
rustup default {{ plrust_language_version }}
3444
args:
3545
executable: /bin/bash
3646

37-
- name: plrust - add components and target
47+
- name: plrust - add rust components and target
48+
become: yes
49+
become_user: postgres
50+
become_method: su
3851
shell: |
3952
source $HOME/.cargo/env
4053
rustup component add llvm-tools-preview rustc-dev
4154
rustup target install x86_64-unknown-linux-gnu
42-
args:
43-
executable: /bin/bash
44-
45-
- name: plrust - install cargo-pgrx and initialize
46-
shell: |
47-
source $HOME/.cargo/env
48-
cargo install cargo-pgrx --locked
49-
cargo pgrx init --pg{{ postgresql_major }} /usr/bin/pg_config
50-
args:
51-
executable: /bin/bash
52-
53-
- name: plrust - clone plrust
54-
git:
55-
repo: https://github.com/tcdi/plrust
56-
dest: /tmp/plrust
57-
version: v{{ plrust_release }}
58-
59-
60-
- name: plrust - move plrustc binary to .cargo/bin
61-
command:
62-
cmd: mv "/tmp/plrust/plrust/build/bin/plrustc" "$HOME/.cargo/bin/"
63-
warn: false
64-
65-
- name: plrust - build plrust
66-
shell: |
67-
source $HOME/.cargo/env
68-
export PG_VER="{{ postgresql_major }}"
69-
70-
if [[ "{{ platform }}" == "arm64" ]]; then
71-
STD_TARGETS="aarch64-postgres-linux-gnu"
72-
elif [[ "{{ platform }}" == "amd64" ]]; then
73-
STD_TARGETS="amd64-postgres-linux-gnu"
74-
else
75-
echo "Unsupported platform: $platform"
76-
exit 1
77-
fi
78-
79-
./build
80-
args:
81-
executable: /bin/bash
82-
chdir: "/tmp/plrust/plrust"
83-
84-
- name: plrust - install plrust
85-
shell: |
86-
source $HOME/.cargo/env
87-
cargo pgrx install --release --features trusted -c /usr/bin/pg_config
55+
rustup target install aarch64-unknown-linux-gnu
8856
args:
8957
executable: /bin/bash

ansible/tasks/setup-docker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
src: files/extensions/
44
dest: /tmp/extensions/
55

6+
- name: plrust - install
7+
import_tasks: tasks/postgres-extensions/30-plrust.yml
8+
69
# Builtin apt module does not support wildcard for deb paths
710
- name: Install extensions
811
shell: |

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.107-plrust"
1+
postgres-version = "15.1.0.107-plrust-1"

0 commit comments

Comments
 (0)