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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bci_build/package/postgres/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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.


**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"?


## Environment variables

The PostgreSQL image uses several environment variables to configure the database initialization.
Expand Down