Skip to content

Conversation

@samrose
Copy link
Collaborator

@samrose samrose commented Oct 23, 2025

Fix Groonga/PGroonga Installation in Dockerfiles

Summary

This Draft PR 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

Testing Recommendations

  • Build all three Dockerfiles successfully
  • Verify pgroonga extension loads without errors
  • Test creating pgroonga indexes
  • Verify GRN_PLUGINS_DIR environment variable is set correctly in running containers
  • Ensure groonga plugins are accessible at /usr/lib/groonga/plugins

Related

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.

@samrose samrose requested a review from sweatybridge October 23, 2025 14:35
@samrose samrose marked this pull request as ready for review October 24, 2025 14:32
@samrose samrose requested review from a team as code owners October 24, 2025 14:32
@samrose samrose force-pushed the docker-image-pgroonga branch from 8845baf to 8cdea03 Compare October 24, 2025 18:09
@samrose samrose force-pushed the docker-image-pgroonga branch from 8cdea03 to 826ed08 Compare October 24, 2025 18:10
@samrose
Copy link
Collaborator Author

samrose commented Oct 24, 2025

closed in favor of #1677 added docker work to that to roll out all at once

@samrose samrose closed this Oct 24, 2025
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.

3 participants