Closed C-monC closed 2 years ago
Hey @C-monC thanks for contributing this -- I'll take a look and try to reproduce your issue...
Before that, would you mind noting what error(s) you are seeing when you start the Postgres server and attempt to load the extension?
Ah sorry, of course.
Running:
create extension pg_idkit;
Returns:
SQL Error [58P01]: ERROR: could not access file "$libdir/pg_idkit": No such file or directory
Oh so I think I've seen this while testing locally -- the directory used for Alpine is different, in particular for the lib
folder. There's been some confusion about this in the past and this example dockerfile should work.
I still haven't run your Dockerfile locally just yet, but take that with a grain of salt! The error message should be telling us that the lib
dir installation is causing the issue there.
It was that one line:
COPY --from=build /home/app/target/release/pg_idkit-pg14/usr/lib/postgresql/14/lib/pg_idkit.so /usr/lib/postgresql/14/lib/pg_idkit.so
The working dockerfile.
FROM rust:latest as build
ENV build_deps build-essential \
libpq-dev \
postgresql \
postgresql-server-dev-14 \
curl \
zlib1g-dev \
libclang-dev
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update
RUN apt-get install -y --no-install-recommends $build_deps pkg-config cmake
RUN useradd --user-group --system --create-home --no-log-init app
RUN usermod -aG sudo app
RUN chown -R app /home/app
USER app
RUN cargo install cargo-pgx
RUN cargo pgx init --pg14 $(which pg_config)
COPY ./db /home/app
WORKDIR /home/app
RUN make package
FROM postgres:14
# SHAREDIR should be /usr/local/share/postgresql (pg_config --sharedir)
COPY --from=build /home/app/target/release/pg_idkit-pg14/usr/lib/postgresql/14/lib/pg_idkit.so /usr/lib/postgresql/14/lib/pg_idkit.so
COPY --from=build /home/app/target/release/pg_idkit-pg14/usr/share/postgresql/14/extension/pg_idkit.control /usr/share/postgresql/14/extension/
COPY --from=build /home/app/target/release/pg_idkit-pg14/usr/share/postgresql/14/extension/pg_idkit--0.1.0.sql /usr/share/postgresql/14/extension/
RUN echo "CREATE EXTENSION IF NOT EXISTS pg_idkit;" > /docker-entrypoint-initdb.d/create_pg_idkit.sql
Thanks for the help
Thanks for updating @C-monC ! If you don't mind I think I'll use your Dockerfile
when I add docker support to the codebase.
Cool, that'll be great.
I see all the extensions return strings. I'll try implement something similar to pgx uuid type for xid this weekend.
Hey I appreciate it -- I'm working on getting Github Actions runnign right now so I can move a bit quicker.
Also one of the things I'm thinking of doing is changing (I'll probably just do it via accretion just to be safe) the function signatures.
idkit_uuidv6_generate
-> idkit_uuidv6_gen_text
It should have always been clear what type it was from the function call -- since there is disparate support for different output types (uuid
, byte[]
, etc) it's a much better idea to be explicit.
Hi, could you enable discussions in this repo? I have a few questions for creating new types.
Or I could just start a new issue?
Hey @C-monC you could create a new issue, that would be great -- I have issue templates now, so you could do a Feature type issue
Hi,
I am trying to get this extension to install in docker. Could you please assist.
I suspect the issue is in the copy destinations.