Skip to content

Conversation

@mnagy
Copy link
Contributor

@mnagy mnagy commented Mar 19, 2015

It is based on the MySQL image and works similarly. You must set
POSTGRESQL_{USER,PASSWORD,DATABASE} environment variables and can
optionally set the 'postgres' db user password using the
POSTGRESQL_ADMIN_PASSWORD variable.

There are few minor outstanding issues that are marked and commented
with a TODO. Ideas and suggestions would be appreciated.

You can test the image with make test && make test TARGET=rhel7.

Documentation in README is still missing, but wanted early feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A note about USER. We run this as root, but only thing that really requires root privileges is this chown. I would love to run the whole entrypoint as user postgres. However, we would have to make sure the volume is owned by the postgres user (uid 26).

Any ideas if this is possible?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not chown in Dockerfile then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope if you have mounted volume $PGDATA.

@mnagy mnagy force-pushed the initial branch 2 times, most recently from e368cf4 to a38a2c4 Compare March 19, 2015 18:57
@mnagy
Copy link
Contributor Author

mnagy commented Mar 19, 2015

Addressed all issues plus something extra :) PTAL

Copy link
Contributor

Choose a reason for hiding this comment

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

this needs to be tuneable via env var... why is default not enough? can't you set this in postgres config file instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, will fix that tomorrow so LANG can be overridden. I might, but setting the LANG var is the simplest way to do it, I didn't see any reason to modify config file because of it. Btw, it mostly affects initdb. And yeah, the default is probably faster a bit, but without utf support, at least that's how I understand it.

@mfojtik
Copy link
Contributor

mfojtik commented Mar 19, 2015

LGTM. Nice job @mnagy, kudos!

@mnagy
Copy link
Contributor Author

mnagy commented Mar 20, 2015

Some enhancements:
No further need to use scl when doing docker exec, added contrib directory. Added tests for env variable validations, simplified that code a bit as well. PTAL.

@mnagy
Copy link
Contributor Author

mnagy commented Mar 22, 2015

Very small change added. We're now also validating maximum user/db name length. Also added tests for that.

@mnagy
Copy link
Contributor Author

mnagy commented Mar 22, 2015

@jhadvig @soltysh can I get more reviews in addition to @mfojtik's, please?

Copy link
Contributor

Choose a reason for hiding this comment

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

could you maybe do the function declaration in this file more consistent with the test/run script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. PTAL

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Even more, can you add that to all our images 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soltysh For mysql, see sclorg/mysql-container#24
For MongoDB, @jhadvig will do that. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

many kudos @mnagy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soltysh thanks :) I'd also appreciate a certain four-letter acronym :P

@mnagy
Copy link
Contributor Author

mnagy commented Mar 23, 2015

Added SCL info into README.md, few minor fixes. PTAL

@soltysh
Copy link
Contributor

soltysh commented Mar 23, 2015

Here's mine LGTM :)

@jhadvig
Copy link
Contributor

jhadvig commented Mar 23, 2015

@mnagy LGTM, good job :)
Merging

jhadvig added a commit that referenced this pull request Mar 23, 2015
Add PosgreSQL 9.2 image
@jhadvig jhadvig merged commit 15a0f91 into sclorg:master Mar 23, 2015
Copy link
Contributor

Choose a reason for hiding this comment

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

This uses PASS and USER as global variables, so we're never actually testing the access of the admin user...

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you open a bug report against this repo, so it doesn't get forgotten?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was wrong. In fact, what happens is that assert_login_access shadows USER and PASS with local variables of the same name, and because in bash local variables are visible in the scope of a function and its children, postgresql_cmd eventually uses those local variables when called from within assert_login_access.

Needless to say, that's very very error prone and hard to reason about...

praiskup added a commit to praiskup/postgresql-container that referenced this pull request Nov 7, 2016
pkubatrh added a commit to pkubatrh/postgresql-container that referenced this pull request Nov 14, 2016
pkubatrh added a commit to pkubatrh/postgresql-container that referenced this pull request Jan 30, 2017
pkubatrh added a commit to pkubatrh/postgresql-container that referenced this pull request Mar 14, 2017
pkubatrh added a commit to pkubatrh/postgresql-container that referenced this pull request Apr 19, 2017
hhorak pushed a commit that referenced this pull request Jul 21, 2023
Turn pipefail option off to not change behaviour beyond the function scope
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.

5 participants