Skip to content
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

Pre-configure docker image to use pg_duckdb #305

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

JelteF
Copy link
Collaborator

@JelteF JelteF commented Oct 17, 2024

This slightly modifies the default Postgres docker image so that when it initializes the database it will automatically configure pg_duckdb. It also uses the postgres user to start the container, so that docker exec ... psql just works without having to specify -U postgres

This also uses a more selective COPY. I often have some random stuff in my top repo directory, such as gigabytes of TPCDS csv files. This makes sure those are not copied into the container.

@JelteF JelteF added documentation Improvements or additions to documentation developer experience Improves our own lives labels Oct 17, 2024
This slightly modifies the default Postgres docker image so that when it initializes the database it will automatically configure `pg_duckdb`.
@JelteF JelteF force-pushed the docker-enalbe-pg_duckdb-automatically branch from 945f051 to 81e4773 Compare October 17, 2024 08:34
@JelteF JelteF mentioned this pull request Oct 17, 2024
Copy link
Collaborator

@Y-- Y-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@JelteF JelteF force-pushed the docker-enalbe-pg_duckdb-automatically branch from 9f800a6 to 592fd90 Compare October 17, 2024 09:32
@JelteF JelteF requested a review from Y-- October 17, 2024 09:36
@JelteF JelteF merged commit ec68e8a into main Oct 17, 2024
10 checks passed
@JelteF JelteF deleted the docker-enalbe-pg_duckdb-automatically branch October 17, 2024 10:47
@@ -50,4 +56,10 @@ RUN make installcheck
###
# this creates a usable postgres image but without the packages needed to build
FROM base AS output

# Automatically enable pg_duckdb
RUN echo "shared_preload_libraries='pg_duckdb'" >> /usr/share/postgresql/postgresql.conf.sample
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I didnt think that you could make changes to the sample file (you know, it being named "sample" and all) and it would get picked up somehow later. TIL. 😂 I think it's still nice to be able to inject a config file for other purposes (like motherduck token) via docker-compose, but if this means that the image works without doing so, then great! 👍


# Automatically enable pg_duckdb
RUN echo "shared_preload_libraries='pg_duckdb'" >> /usr/share/postgresql/postgresql.conf.sample
RUN echo "CREATE EXTENSION IF NOT EXISTS pg_duckdb;" >> /docker-entrypoint-initdb.d/0001-install-pg_duckdb.sql
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably okay to do here. I was only hesitant to do so in case some users want to opt out of this behavior, doing so this way means they need to make their own image which removes this file. But if we get push back it can always be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience Improves our own lives documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants