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

Eliminate need for /tmp/pg_sharedir #1185

Merged
merged 1 commit into from
Mar 12, 2025
Merged

Eliminate need for /tmp/pg_sharedir #1185

merged 1 commit into from
Mar 12, 2025

Conversation

theory
Copy link
Contributor

@theory theory commented Mar 12, 2025

Mount the pgdata volume in the tembo-init container to /var/lib/postgresql/init instead of /var/lib/postgresql/data. This leaves the contents of data from the image in place, and we can simply copy them to init, eliminating the need for the images to have copied data to /tmp/pg_sharedir.

Update init-dirs.sh to make this copy, but switch to cp --recursive --update, which will update files but not delete any other files. This will allow change such as minor Postgres version updates to shared libraries to be copied over, ensuring they're consistent with the version of Postgres from the image.

Remove the /tmp/pg_pkglibdir copy, as well, as it is included in data, and simplify the deletion of
/var/lib/postgresql/data/lost+found (which should not be in any of our images anyway).

@theory theory self-assigned this Mar 12, 2025
Mount the `pgdata` volume in the `tembo-init` container to
`/var/lib/postgresql/init` instead of `/var/lib/postgresql/data`. This
leaves the contents of `data` from the image in place, and we can simply
copy them to `init`, eliminating the need for the images to have copied
data to `/tmp/pg_sharedir`.

Update `init-dirs.sh` to make this copy, but switch to `cp --recursive
--update`, which will update files but not delete any other files. This
will allow change such as minor Postgres version updates to shared
libraries to be copied over, ensuring they're consistent with the
version of Postgres from the image.

Remove the `/tmp/pg_pkglibdir` copy, as well, as it is included in
`data`, and simplify the deletion of
`/var/lib/postgresql/data/lost+found` (which should not be in any of our
images anyway).
@theory theory changed the title Eliminate need for /tmp/pg_sharedir (#1185) Eliminate need for /tmp/pg_sharedir Mar 12, 2025
@theory theory merged commit 8fa4a6a into main Mar 12, 2025
8 checks passed
@theory theory deleted the cp-without-tmp branch March 12, 2025 20:12
theory added a commit to tembo-io/tembo-images that referenced this pull request Mar 12, 2025
Go back to using `/var/lib/postgresql/data` instead of
`/var/lib/postgresql/tembo` because, although it made it compatible with
stock CNPG, it was incompatible with Tembo Cloud, which also relies on
CNPG, so it would never be mounted. It means the image will no longe be
compatible with stock CNPG, sadly, because
`/var/lib/postgresql/data/share` is still the shared directory, and CNPG
will wipe it out when it mounts the `pgdata` volume at
`/var/lib/postgresql/data`.

Also remove the copying of the contents of `/var/lib/postgresql/data` to
`/tmp/pg_sharedir` and `/tmp/pg_pkglibdir` from all images. As of
tembo-io/tembo#1185, the init pod now copies files directly from
`/var/lib/postgresql/data`.
theory added a commit that referenced this pull request Mar 13, 2025
These images include Trunk v0.16.1, which as of #1187 the operator will
require. They also no longer ship with `/tmp/pg_*` directories, since as
of 8fa4a6a (#1185) the operator no longer uses them.
theory added a commit that referenced this pull request Mar 13, 2025
These images include Trunk v0.16.1, which as of #1187 the operator will
require. They also no longer ship with `/tmp/pg_*` directories, since as
of 8fa4a6a (#1185) the operator no longer uses them.

While at it, remove an unnecessary `.to_string()` and the accompanying
linter warning.
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