Skip to content

Check that vol actually contains DB files, as opposed to a non-empty dir. #72

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

Merged
merged 2 commits into from
Jul 20, 2015

Conversation

bakavic
Copy link
Contributor

@bakavic bakavic commented Jul 14, 2015

Part of fix for mounting persistent disks on Google Cloud Compute containers - fresh disks have a lost+found directory, causing the old check to fail with

postgres cannot access the server configuration file "/var/lib/postgresql/data/postgresql.conf"

The second part of the fix requires the GCE user to adjust PGDATA to a subdirectory within the mounted persistent disk. If the initdb command is run directly on the mount point root, it fails, complaining that it is bad practice to have the database there. Reference thread.

The notice to adjust PGDATA should be in the docs for postgres-docker.

I feel we should not make it mandatory for PGDATA to auto-create a subdirectory at all VOLUME mountpoints, as the mounted point might already be a subdirectory in the host system.

@yosifkit
Copy link
Member

Since we are only checking for the one file, we no longer need ls and can check that it has size too:

- if [ -z "$(ls -A "$PGDATA"/PG_VERSION)" ]; then
+ if [ -s "$PGDATA/PG_VERSION" ]; then

@bakavic
Copy link
Contributor Author

bakavic commented Jul 18, 2015

@yosifkit Ah true. Changed! :)

@yosifkit
Copy link
Member

LGTM

1 similar comment
@tianon
Copy link
Member

tianon commented Jul 20, 2015

LGTM

tianon added a commit that referenced this pull request Jul 20, 2015
Check that vol actually contains DB files, as opposed to a non-empty dir.
@tianon tianon merged commit 28b8bd7 into docker-library:master Jul 20, 2015
tianon added a commit to infosiftr/stackbrew that referenced this pull request Jul 21, 2015
- `logstash`: 1.5.3
- `mariadb`: switch 10.0 to jessie (MariaDB/mariadb-docker#17)
- `mongo`: 3.1.6
- `postgres`: use `PG_VERSION` instead of just empty directory for "database detection" (docker-library/postgres#72)
RichardScothern pushed a commit to RichardScothern/official-images that referenced this pull request Jun 14, 2016
- `logstash`: 1.5.3
- `mariadb`: switch 10.0 to jessie (MariaDB/mariadb-docker#17)
- `mongo`: 3.1.6
- `postgres`: use `PG_VERSION` instead of just empty directory for "database detection" (docker-library/postgres#72)
anthr76 added a commit to anthr76/infra that referenced this pull request May 3, 2021
docker-library/postgres#72

Signed-off-by: anthr76 <hello@anthonyrabbito.com>
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