CrunchyData / postgres-operator

Production PostgreSQL for Kubernetes, from high availability Postgres clusters to full-scale database-as-a-service.
https://access.crunchydata.com/documentation/postgres-operator/v5/
Apache License 2.0
3.95k stars 593 forks source link

Adding extension mysql_fdw to postgres-gis #3888

Closed jahnavisana2812 closed 5 months ago

jahnavisana2812 commented 7 months ago

I'm attempting to construct a Dockerfile using the postgres-gis-ubi8 base image. The extension I aim to install is mysql_fdw, a foreign data wrapper allowing PostgreSQL to interact with MySQL. To ensure successful installation, it's necessary to run the makefile. However, I consistently encounter an error with the makefile. I've included the Dockerfile below along with the link to the extension I intend to install. Any assistance would be greatly appreciated. Thanks in advance! Link of the extension:https://github.com/EnterpriseDB/mysql_fdw

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.1-3.4-0
USER root
ARG myqld_fdw_release=2_9_1

ADD https://github.com/EnterpriseDB/mysql_fdw/archive/refs/tags/REL-${myqld_fdw_release}.tar.gz \
    /tmp/mysql-fdw.tar.gz

RUN tar -xvf /tmp/mysql-fdw.tar.gz -C /tmp --one-top-level --strip-components 1 && \
    rm -rf /tmp/mysql-fdw.tar.gz
WORKDIR /tmp/mysql-fdw

RUN export PATH=/usr/pgsql-16/bin/:$PATH
RUN make USE_PGXS=1
RUN make USE_PGXS=1 install

USER 26

Error I keep getting:

make: mysql_config: Command not found
make: mysql_config: Command not found
Makefile:44: *** PostgreSQL 11, 12, 13, 14, 15, or 16 is required to compile this extension.  Stop.
andrewlecuyer commented 7 months ago

hi @jahnavisana2812! This issue/error appears to be related the referenced extension, rather than anything with Crunchy Postgres for Kubernetes itself. E.g., nothing here indicates an issue with the Postgres container (e.g. the PATH provided for Postgres is valid, etc.).

I therefore suggest trying your question with the maintainers of the extension, e.g. to get better insight into why these Make targets are failing, and what dependencies, setup, etc. is needed to make this work.

And in the meantime, I'll leave this issue open in case anyone else out there has any insight and/or ideas to help with your issue. Additionally, I'll note that you can try reaching out via the PGO project community discord as well.

jahnavisana2812 commented 7 months ago

Update:I have talked to their team and they have insisted to install mysql client library to compile mysql_fdw using sources.I was trying to install mysql client but keeps throwing error Unable to find package.Please suggest the right way to install.I was doing it the following way.

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.1-3.4-0
USER root
ARG myqld_fdw_release=2_9_1

ADD https://github.com/EnterpriseDB/mysql_fdw/archive/refs/tags/REL-${myqld_fdw_release}.tar.gz \
    /tmp/mysql-fdw.tar.gz
RUN microdnf install yum
RUN microdnf install dnf
RUN tar -xvf /tmp/mysql-fdw.tar.gz -C /tmp --one-top-level --strip-components 1 && \
    rm -rf /tmp/mysql-fdw.tar.gz
RUN dnf install mysql-server

WORKDIR /tmp/mysql-fdw

RUN export PATH=/usr/pgsql-16/bin/:$PATH
RUN make USE_PGXS=1
RUN make USE_PGXS=1 install

USER 26

Error: Unable to find a match: mysql-server @andrewlecuyer can you suggest something on this I am unable to install it even using the rpm package

benjaminjb commented 5 months ago

Hi @jahnavisana2812, so I see you're trying to build a new image based on one of the provided images in order to add an extension. Unfortunately, CrunchyData doesn't have a prepared set of instructions on how to do that -- for one thing, there's a lot of extensions out there and it would be hard to provide info that covers all of them.

Because of that and because this issue is also not quite a problem with the postgres-operator code, but with other images that CrunchyData provides, I'm going to close this issue. But if you need further assistance on this issue, please keep the conversation going in our Discord server.