pierrecdn / phpipam

phpIPAM Docker image
GNU Lesser General Public License v3.0
94 stars 111 forks source link

Crontab for discovery? #27

Closed cchance27 closed 6 years ago

cchance27 commented 6 years ago

Do you plan to include a discoveryCheck cron in the container?

pierrecdn commented 6 years ago

Hi, Please could you elaborate? Is there something missing that you're used to work with on non-containerized phpipam setup?

Swish24 commented 6 years ago

I believe he is speaking of, https://phpipam.net/news/automatic-host-availability-check/ Currently the container does not have automatic discovery. We would need to manually run the scan on each subnet, rather than having the ability to automatically run the search using cron.

pierrecdn commented 6 years ago

OK, now I understand better. Unfortunately, running cron inside the same container isn't a good pattern (no more than 1 daemon in the container). I would advise to schedule cron from the host, by creating a /etc/cron.d/ipam file:

# update host statuses exery 15 minutes
*/15 * * * *  docker exec -ti ipam /usr/local/bin/php /var/www/html/functions/scripts/pingCheck.php
*/15 * * * *  docker exec -ti ipam /usr/local/bin/php /var/www/html/functions/scripts/discoveryCheck.php

Another approach would be for me to provide a dedicated phpipam-agent container (releasing https://github.com/phpipam/phpipam-agent), but it would imply an additional setup in phpipam (as for a non-Dockerized setup).

What do you think?

pierrecdn commented 6 years ago

So you have all options, since I finally created https://github.com/pierrecdn/phpipam-agent & pierrecdn/phpipam-agent Docker image to cover this need.

It seems more convenient and usable on orchestration platforms such as Docker compose, Mesos, Kubernetes and so on where you want to abstract every workload from the host.