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

Add Postgres volume notes #1687

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

Add Postgres volume notes #1687

wants to merge 1 commit into from

Conversation

alexandrevicenzi
Copy link
Member

initdb requires the volume location to be empty, otherwise it fails to create a new database.

These notes are due to bsc#1230393.

initdb requires the volume location to be empty, otherwise it fails to
create a new database.

These notes are due to bsc#1230393.
dcermak pushed a commit that referenced this pull request Sep 17, 2024
dcermak pushed a commit that referenced this pull request Sep 17, 2024
dcermak pushed a commit that referenced this pull request Sep 17, 2024
dcermak pushed a commit that referenced this pull request Sep 17, 2024
Copy link

github-actions bot commented Sep 17, 2024

Created a staging project on OBS for 7: home:defolos:BCI:Staging:SLE-15-SP7:7-1687
Changes pushed to branch 7-1687 as commit 2aa9b336d9f72818fb98678fc98b42cdf9084e75
Build succeeded ✅

Build Results

Repository images in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for s390x: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for s390x: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP7:7-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Build succeeded ✅

To run BCI-tests against this PR, use the following command:

OS_VERSION=15.7 TARGET=custom BASEURL=registry.opensuse.org/home/defolos/bci/staging/sle-15-sp7/7-1687/ tox -- -n auto
The following images can be pulled from the staging project:
  • registry.opensuse.org/home/defolos/bci/staging/sle-15-sp7/7-1687/containerfile/suse/postgres:latest

Copy link

github-actions bot commented Sep 17, 2024

Created a staging project on OBS for 5: home:defolos:BCI:Staging:SLE-15-SP5:5-1687
Changes pushed to branch 5-1687 as commit a0f35bfdc0bb3315379a8096dd7c83fc69607ae8
Build succeeded ✅

Build Results

Repository images in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-15-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-15-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for s390x: current state: published
Build results:

package name status build log
postgres-15-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-15-image ⛔ excluded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-15-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-15-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for s390x: current state: published
Build results:

package name status build log
postgres-15-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP5:5-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-15-image ✅ succeeded live log

Build succeeded ✅

To run BCI-tests against this PR, use the following command:

OS_VERSION=15.5 TARGET=custom BASEURL=registry.opensuse.org/home/defolos/bci/staging/sle-15-sp5/5-1687/ tox -- -n auto
The following images can be pulled from the staging project:
  • registry.opensuse.org/home/defolos/bci/staging/sle-15-sp5/5-1687/containerfile/suse/postgres:15

Copy link

github-actions bot commented Sep 17, 2024

Created a staging project on OBS for 6: home:defolos:BCI:Staging:SLE-15-SP6:6-1687
Changes pushed to branch 6-1687 as commit fdd53b9fb7dbefca3dbfbe16852ef540b5ab4546
Build succeeded ✅

Build Results

Repository images in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for s390x: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-16-image ⛔ excluded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for x86_64: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for aarch64: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for s390x: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:SLE-15-SP6:6-1687 for ppc64le: current state: published
Build results:

package name status build log
postgres-16-image ✅ succeeded live log

Build succeeded ✅

To run BCI-tests against this PR, use the following command:

OS_VERSION=15.6 TARGET=custom BASEURL=registry.opensuse.org/home/defolos/bci/staging/sle-15-sp6/6-1687/ tox -- -n auto
The following images can be pulled from the staging project:
  • registry.opensuse.org/home/defolos/bci/staging/sle-15-sp6/6-1687/containerfile/suse/postgres:latest

@alexandrevicenzi
Copy link
Member Author

Because /var/lib/pgsql/data is a volume, we can't mount a volume to /var/lib/pgsql as it won't sync. Is there a way around this? Should we change this volume?

Copy link

github-actions bot commented Sep 17, 2024

Created a staging project on OBS for Tumbleweed: home:defolos:BCI:Staging:Tumbleweed:Tumbleweed-1687
Changes pushed to branch Tumbleweed-1687 as commit 50aa59e724e76731859c5bd46efdcd05647e7486
Build succeeded ✅

Build Results

Repository images in home:defolos:BCI:Staging:Tumbleweed:Tumbleweed-1687 for x86_64: current state: published
Build results:

package name status build log
apache-tomcat-10-java-17-image ⛔ excluded live log
apache-tomcat-10-java-21-image ⛔ excluded live log
apache-tomcat-10-java-22-image ⛔ excluded live log
apache-tomcat-9-java-17-image ⛔ excluded live log
postfix-image ⛔ excluded live log
postgres-12-image ⛔ excluded live log
postgres-13-image ⛔ excluded live log
postgres-14-image ⛔ excluded live log
postgres-15-image ⛔ excluded live log
postgres-16-image ⛔ excluded live log

Repository images in home:defolos:BCI:Staging:Tumbleweed:Tumbleweed-1687 for aarch64: current state: published
Build results:

package name status build log
apache-tomcat-10-java-17-image ⛔ excluded live log
apache-tomcat-10-java-21-image ⛔ excluded live log
apache-tomcat-10-java-22-image ⛔ excluded live log
apache-tomcat-9-java-17-image ⛔ excluded live log
postfix-image ⛔ excluded live log
postgres-12-image ⛔ excluded live log
postgres-13-image ⛔ excluded live log
postgres-14-image ⛔ excluded live log
postgres-15-image ⛔ excluded live log
postgres-16-image ⛔ excluded live log

Repository containerfile in home:defolos:BCI:Staging:Tumbleweed:Tumbleweed-1687 for x86_64: current state: published
Build results:

package name status build log
apache-tomcat-10-java-17-image ✅ succeeded live log
apache-tomcat-10-java-21-image ✅ succeeded live log
apache-tomcat-10-java-22-image ✅ succeeded live log
apache-tomcat-9-java-17-image ✅ succeeded live log
postfix-image ✅ succeeded live log
postgres-12-image ✅ succeeded live log
postgres-13-image ✅ succeeded live log
postgres-14-image ✅ succeeded live log
postgres-15-image ✅ succeeded live log
postgres-16-image ✅ succeeded live log

Repository containerfile in home:defolos:BCI:Staging:Tumbleweed:Tumbleweed-1687 for aarch64: current state: published
Build results:

package name status build log
apache-tomcat-10-java-17-image ✅ succeeded live log
apache-tomcat-10-java-21-image ✅ succeeded live log
apache-tomcat-10-java-22-image ✅ succeeded live log
apache-tomcat-9-java-17-image ✅ succeeded live log
postfix-image ✅ succeeded live log
postgres-12-image ✅ succeeded live log
postgres-13-image ✅ succeeded live log
postgres-14-image ✅ succeeded live log
postgres-15-image ✅ succeeded live log
postgres-16-image ✅ succeeded live log

Build succeeded ✅

To run BCI-tests against this PR, use the following command:

OS_VERSION=tumbleweed TARGET=custom BASEURL=registry.opensuse.org/home/defolos/bci/staging/tumbleweed/tumbleweed-1687/ tox -- -n auto
The following images can be pulled from the staging project:
  • registry.opensuse.org/home/defolos/bci/staging/tumbleweed/tumbleweed-1687/containerfile/opensuse/apache-tomcat:latest
  • registry.opensuse.org/home/defolos/bci/staging/tumbleweed/tumbleweed-1687/containerfile/opensuse/postfix:latest
  • registry.opensuse.org/home/defolos/bci/staging/tumbleweed/tumbleweed-1687/containerfile/opensuse/postgres:latest

@dirkmueller
Copy link
Member

just wondering, there's no way around this limitation? seems like easy enough to fix in initdb

@alexandrevicenzi
Copy link
Member Author

just wondering, there's no way around this limitation? seems like easy enough to fix in initdb

There's a check hardcoded that is over 10y old in the code that you can see here.

In theory, removing this check should fix it, but I believe it is there for a reason.

@@ -24,6 +24,10 @@ $ podman run -it --rm -p 5432:5432 -e POSTGRES_PASSWORD=my-password -v /path/to/

PostgreSQL data directory location.

**Note 1:** `initdb` requires this location to be empty to create a new database.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Note 1:** `initdb` requires this location to be empty to create a new database.
**Note 1:** The directory must be empty for `initdb` to create a new database.

@@ -24,6 +24,10 @@ $ podman run -it --rm -p 5432:5432 -e POSTGRES_PASSWORD=my-password -v /path/to/

PostgreSQL data directory location.

**Note 1:** `initdb` requires this location to be empty to create a new database.

**Note 2:** If the volume points to a file system mount point, a remote folder that can't be chowned to the `postgres` user, or a location that already contains files (including `lost+found` and dotfiles), a new subdirectory must be created within the select storage method to contain the PostgreSQL data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Note 2:** If the volume points to a file system mount point, a remote folder that can't be chowned to the `postgres` user, or a location that already contains files (including `lost+found` and dotfiles), a new subdirectory must be created within the select storage method to contain the PostgreSQL data.
**Note 2:** If the volume points either to a file system mount point, a remote folder that cannot be owned by the `postgres` user, or a location that already contains files (including `lost+found` and dotfiles), a new subdirectory for storing the PostgreSQL data must be created within the selected storage method.

Copy link
Contributor

Choose a reason for hiding this comment

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

within the selected storage method sounds strange to me. Can you really create a subdir within a storage method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Within in this case is inside, switching to inside sounds odd to me:

a new subdirectory for storing the PostgreSQL data must be created inside the selected storage method.

The issue in note 2 is the following:

  • Inside the container all PSQL sees is a folder, PSQL is unaware that this is a volume and neither what is behind this volume
  • PSQL can't use the current folder because it has some issue (e.g. not empty location)
  • For PSQL, the solution is to mount something as in PGDATA
  • For the user, one solution is to create a new sub folder in the volume they are trying to use

The idea here is to document that certain things can't be used as PGDATA, we don't really need to provide the solution, as the solution could vary per setup.

The upstream Docker Hub image uses a similar text.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dmpop does my previous message explains within?

Copy link
Member

Choose a reason for hiding this comment

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

can we simply say "within the PGDATA volume"?

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