gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
11.01k stars 619 forks source link

How to set timezone for Gotify in Docker #274

Closed eltiel closed 4 years ago

eltiel commented 4 years ago

Have you read the documentation?

You are setting up gotify in

Describe your problem I ran the official Docker image with TZ environment variable but it seems to have no effect. Timezone remains at GMT+0.

Any errors, logs, or other information that might help us identify your problem I can tell the timezone does not match by going through the log timestamps via the Android app.

jmattheis commented 4 years ago

Does this result in any problems?

eltiel commented 4 years ago

Not a real problem. It's just a bit more difficult to read the logs as the time is not in sync.

jmattheis commented 4 years ago

The fix will be included in the next release.

jokay commented 4 years ago

Does this result in any problems?

On hover of the time ago on the server the effective time is shown in GMT+0 as well.

eltiel commented 4 years ago

I tested 2.0.15 but TZ still doesn't seem to do anything. Has anyone gotten it to work?

Correction: I now notice that the effective time is in the specified timezone, but it only applies to new messages. It was not retroactively applied to the old ones. Not saying it's a problem, it's not at all. I just thought TZ wasn't working because of this.

However, server logs are still in GMT+0.

jmattheis commented 4 years ago

For me TZ has an effect on server logs.

$ date
Tue 05 May 2020 07:03:18 PM CEST

$ docker run --rm -it -p 8080:80 gotify/server:2.0.15
Starting Gotify version 2.0.15@2020-04-26-12:01:05
Started Listening for plain HTTP connection on :80
[GIN] 2020/05/05 - 17:03:24 | 200 |     286.811µs |      172.17.0.1 | GET      /version

$ docker run --rm -it -e TZ="Europe/Berlin" -p 8080:80 gotify/server:2.0.15
Starting Gotify version 2.0.15@2020-04-26-12:01:05
Started Listening for plain HTTP connection on :80
[GIN] 2020/05/05 - 19:03:31 | 200 |      105.34µs |      172.17.0.1 | GET      /version
jokay commented 4 years ago

For me TZ works as well ...

  ...
  environment:
    - TZ=Europe/Zurich
  ...

results in the following inside the container ...

docker exec gotify_app_1 date
Tue May  5 19:10:33 CEST 2020

and on hover on the UI works too ...

homematic

eltiel commented 4 years ago

I'm seeing the logs through the Android app 2.0.11.

IMG_20200506_012946

You can see that the new messages received are in +8 but the log entry timestamp itself is +0

jmattheis commented 4 years ago

This issue is only about the logs inside the docker container. Not in android.

eltiel commented 4 years ago

This issue is only about the logs inside the docker container. Not in android.

OK. I guess I wrongly assumed that the logs are pulled from the server to begin with.