mmornati / docker-ghostblog

Ghost Blog Docker Container
MIT License
10 stars 6 forks source link

The ghost logs should display the real local time #15

Closed pascalandy closed 6 years ago

pascalandy commented 6 years ago

I tested to use tzdata on the final build.

RUN apk update && apk upgrade                               && \
    apk add --no-cache tzdata          && \
    cp /usr/share/zoneinfo/America/New_York /etc/localtime  && \
    echo "America/New_York" > /etc/timezone                 && \
    apk del tzdata                                          && \
    rm -rf /var/cache/apk/*

when I type date in the container, my local time is right.

But for some reason, the time on the logs from Ghost are not right. Any ideas?

P.S. I have to re-test using node:8!

pascalandy commented 6 years ago

My last built using node:8.9.1

I setup at New-York time but the logs show 5 hours further.

docker logs ghostUAT

➜  ghost-dev docker logs ghostUAT
=> Change config based on ENV parameters:
========================================================================
      WEB_URL:        http://localhost:2368
========================================================================
Database already exists. Executing migration (if needed)
[2017-11-15 00:05:49] INFO Finished database migration!
[2017-11-15 00:05:51] INFO Ghost is running in production...
[2017-11-15 00:05:51] INFO Your blog is now available on http://localhost:2368/
[2017-11-15 00:05:51] INFO Ctrl+C to shut down
[2017-11-15 00:05:51] INFO Ghost boot 1.296s
INFO [2017-11-15 00:06:01] "GET /contact/" 200 1807ms
INFO [2017-11-15 00:06:01] "GET /public/ghost-sdk.min.js?v=147205e9c5" 200 7ms

date

➜ ghost-dev docker exec -it ghostUAT sh /var/lib/ghost $ date Tue Nov 14 19:11:51 EST 2017

pascalandy commented 6 years ago

Oh !! I guess we need to install tzdata in the builder container as well! EDIT ... and set the local time

mmornati commented 6 years ago

Yes maybe. I was looking documentation on this point yesterday evening but I found nothing interesting.

I think the tzdata package is required but we need to test. I'll try to propose you something later during the day.

On Nov 15, 2017 01:13, "Pascal Andy" notifications@github.com wrote:

Oh !! I guess we need to install tzdata in the builder container as well!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mmornati/docker-ghostblog/issues/15#issuecomment-344443557, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIgO-lVQO0eWlNa_xGZ9GyAtrVwS5txks5s2iyYgaJpZM4QeG1k .

pascalandy commented 6 years ago

Same issue when I setup my local time in the builder image.

pascalandy commented 6 years ago

Same result

Last login: Wed Nov 15 19:20:52 on ttys002
➜  ~ docker exec -it ghostUAT sh
/var/lib/ghost $ date
Wed Nov 15 21:03:47 EST 2017
/var/lib/ghost $ exit
➜  ~ docker logs ghostUAT
=> Change config based on ENV parameters:
========================================================================
      WEB_URL:        http://localhost:2368
========================================================================
Database already exists. Executing migration (if needed)
[2017-11-16 02:02:42] INFO Finished database migration!
mmornati commented 6 years ago

With the latest changes you have to add -e TZ=America/New York or something like that, to set your time zone. I tested with date and it was working, but I didn't check the result in the ghost log. Maybe there is something else to set for ghost

pascalandy commented 6 years ago

In my dockerfile I used TZ="America/New_York".

mmornati commented 6 years ago

This is what I have just executing the date schermata 2017-11-16 alle 20 58 19

mmornati commented 6 years ago

I think the problem is linked with all the things discussed here: https://github.com/TryGhost/Ghost/issues/1265

pascalandy commented 6 years ago

I guess you're right. Let's drop this. Thanks for the reference!