EasyEngine / cron-command

Manages cron in EasyEngine
4 stars 9 forks source link

Ability to set the timezone cron/ofelia will run in #54

Open asgeo1 opened 1 year ago

asgeo1 commented 1 year ago

I can't see any way to set the timezone that the cron/ofelia container is using.

For other containers, i.e. php, I can set this in docker-compose-custom.yml, i.e.

version: '3.5'

services:

  php:
    environment:
      - TZ=Australia/Melbourne
    volumes:
      - "/etc/timezone:/etc/timezone:ro"
      - "/etc/localtime:/etc/localtime:ro"

There should be some way to do this for the cron/ofelia container, since this Ofelia ticket suggests that it does respect TZ environment variable if set.

My server is in Australia/Melbourne, as are most of the containers - except for ee-cron-scheduler which appears to still be in UTC+0, which is lame as I'd like everything to be using the same timezone.

Hope there is a way!

webysther commented 1 year ago

This works for me:

version: "3.9"

services:
  ofelia:
    image: mcuadros/ofelia:latest
    container_name: app-cron
    command: daemon --docker
    network_mode: none
    environment:
      TZ: Europe/Rome
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
webysther commented 1 year ago

@Trane9991 this can be closed.

asgeo1 commented 1 year ago

Thanks @webysther, but I don't understand, where are you putting that docker configuration?

It looks like you're running your own Ofelia container outside of Easy Engine.

The question is how do I do that within the context of Easy Engine, given it is a wrapper around Docker, and has it's own ee cron commands, and it's own custom version of the Ofelia docker image that it runs.

The documentation here suggests you can create a custom /opt/easyengine/services/docker-compose-custom.yml for customising global services.

I've tried creating that file and populating with this configuration

version: '3.5'

services:
  global-cron:
    environment:
      - TZ=Melbourne/Australia

And then refreshing the containers with ee service refresh

But when I connect to the running cron container with docker exec -it cbdc0838924f /bin/sh and run date, it still has the date in UTC, so not sure that it's working.

webysther commented 1 year ago

Sorry, wrong repository! Ignore my comment.