-
Notifications
You must be signed in to change notification settings - Fork 27
Replace entrypoint, avoiding server startup in utility container #2
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
Conversation
hartmut-co-uk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks, looks good to me - though I'm currently not actively using this anywhere so I can't actually test E2E.
Please have a look at the inline comment.
README.md
Outdated
| ### run (example) | ||
|
|
||
| docker run -e PGPASSWORD=supersecure -it --rm hartmut-co-uk/pg-repack-docker pg_repack -h localhost -U dbroot --dbname=dbname --dry-run --table=table1 --only-indexes --no-superuser-check | ||
| docker run -it --rm hartmut-co-uk/pg-repack-docker -h localhost -U dbroot --dbname=dbname --dry-run --table=table1 --only-indexes --no-superuser-check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the example on how to set the password?
Any particular reason or better alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped the example because the change to the entrypoint avoids the containers default postgres startup which fails for me without the password set. This allows pg_repack to prompt for the password. It occurs to me that pg_repack might pick up the password from the environment variable though, so I could go either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you also be able to test by any chance?
The use case I've had back then for a client was 'scripted' with a cron job - so it was quite essential to not have a prompt.. so I'd like to keep the example for reference.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and adjusted the README to include the password-via-environment and also added --network=host on the assumption that one is probably trying to connect to a database on the local development machine when referencing localhost. It does work for me. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invariably, my local db has a difference version pf pg_repack and I get this:
ERROR: pg_repack failed with error: pg_repack 1.4.3 is not installed in the database
In my opinion the primary utility of this container is that pg_repack is very very picky about alignment between postgres and pg_repack versions, and on a normal client machine it can be pretty tricky to get all the right versions worked out to be able to call pg_repack on a server. The docker container locks all that down so it works consistently.
|
Quick note: after further consideration I've rolled back the |
|
Many thanks for the contribution! |
|
Looks good. The issue I ran into is that even when running pg_repack it will try to start postgres, since it's in the entrypoint. This will fail if you don't have PGPASSWORD set because it can't initialize the postgres server. Perhaps the solution is to add a note to the README indicating the necessity? |
No description provided.