Time Zone ENV Variable #12

Closed
opened 2025-11-19 07:11:43 -06:00 by GiteaMirror · 18 comments
Owner

Originally created by @blaine07 on GitHub (Mar 23, 2025).

Explore adding variable to define users time zone so that logs can read correct user side time, please?

Originally created by @blaine07 on GitHub (Mar 23, 2025). Explore adding variable to define users time zone so that logs can read correct user side time, please?
Author
Owner

@Lokowitz commented on GitHub (Mar 26, 2025):

If you are using Docker you can mount the volume for localtime and timezone of your host system.

just add this to your compose.yml:

    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
@Lokowitz commented on GitHub (Mar 26, 2025): If you are using Docker you can mount the volume for `localtime `and `timezone` of your host system. just add this to your compose.yml: ``` volumes: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ```
Author
Owner

@blaine07 commented on GitHub (Mar 26, 2025):

If you are using Docker you can mount the volume for localtime and timezone of your host system.

just add this to your compose.yml:

    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

...will that work in Unraid?

@blaine07 commented on GitHub (Mar 26, 2025): > If you are using Docker you can mount the volume for `localtime `and `timezone` of your host system. > > just add this to your compose.yml: > > ``` > volumes: > - /etc/timezone:/etc/timezone:ro > - /etc/localtime:/etc/localtime:ro > ``` ...will that work in Unraid?
Author
Owner

@oschwartz10612 commented on GitHub (Mar 30, 2025):

I think it should work on unraid - it is just linux

@oschwartz10612 commented on GitHub (Mar 30, 2025): I think it should work on unraid - it is just linux
Author
Owner

@blaine07 commented on GitHub (Mar 30, 2025):

The way unraid templates work you don’t/can’t really just edit the compose file though.

@blaine07 commented on GitHub (Mar 30, 2025): The way unraid templates work you don’t/can’t really just edit the compose file though.
Author
Owner

@miloschwartz commented on GitHub (Mar 30, 2025):

@blaine07 You can add volumes/ports/variables through the Unraid GUI which do the same thing.

@miloschwartz commented on GitHub (Mar 30, 2025): @blaine07 You can add volumes/ports/variables through the Unraid GUI which do the same thing.
Author
Owner

@blaine07 commented on GitHub (Mar 31, 2025):

@blaine07 You can add volumes/ports/variables through the Unraid GUI which do the same thing.

So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example?

@blaine07 commented on GitHub (Mar 31, 2025): > [@blaine07](https://github.com/blaine07) You can add volumes/ports/variables through the Unraid GUI which do the same thing. So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example?
Author
Owner

@oschwartz10612 commented on GitHub (Mar 31, 2025):

So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example?

Yep Ill merge this soon and it will be in the next release

@oschwartz10612 commented on GitHub (Mar 31, 2025): > So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example? Yep Ill merge this soon and it will be in the next release
Author
Owner

@blaine07 commented on GitHub (Mar 31, 2025):

So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example?

Yep Ill merge this soon and it will be in the next release

All the thanks! 🙏🙌

@blaine07 commented on GitHub (Mar 31, 2025): > > So I’ll be able to add this as a variable? Will the variable be “LOGGER_TIMEZONE”? In which case it would be “America/Chicago” for me for example? > > Yep Ill merge this soon and it will be in the next release All the thanks! 🙏🙌
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

Image

Image

This doesn't/didn't appear to work - added to Unraid as we discussed and shown. See attached image of log - no change to time.

@blaine07 commented on GitHub (Apr 7, 2025): ![Image](https://github.com/user-attachments/assets/eb2e8d5b-a96e-4c96-91e6-a0ca0be9fa62) ![Image](https://github.com/user-attachments/assets/46afad6e-be2e-4308-8e65-36258a88f0f8) This doesn't/didn't appear to work - added to Unraid as we discussed and shown. See attached image of log - no change to time.
Author
Owner

@oschwartz10612 commented on GitHub (Apr 7, 2025):

Hum maybe this has something to do with Unraid and the time on your machine? I was able to get it working for my own test. My computer is in the America/New_York region.

$LOGGER_TIMEZONE=UTC ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com
INFO: 2025/04/07 01:03:33 Sent registration message
INFO: 2025/04/07 01:03:34 Received registration message
INFO: 2025/04/07 01:03:34 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]}
INFO: 2025/04/07 01:03:34 WireGuard device created. Lets ping the server now...
INFO: 2025/04/07 01:03:34 Ping attempt 1
INFO: 2025/04/07 01:03:34 Pinging 100.89.128.1
INFO: 2025/04/07 01:03:34 Ping latency: 8.062267ms
INFO: 2025/04/07 01:03:34 Starting ping check
^CINFO: 2025/04/07 01:03:38 Received interrupt signal, stopping
$ LOGGER_TIMEZONE=America/Chicago ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com
INFO: 2025/04/06 20:03:45 Sent registration message
INFO: 2025/04/06 20:03:45 Received registration message
INFO: 2025/04/06 20:03:45 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]}
INFO: 2025/04/06 20:03:45 WireGuard device created. Lets ping the server now...
INFO: 2025/04/06 20:03:45 Ping attempt 1
INFO: 2025/04/06 20:03:45 Pinging 100.89.128.1
INFO: 2025/04/06 20:03:45 Ping latency: 13.913693ms
INFO: 2025/04/06 20:03:45 Starting ping check
^CINFO: 2025/04/06 20:03:46 Received interrupt signal, stopping
@oschwartz10612 commented on GitHub (Apr 7, 2025): Hum maybe this has something to do with Unraid and the time on your machine? I was able to get it working for my own test. My computer is in the America/New_York region. ``` $LOGGER_TIMEZONE=UTC ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com INFO: 2025/04/07 01:03:33 Sent registration message INFO: 2025/04/07 01:03:34 Received registration message INFO: 2025/04/07 01:03:34 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]} INFO: 2025/04/07 01:03:34 WireGuard device created. Lets ping the server now... INFO: 2025/04/07 01:03:34 Ping attempt 1 INFO: 2025/04/07 01:03:34 Pinging 100.89.128.1 INFO: 2025/04/07 01:03:34 Ping latency: 8.062267ms INFO: 2025/04/07 01:03:34 Starting ping check ^CINFO: 2025/04/07 01:03:38 Received interrupt signal, stopping $ LOGGER_TIMEZONE=America/Chicago ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com INFO: 2025/04/06 20:03:45 Sent registration message INFO: 2025/04/06 20:03:45 Received registration message INFO: 2025/04/06 20:03:45 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]} INFO: 2025/04/06 20:03:45 WireGuard device created. Lets ping the server now... INFO: 2025/04/06 20:03:45 Ping attempt 1 INFO: 2025/04/06 20:03:45 Pinging 100.89.128.1 INFO: 2025/04/06 20:03:45 Ping latency: 13.913693ms INFO: 2025/04/06 20:03:45 Starting ping check ^CINFO: 2025/04/06 20:03:46 Received interrupt signal, stopping ```
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

Hum maybe this has something to do with Unraid and the time on your machine? I was able to get it working for my own test. My computer is in the America/New_York region.

$LOGGER_TIMEZONE=UTC ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com
INFO: 2025/04/07 01:03:33 Sent registration message
INFO: 2025/04/07 01:03:34 Received registration message
INFO: 2025/04/07 01:03:34 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]}
INFO: 2025/04/07 01:03:34 WireGuard device created. Lets ping the server now...
INFO: 2025/04/07 01:03:34 Ping attempt 1
INFO: 2025/04/07 01:03:34 Pinging 100.89.128.1
INFO: 2025/04/07 01:03:34 Ping latency: 8.062267ms
INFO: 2025/04/07 01:03:34 Starting ping check
^CINFO: 2025/04/07 01:03:38 Received interrupt signal, stopping
$ LOGGER_TIMEZONE=America/Chicago ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com
INFO: 2025/04/06 20:03:45 Sent registration message
INFO: 2025/04/06 20:03:45 Received registration message
INFO: 2025/04/06 20:03:45 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]}
INFO: 2025/04/06 20:03:45 WireGuard device created. Lets ping the server now...
INFO: 2025/04/06 20:03:45 Ping attempt 1
INFO: 2025/04/06 20:03:45 Pinging 100.89.128.1
INFO: 2025/04/06 20:03:45 Ping latency: 13.913693ms
INFO: 2025/04/06 20:03:45 Starting ping check
^CINFO: 2025/04/06 20:03:46 Received interrupt signal, stopping

Id imagine you're right - but I still don't know what to do/how to fix it? LOL

@blaine07 commented on GitHub (Apr 7, 2025): > Hum maybe this has something to do with Unraid and the time on your machine? I was able to get it working for my own test. My computer is in the America/New_York region. > > ``` > $LOGGER_TIMEZONE=UTC ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com > INFO: 2025/04/07 01:03:33 Sent registration message > INFO: 2025/04/07 01:03:34 Received registration message > INFO: 2025/04/07 01:03:34 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]} > INFO: 2025/04/07 01:03:34 WireGuard device created. Lets ping the server now... > INFO: 2025/04/07 01:03:34 Ping attempt 1 > INFO: 2025/04/07 01:03:34 Pinging 100.89.128.1 > INFO: 2025/04/07 01:03:34 Ping latency: 8.062267ms > INFO: 2025/04/07 01:03:34 Starting ping check > ^CINFO: 2025/04/07 01:03:38 Received interrupt signal, stopping > $ LOGGER_TIMEZONE=America/Chicago ./newt --id yev0tpt6urpfnze --secret 9pobv4sjqcd6bjtppje0qd6tnr84w5op2b3xjvr31ngk4eco --endpoint https://p.example.com > INFO: 2025/04/06 20:03:45 Sent registration message > INFO: 2025/04/06 20:03:45 Received registration message > INFO: 2025/04/06 20:03:45 Received: {Type:newt/wg/connect Data:map[endpoint:p.example.com:51820 publicKey:tng9Z/BN32flFjqwwT1yAxN/twFkmgbZA+D9N+YqdjM= serverIP:100.89.128.1 targets:map[tcp:[] udp:[]] tunnelIP:100.89.128.12]} > INFO: 2025/04/06 20:03:45 WireGuard device created. Lets ping the server now... > INFO: 2025/04/06 20:03:45 Ping attempt 1 > INFO: 2025/04/06 20:03:45 Pinging 100.89.128.1 > INFO: 2025/04/06 20:03:45 Ping latency: 13.913693ms > INFO: 2025/04/06 20:03:45 Starting ping check > ^CINFO: 2025/04/06 20:03:46 Received interrupt signal, stopping > ``` Id imagine you're right - but I still don't know what to do/how to fix it? LOL
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

If you are using Docker you can mount the volume for localtime and timezone of your host system.

just add this to your compose.yml:

    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

I did this; now it says this; it's 2011 MY TIME right now:

Image

@blaine07 commented on GitHub (Apr 7, 2025): > If you are using Docker you can mount the volume for `localtime `and `timezone` of your host system. > > just add this to your compose.yml: > > ``` > volumes: > - /etc/timezone:/etc/timezone:ro > - /etc/localtime:/etc/localtime:ro > ``` I did this; now it says this; it's 2011 MY TIME right now: ![Image](https://github.com/user-attachments/assets/7b5d497b-6458-4f60-8e9e-76184ee53e4e)
Author
Owner

@oschwartz10612 commented on GitHub (Apr 7, 2025):

Is that with the timezone mount and with the env var? If not does both do anything?

@oschwartz10612 commented on GitHub (Apr 7, 2025): Is that with the timezone mount and with the env var? If not does both do anything?
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

Is that with the timezone mount and with the env var? If not does both do anything?

Image

Image

Even tried this as it works for other containers; no dice:

Image

@blaine07 commented on GitHub (Apr 7, 2025): > Is that with the timezone mount and with the env var? If not does both do anything? ![Image](https://github.com/user-attachments/assets/28979484-c48c-4c55-8ff6-d4a4c6573491) ![Image](https://github.com/user-attachments/assets/fdac2725-db45-44b3-9eee-60d5dfb287a7) Even tried this as it works for other containers; no dice: ![Image](https://github.com/user-attachments/assets/68d4846f-70fa-424e-88d5-723349335a6f)
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

User above just mentioned doing the two VOLUMES - only VAR I tried was last image. Not sure what VARs youd recommend I try?

Oh this was set, too:

Image

@blaine07 commented on GitHub (Apr 7, 2025): User above just mentioned doing the two VOLUMES - only VAR I tried was last image. Not sure what VARs youd recommend I try? Oh this was set, too: ![Image](https://github.com/user-attachments/assets/48f8413f-e3cf-427a-a9cb-ef2bd23c2e7a)
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

Image

@blaine07 commented on GitHub (Apr 7, 2025): ![Image](https://github.com/user-attachments/assets/92410668-b71d-460c-9c38-476d0c4a70c7)
Author
Owner

@blaine07 commented on GitHub (Apr 7, 2025):

Image
Image

On this container running "apk add tzdata" was the resolution.

I have never had to manually install tzdata for any other Unraid container ever - is there some way to get this "baked into" Newt so that in the future when this gets re-installed on Unraid it doesn't present itself as issue?

@blaine07 commented on GitHub (Apr 7, 2025): ![Image](https://github.com/user-attachments/assets/75a4b5df-1b62-4f53-9c25-24f5cc57518f) ![Image](https://github.com/user-attachments/assets/6712c3d1-c819-4d3d-9661-4954c853b9a5) On this container running "apk add tzdata" was the resolution. I have never had to manually install tzdata for any other Unraid container ever - is there some way to get this "baked into" Newt so that in the future when this gets re-installed on Unraid it doesn't present itself as issue?
Author
Owner

@oschwartz10612 commented on GitHub (Apr 7, 2025):

Ahh good find! Yes I can add that to the Dockerfile! Ill do that and make a patch release.

@oschwartz10612 commented on GitHub (Apr 7, 2025): Ahh good find! Yes I can add that to the Dockerfile! Ill do that and make a patch release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/newt#12