PPCM / docker-glpi

Docker for GLPI
GNU General Public License v3.0
5 stars 5 forks source link

Add Ofelia cron job config option to README #10

Open landure opened 10 months ago

landure commented 10 months ago

Another possibility for cron tasks on stand-alone node is using Ofelia to run cron job in containers using this configuration by labels:

    labels:
      ofelia.enabled: "true"
      ofelia.job-exec.glpi-glpi-cron.schedule: '@every 2m'
      ofelia.job-exec.glpi-glpi-cron.command: /usr/bin/php '/var/www/glpi/front/cron.php'
      ofelia.job-exec.glpi-glpi-cron.user: apache

It would be nice to add the info to the README.

PPCM commented 10 months ago

I don't know Ofelia and how to integrate that It seems to be pretty elegant to use (even if I am old shool and CRON works fine)

I will check that

Merci pour toutes ces propositions pertinentes 👍

PPCM commented 10 months ago

It looks good, but a new docker need to be done to add that - I will not replace classic CRON because other people already use it

This will not be done in the next release, but I will do my best to add as soon as possible The issue will stay opened to not forget the idea

landure commented 10 months ago

I use this config as-is with exiting ppcm/glpi-server:latest image. I don't use the dedicated cron image.

PPCM commented 10 months ago

If you use it like that, that suggest you did'nt change the configuration of automatic tasks. In that way, GLPI will manage it when someone play with the interface. In nobody goes to the UI, no automatic action will be done

I suggest you to instantiate ppcm/glpi-cron:latest or ppcm/glpi-cron-daemon:latest to have real automatic actions, even if nobody goes to the interface Don't forget to configure all automatic actions to CLI

landure commented 10 months ago

In the proposed config, Ofelia execute /usr/bin/php '/var/www/glpi/front/cron.php' with user apache every 2 minutes in the GLPI container, thus running the cron tasks from command line. It's not totally the Docker way. The better way would be to instantiate a container for Ofelia to run the cron tasks, but it does work ;-)

PPCM commented 10 months ago

It works, because you call the URL. It is a good idea

My goal, with what I saw about Ofelia, is to build a docker, in the same way than ppcm/glpi-cron-daemon with Ofelia instead of CRON In that way, it will be possible to instantiate a container with Ofelia that run GLPI CLI commands, 100% Docker spirit :-)