-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to get a running installation of plrust via Docker #417
Comments
I also tried to just install the ARG PG_VERSION_MAJOR=16
FROM postgres:${PG_VERSION_MAJOR} AS builder
ARG PG_VERSION_MAJOR
ARG TARGETARCH
ENV PG_VERSION_MAJOR=${PG_VERSION_MAJOR}
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
bison \
build-essential \
ca-certificates \
ccache \
curl \
crossbuild-essential-arm64 \
crossbuild-essential-amd64 \
flex \
clang \
gcc \
git \
gnupg \
libcurl4-openssl-dev \
libicu72 \
libopenblas-dev \
libreadline-dev \
libssl-dev \
libxml2-dev \
libxml2-utils \
libxslt-dev \
lsb-release \
locales \
make \
pkg-config \
postgresql-server-dev-${PG_VERSION_MAJOR} \
software-properties-common \
xsltproc \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# PRE-REQUISITES
# ================
# Permissions
USER root
RUN chown postgres -R /usr/share/postgresql/${PG_VERSION_MAJOR}/extension/
RUN chown postgres -R /usr/lib/postgresql/${PG_VERSION_MAJOR}/lib/
USER postgres
# Install rust
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain "stable" -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "1.72.0"
ENV PATH="/var/lib/postgresql/.cargo/bin:$PATH"
RUN rustup toolchain install 1.72.0
RUN rustup default 1.72.0
RUN rustup default
RUN rustup component add llvm-tools-preview rustc-dev
RUN rustup target install aarch64-unknown-linux-gnu
RUN rustup target install x86_64-unknown-linux-gnu
# Install PL/Rust
WORKDIR /tmp
RUN echo ${TARGETARCH}
RUN curl -Lo "plrust.deb" https://github.com/tcdi/plrust/releases/download/v1.2.8/plrust-trusted-1.2.8_1.72.0-debian-bullseye-pg${PG_VERSION_MAJOR}-${TARGETARCH}.deb
USER root
RUN apt-get install -y /tmp/plrust.deb && rm -f /tmp/plrust.deb
USER postgres
# Setup plrust.work_dir
ENV SCRATCH_DIR="/var/lib/postgresql/plrust-scratch"
RUN mkdir -p ${SCRATCH_DIR}
WORKDIR /tmp/plrust/plrust
# Reset permissions
USER root
RUN chmod 0755 `$(which pg_config) --pkglibdir` && \
cd `$(which pg_config) --pkglibdir` && \
chown root:root *.so && \
chmod 0644 *.so && \
chmod 755 `$(which pg_config) --sharedir`/extension && \
cd `$(which pg_config) --sharedir`/extension && \
chown root:root *
RUN chown root -R /usr/share/postgresql/${PG_VERSION_MAJOR}/extension/
RUN chown root -R /usr/lib/postgresql/${PG_VERSION_MAJOR}/lib/
USER postgres
# 7. Run with shared_preload_libraries=plrust + plrust.work_dir
CMD ["postgres", "-c", "shared_preload_libraries=plrust", "-c", "plrust.work_dir='/var/lib/postgresql/plrust-scratch'", "-c", "logging_collector=on"] Again this gives me: postgres=# CREATE EXTENSION plrust;
CREATE EXTENSION
postgres=# CREATE FUNCTION add_two_numbers(a NUMERIC, b NUMERIC) RETURNS NUMERIC STRICT LANGUAGE plrust AS $$
Ok(Some(a + b))
$$;
ERROR:
0: No such file or directory (os error 2)
Location:
plrust/src/user_crate/build.rs:126
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After 2 days of fighting the system back and forth, I just arrived at the conclusion that either plrust cannot work in a Docker environment or the docs fail to explain some necessary steps.
So I leave here my attempt to install plrust from scratch using a Dockerfile, along with the errors I experience.
After building this Dockefile + spawning the corresponding container, I can enter into a
psql
session, where I try to do:CREATE EXTENSION plrust; -- returns `CREATE EXTENSION` without "untrusted" warning or error
then
gives this log:
I also tried to move things around here by following the
Dockerfile.try
in the project:This will give the following error:
I tried many many ways to build a Dockerfile and was never able to get plrust working...
Am I missing something here?
The extracted
pgrx
version is:0.11.0
The
rustc
version is1.72.0
The
rustup default
version is also1.72.0
The
Postgres
major is 16The text was updated successfully, but these errors were encountered: