semaphoreui / semaphore

Modern UI and powerful API for Ansible, Terraform, OpenTofu, PowerShell and other DevOps tools.
https://semaphoreui.com
MIT License
10.61k stars 1.07k forks source link

can't change timezone for cron #1404

Closed ksourdrille closed 9 months ago

ksourdrille commented 1 year ago

Hi,

I've a problem with cron and timezone, my timezone is Europe/Paris, and the container have the UTC timezone, so we have 2 hours difference, for the cron i have to set -2 for trigger at the good hours in france,

There is a way for change the timezone of the container ?

i've already tried the TZ environment, puting volumes with /etc/timezone and /etc/localtime but the time doesn't impacted

ansibleguy commented 1 year ago

Just linking - related to: https://github.com/ansible-semaphore/semaphore/discussions/1407

Altersoundwork commented 1 year ago

Hi @keliansrdl ,

I came across the same issue (Europe/Madrid). Here's what I ran to fix the issue within the docker's console.

docker run -e "TZ=Europe/Madrid" sudo timedatectl set-timezone Europe/Madrid

Obviously, modify accordingly.

ksourdrille commented 1 year ago

Hi @keliansrdl ,

I came across the same issue (Europe/Madrid). Here's what I ran to fix the issue within the docker's console.

docker run -e "TZ=Europe/Madrid" sudo timedatectl set-timezone Europe/Madrid

Obviously, modify accordingly.

Hi, that's doesn't work for me ... where do you run the docker run command ?

Kélian

Altersoundwork commented 1 year ago

Try running just: "sudo timedatectl set-timezone Europe/Paris" within the docker (not the host OS).

ksourdrille commented 1 year ago

like this ?

image

Altersoundwork commented 1 year ago

like this ?

image

Ah, I see the issue. Sorry for the confusion. I checked and I believe I was thinking of a previous docker of Semaphore. My current installation is on a Ubuntu Server Instance so, looking at the command history I see the sudo command is what I used for the fix.

ksourdrille commented 1 year ago

Oh yes i see, np :)

Altersoundwork commented 1 year ago

Maybe this will help -> https://serverfault.com/questions/1012542/docker-container-time-2-hours-behind-when-tz-cest

ksourdrille commented 1 year ago

i think yes, that will work, but i don't want rebuild a docker image every update

Reupireup commented 1 year ago

same prob here, is there a plan to fix it ? https://github.com/ansible-semaphore/semaphore/issues/1042 seems to describe the same bug, almost a year from now 😐

andreas-marschke commented 9 months ago

Can you verify if it works better now with #1733 merged?

ksourdrille commented 9 months ago

Hi @andreas-marschke, CRON works fine with the good TZ with the 9.47 beta, however i've an error during task running :

time="2024-02-05T10:30:09+01:00" level=info msg="Task 1208 added to queue"
time="2024-02-05T10:30:12+01:00" level=info msg="Set resource locker with TaskRunner 1208"
time="2024-02-05T10:30:12+01:00" level=info msg="Task 1208 removed from queue"
time="2024-02-05T10:30:15+01:00" level=info msg="Stopped running TaskRunner 1208"
time="2024-02-05T10:30:15+01:00" level=info msg="Release resource locker with TaskRunner 1208"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x95a8af]
andreas-marschke commented 9 months ago

@ksourdrille That sounds concerning. Would you be able to reproduce that exception? Could you produce tracelogs from the application so that we can figure out where in the code that crash happens? The panic: runtime error: invalid memory address or nil pointer dereference is indicative of a code issue but without actual context this isn't beneficial for troubleshooting.

ksourdrille commented 9 months ago

@andreas-marschke did you know where i can found the tracelogs from the application ? (with docker install)

ksourdrille commented 9 months ago

Ok i have this @andreas-marschke :

time="2024-02-05T14:06:16Z" level=info msg="Task 1207 added to queue"
time="2024-02-05T14:06:17Z" level=info msg="Set resource locker with TaskRunner 1207"
time="2024-02-05T14:06:17Z" level=info msg="Task 1207 removed from queue"
time="2024-02-05T14:06:23Z" level=info msg="Stopped running TaskRunner 1207"
time="2024-02-05T14:06:23Z" level=info msg="Release resource locker with TaskRunner 1207"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x95a8af]

goroutine 133 [running]:
github.com/ansible-semaphore/semaphore/db_lib.AnsiblePlaybook.RunPlaybook({0x1d, {0x3, {0xc002a869e2, 0xb}, 0x5, {0xc00296c360, 0x25}, {0xc002a869f0, 0x4}, 0x5b, ...}, ...}, ...)
        /go/src/github.com/ansible-semaphore/semaphore/db_lib/AnsiblePlaybook.go:58 +0x8f
github.com/ansible-semaphore/semaphore/db_lib.(*AnsibleApp).Run(0x0?, {0xc001438000?, 0xc000be7958?, 0x1?}, 0xb18300?, 0xb1b380?)
        /go/src/github.com/ansible-semaphore/semaphore/db_lib/AnsibleApp.go:63 +0x90
github.com/ansible-semaphore/semaphore/services/tasks.(*LocalJob).Run(0xc002a90000, {0xc002b5b110, 0xb}, 0x0?)
        /go/src/github.com/ansible-semaphore/semaphore/services/tasks/LocalJob.go:328 +0x335
github.com/ansible-semaphore/semaphore/services/tasks.(*TaskRunner).run(0xc00045d700)
        /go/src/github.com/ansible-semaphore/semaphore/services/tasks/TaskRunner.go:188 +0x6a6
created by github.com/ansible-semaphore/semaphore/services/tasks.(*TaskPool).Run
        /go/src/github.com/ansible-semaphore/semaphore/services/tasks/TaskPool.go:172 +0x4ca

is that better ?

tboerger commented 9 months ago

Possibly it have been already fixed within v2.9.47-beta as I remember there had been a similar report on the weekend.

ksourdrille commented 9 months ago

@tboerger you're right, it's fixed --> #1736, but i used the 2.9.47-beta in my side and i've the error

andreas-marschke commented 9 months ago

@ksourdrille According to #1736 the other user was asked to test and confirmed the change not fixed. But the stack you produced is worth a ton. Thanks!

tboerger commented 9 months ago

I have pushed https://github.com/ansible-semaphore/semaphore/pull/1740, the AnsiblePlaybook struct was missing the logger dependency as well, https://github.com/ansible-semaphore/semaphore/commit/78c93b1c84a64b7b12d60c228b5b3fa1cb270c93 has added it to AnsibleApp only.