cmccambridge / mosquitto-unraid

Docker container for eclipse-mosquitto with unRAID ease-of-use tweaks
19 stars 7 forks source link

Timezone is ignored #26

Closed askibit closed 2 years ago

askibit commented 2 years ago

Thanks for this great container! I use it in Unraid via Community Applications and have added the following in the conf to get a formatted time in the log: log_timestamp_format %Y-%m-%dT%H:%M:%S

Here is the command generated by Unraid (including the TZ variable):

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='mosquitto' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e 'RUN_INSECURE_MQTT_SERVER'='0' -p '1883:1883/tcp' -p ':8883/tcp' -p ':9001/tcp' -v '/mnt/user/appdata/mosquitto':'/mosquitto/config':'rw' -v '/mnt/user/appdata/mosquitto/data':'/mosquitto/data':'rw' -v '/mnt/user/appdata/mosquitto/log':'/mosquitto/log':'rw' 'cmccambridge/mosquitto-unraid:latest' 9f46f4e8c1b6bfaceefb9c21bdd5930dbca0c9db837c403cf3d7c0cf0f8bb6d2

Apparently, however, the passed timezone is ignored in the container, since the log entries show UTC timezone and also the date command shows UTC:

image

Can you please fix this? :)

greetings Andreas

cmccambridge commented 2 years ago

Nice find @askibit! Fixing this with #29. The stock mosquitto image does not include tzdata, so it can't resolve timezones from the TZ environment variable. (Ref: https://github.com/eclipse/mosquitto/issues/1898)

I'm adding tzdata to the mosquitto-unraid image since this image is focused on ease of usability. I have further added testing to ensure that it stays fixed, using a similar customized log_timestamp_format as in your use case.

cmccambridge commented 2 years ago

@askibit Could you try the :latest build with your same configuration and confirm that this resolves the issue for you? Thanks!

askibit commented 2 years ago

I have updated the container and confirm that the timezone is now displayed correctly. Thank you very much! 👍