Skip to content

Conversation

@jfroche
Copy link
Collaborator

@jfroche jfroche commented Jun 26, 2025

Build multiple versions of the pgroonga extension on different PostgreSQL versions. Add test for the extensions and their upgrade on PostgreSQL 15 and 17

also includes

Fix Groonga/PGroonga Installation in Dockerfiles

Summary

aligns the groonga/pgroonga installation approach in Dockerfiles with the Ansible deployment method, ensuring consistent behavior across different deployment strategies.

Problem

There was an inconsistency in how groonga and pgroonga packages were being installed between Ansible-based deployments and Docker-based deployments:

Ansible Approach (Correct)

  • Installed supabase-groonga as a separate Nix package
  • Explicitly set the GRN_PLUGINS_DIR environment variable pointing to /var/lib/postgresql/.nix-profile/lib/groonga/plugins
  • This modular approach ensured groonga plugins were properly located

Dockerfile Approach (Incorrect)

  • Relied on groonga/pgroonga being bundled within the main postgres Nix package
  • Did not set the GRN_PLUGINS_DIR environment variable
  • This could lead to runtime issues where pgroonga extension cannot locate groonga plugins

Changes

Files Modified

  • Dockerfile-15
  • Dockerfile-17
  • Dockerfile-orioledb-17

What Was Changed

For each Dockerfile:

  1. Added dedicated groonga build stage (after the walg stage):

    ####################
    # setup-groonga
    ####################
    FROM base as groonga
    
    WORKDIR /nixpg
    
    RUN nix profile install .#supabase-groonga && \
        mkdir -p /tmp/groonga-plugins && \
        cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
    
    RUN nix store gc
    
    WORKDIR /
  2. Copy groonga plugins to production image:

    COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
  3. Set GRN_PLUGINS_DIR environment variable:

    ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins

This fix ensures that the pgroonga extension (configured in ansible/files/postgresql_config/supautils.conf.j2) will work correctly in Docker-based deployments, matching the behavior of Ansible-based deployments.

@jfroche jfroche requested review from a team as code owners June 26, 2025 22:35
@jfroche jfroche force-pushed the multi-version-ext/pgroonga branch from 3d4dcb3 to 4849d1b Compare June 26, 2025 22:48
Copy link
Contributor

@hunleyd hunleyd left a comment

Choose a reason for hiding this comment

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

rebase to fix conflicts?

@jfroche jfroche force-pushed the multi-version-ext/pgroonga branch from 4849d1b to 3d18ed9 Compare October 20, 2025 07:49
@samrose samrose force-pushed the multi-version-ext/pgroonga branch 2 times, most recently from a4e51a1 to 3355603 Compare October 24, 2025 16:10
jfroche and others added 4 commits October 24, 2025 17:21
Build multiple versions of the pgroonga extension on different PostgreSQL versions.
Add test for the extensions and their upgrade on PostgreSQL 15 and 17.
Moved sfcgal and mecab-naist-jdic from nix/ext to nix/packages.
@samrose samrose force-pushed the multi-version-ext/pgroonga branch from b5466f0 to 2c75e72 Compare October 24, 2025 21:24
@samrose samrose dismissed hunleyd’s stale review October 24, 2025 21:34

Thanks for your review. rebase was a success. dismissing only to unblock, and approving to merge

@samrose samrose merged commit 52deb6f into develop Oct 25, 2025
14 checks passed
@samrose samrose deleted the multi-version-ext/pgroonga branch October 25, 2025 01:06
hunleyd added a commit that referenced this pull request Oct 27, 2025
* origin/develop:
  chore: add our substituter config to flake.nix (#1839)
  refactor: improve test harness logging and error handling (#1834)
  feat: support multiple versions of the pgroonga extension (#1677)
  refactor(ansible): bring our ansible up to modern ansible-lint standards (#1862)
  fix: bump version for new release (#1860)
encima pushed a commit that referenced this pull request Oct 28, 2025
* feat: support multiple versions of the pgroonga extension

Build multiple versions of the pgroonga extension on different PostgreSQL versions.
Add test for the extensions and their upgrade on PostgreSQL 15 and 17.

* refactor(nix): make sure ext contains only extensions

Moved sfcgal and mecab-naist-jdic from nix/ext to nix/packages.

* feat: resolve a few issues with tests and integration with tooling

* fix: make sure that docker image has full/correct groonga/pgroonga handling

* chore: bump version to release

---------

Co-authored-by: Sam Rose <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants