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

Move and configure lib directories #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Move and configure lib directories #98

wants to merge 1 commit into from

Conversation

theory
Copy link
Contributor

@theory theory commented Mar 10, 2025

Instead of OS-specific and Postgres version-specific lib directories, just have mod for Postgres extension module files and lib for shared libraries they depend on. For example, the pgsql_http extension's http.so file would be installed in mod and its dependency, libcurl, in lib. Both remain part of the postgres binary's runpath:

# chrpath -l $(which postgres)
/usr/lib/postgresql/bin/postgres: RUNPATH=/usr/lib/postgresql/lib:/var/lib/postgresql/tembo/mod:/var/lib/postgresql/tembo/lib

While at it, remove LLVM, Python, Tcl, and Perl from the base image, eliminating around 180MB from the image size. LLVM is not needed on the image, and the dynamic language libraries only needed if their accompanying extensions are installed; we'll want to install them when their extensions are installed.

Update docker-entrypoint.sh to add /var/lib/postgresql/tembo/mod to the dynamic_library_path, so that Postgres can find extension modules there. Control files will need $libdir/ stripped from module_pathname for this to work, a change likely to be included in Postgres 18 but we'll have to do when installing extensions there.

Other changes:

  • Fix workflow push on main an move a couple of Dockerfile items around.
  • Update the image URLs and directory descriptions the READMEs.

@theory theory requested a review from nhudson March 10, 2025 20:57
@theory theory self-assigned this Mar 10, 2025
@theory theory changed the title Fix workflow push on main (#98) Fix workflow push on main Mar 10, 2025
Instead of OS-specific and Postgres version-specific `lib` directories,
just have `mod` for Postgres extension module files and `lib` for shared
libraries they depend on. For example, the `pgsql_http` extension's
`http.so` file would be installed in `mod` and its dependency,
`libcurl`, in `lib`. Both remain part of the `postgres` binary's
runpath:

```console
/usr/lib/postgresql/bin/postgres: RUNPATH=/usr/lib/postgresql/lib:/var/lib/postgresql/tembo/mod:/var/lib/postgresql/tembo/lib
```

While at it, remove LLVM, Python, Tcl, and Perl from the base image,
eliminating around 180MB from the image size. LLVM is not needed on the
image, and the dynamic language libraries only needed if their
accompanying extensions are installed; we'll want to install them when
their extensions are installed.

Update `docker-entrypoint.sh` to add `/var/lib/postgresql/tembo/mod` to
the `dynamic_library_path`, so that Postgres can find extension modules
there. Control files will need `$libdir/` stripped from
`module_pathname` for this to work, a change likely to be included in
Postgres 18 but we'll have to do when installing extensions there.

Other changes:

*   Fix workflow push on main an move a couple of `Dockerfile` items around.
*   Update the image URLs and directory descriptions the READMEs.
@theory theory changed the title Fix workflow push on main Move and configure lib directories Mar 11, 2025
@theory theory requested a review from nhudson March 11, 2025 19:23
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.

2 participants