-
Notifications
You must be signed in to change notification settings - Fork 576
Conversation
db/Dockerfile
Outdated
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
RUN apk add --no-cache --virtual .build-deps \ | ||
curl \ |
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 know I sound maniac, but can you order package list in alphabetical order please (like it was before) ? It is a good practice :)
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.
fix
I just test it on my test server and my production server, it works perfect :) I also add @xcompass as reviewer. I like to have his wise feedback on change like this. |
@pichouk I also do not have the opportunity to check how Wal-e works ( |
db/entrypoint.sh
Outdated
@@ -20,6 +16,8 @@ function update_conf () { | |||
sed -i "s/wal_level =.*$/wal_level = $WAL_LEVEL/g" $PGDATA/postgresql.conf | |||
sed -i "s/archive_mode =.*$/archive_mode = $ARCHIVE_MODE/g" $PGDATA/postgresql.conf | |||
sed -i "s/archive_timeout =.*$/archive_timeout = $ARCHIVE_TIMEOUT/g" $PGDATA/postgresql.conf | |||
sed -i "s/log_timezone =.*$/log_timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf | |||
sed -i "s/timezone =.*$/timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf |
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.
Just an indentation mistake here :)
db/entrypoint.sh
Outdated
@@ -46,6 +48,9 @@ if [ "$1" = 'postgres' ]; then | |||
|
|||
WAL_LEVEL=archive | |||
ARCHIVE_MODE=on | |||
|
|||
echo "log_timezone = $DEFAULT_TIMEZONE" >> $PGDATA/postgresql.conf |
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 guess the $PGDATA
folder should be a mounted volume, so data inside it are persistent. So it seems that everytime the container restart it will add two new lines inside the postgresql.conf
file. Am I right ? If true this is not a correct behavior, but I don't know a correct workaround for this.
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.
yes, right. this fixes errors:
invalid value for parameter "log_timezone": "localtime"
invalid value for parameter "TimeZone": "localtime"
configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
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.
Ok, but this is not ok if our container just append lines to a persistent configuration file at each restart.
I tried to reproduce the errors you show, but it seems that it didn't happen if you mount /etc/localtime
inside the container like we do on our docker-compose.yml
file
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.
Oups I just see that you can remove those two lines since you add this :
sed -i "s/log_timezone =.*$/log_timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf
sed -i "s/timezone =.*$/timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf
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.
On RancherOS if there is not this line there will be errors that I sent above. Delete echo "log_timezone = $DEFAULT_TIMEZONE" >> $PGDATA/postgresql.conf ?
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 think the sed
commands you add should fix it. Can you try without the two following echo
instructions please ?
echo "log_timezone = $DEFAULT_TIMEZONE" >> $PGDATA/postgresql.conf
echo "timezone = $DEFAULT_TIMEZONE" >> $PGDATA/postgresql.conf
If there is still errors, we'll have to investigate on another way to fix it.
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.
RancherOS not work, if you delete :(
echo "log_timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
echo "timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
Log:
25.11.2017 19:25:38LOG: invalid value for parameter "log_timezone": "localtime"
25.11.2017 19:25:38LOG: invalid value for parameter "TimeZone": "localtime"
25.11.2017 19:25:38FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors```
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.
delete ?
this
sed -i "s/log_timezone =.*$/log_timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf
sed -i "s/timezone =.*$/timezone = $DEFAULT_TIMEZONE/g" $PGDATA/postgresql.conf
without it
echo "log_timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
echo "timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
does not work
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 think the correct workaround can be:
- check (using
grep
) iftimezone =
andlog_timezone =
are already present in the file - if yes, use
sed
to set the value - if not, append the configuration lines using
echo >>
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.
Or you could remove the timezone and log_timezone lines first and then append them:
sed -i "s/log_timezone =.*$//g" $PGDATA/postgresql.conf
sed -i "s/timezone =.*$//g" $PGDATA/postgresql.conf
echo "log_timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
echo "timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
TODO/reminder before validating this PR:
|
test WALE_S3, not work
|
Hmm seems that it is an issue with |
WAL-E not support Alpine :( |
Arf... What made you say that ? |
db/Dockerfile
Outdated
|
||
&& pip --no-cache-dir install 'wal-e<1.0.0' \ | ||
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/* \ | ||
&& apk del .build-deps |
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.
here you removed tzdata
. Isn't it being used for timezone info for postgres later when user sets timezone? And I think the same for ca-certificates
, pv
, py-cffi
and py-cryptography
. They are not build dependencies but runtime dependencies.
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.
fix, py-cryptography - without it does not work
db/entrypoint.sh
Outdated
@@ -46,6 +48,9 @@ if [ "$1" = 'postgres' ]; then | |||
|
|||
WAL_LEVEL=archive | |||
ARCHIVE_MODE=on | |||
|
|||
echo "log_timezone = $DEFAULT_TIMEZONE" >> $PGDATA/postgresql.conf |
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.
Or you could remove the timezone and log_timezone lines first and then append them:
sed -i "s/log_timezone =.*$//g" $PGDATA/postgresql.conf
sed -i "s/timezone =.*$//g" $PGDATA/postgresql.conf
echo "log_timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
echo "timezone = $ DEFAULT_TIMEZONE" >> $ PGDATA / postgresql.conf
db/Dockerfile
Outdated
&& apt-get install -y \ | ||
build-essential \ | ||
RUN apk add --no-cache --virtual .build-deps \ | ||
bash \ |
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 think we can remove this as we are aiming for smaller image.
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.
👍 But then we need to use #/bin/sh
for the entrypoint.sh
script. Should test if it also works OK with sh
.
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.
not work
03.12.2017 1:24:49/entrypoint.sh: line 29: syntax error: unexpected "(" (expecting "fi")
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.
The entrypoint script need some rewrite to work with sh
. But I think we can achieve this.
WAL-E, not work to alpine(
|
About the WAL-E support, I really don't know what to do. I don't use it and I don't really know why it didn't work on Alpine. I would like to investigate on this, but I have no time for now. I'll see in few days/weeks if I can achieve to something with WAL-E and Alpine. |
I don't think we can use a separate container. I think postgres is actually calling WAL-E script directly. Re: WAL-E error, could you enable WAL-E logging: https://github.com/wal-e/wal-e#logging to see where it fails? Might be a configuration thing. |
Just push some changes which should fix wal-e support. But image is bigger (345MB). |
@pichouk not work( |
Ok I get it. In fact the postgresql configuration file ( |
It should works now :) |
@pichouk Goog work! Work old DataBases and new |
Snap, just tried to deploy it on my existing server and I got this error
Thought it was solved ? |
yes 7ed04e8 |
Seems that you removed it on 321b162 |
af26c88
to
6244f03
Compare
I squashed all commits and tested the image. Seems to works with existing and new databases :) |
@ionbasa I don't understand, this PR is about PostgreSQL image, not App image. I guess you speak about #208 right ? |
@pichouk Yes, I posted in the wrong PR, sorry. |
I guess we can merge now. Thanks a lot @andruwa13 :) |
No description provided.