crowdsec icon indicating copy to clipboard operation
crowdsec copied to clipboard

Improvement/Provide a cron that upgrades the hub and the collections/parsers/scenarios/....

Open blotus opened this issue 4 years ago • 2 comments

blotus avatar Sep 06 '21 07:09 blotus

+1

cmiscloni avatar Dec 21 '21 14:12 cmiscloni

Does

#!/bin/bash
cscli hub update
cscli hub upgrade
cscli collections upgrade -a
cscli parsers upgrade --all
cscli scenarios upgrade -a
systemctl reload crowdsec

about cover everything?

okohll avatar Jul 11 '22 07:07 okohll

#1817 Fixed this

LaurenceJJones avatar Oct 17 '22 15:10 LaurenceJJones

There are still a few issues

  • crowdsec does not reload the configuration after hub upgrade
  • the package manager doesn't know about the cron job, so it won't be able to update it, or see if the user made changes
  • wizard.sh is soon going be a /bin/sh script - not bash - for compatibility with other distributions. It won't be called nor sourced from the postinst file. Also passing arguments to sourced files (the -n for noop) only works with bash

For these reasons, it would be better to follow each distribution's guidelines and install the cron job like we would install any other file:

  • https://fedoraproject.org/wiki/Packaging:CronFiles
  • https://www.debian.org/doc/manuals/maint-guide/dother.en.html#crond

A minimal cron.daily/crowdsec-hub would look like:

#!/bin/sh
cscli --error hub update && cscli --error hub upgrade
systemctl reload crowdsec
exit 0

I'm not convinced that systems installed with wizard.sh should have cron jobs, but if they do, they might not have systemd. That part is WIP.

What do you think? @sabban ?

mmetc avatar Oct 17 '22 20:10 mmetc

hi @mmetc i want to take this up..

mridullpandey avatar Nov 05 '22 12:11 mridullpandey

Hi @mridullpandey

It's been merged here https://github.com/crowdsecurity/crowdsec/blob/master/config/crowdsec.cron.daily

Any suggestion? We're releasing soon

Thanks

mmetc avatar Nov 05 '22 12:11 mmetc

what about docker image? could you include this cron in docker as well?

tasiotas avatar Jan 05 '23 21:01 tasiotas

@tasiotas there are several drawbacks to running a process manager and cron in a container, we'll try and find a better option for both docker and k8s

mmetc avatar Jan 06 '23 07:01 mmetc

@tasiotas there are several drawbacks to running a process manager and cron in a container, we'll try and find a better option for both docker and k8s

Is there a issue that can be tracked for this? Is there a "proper" way to do this as of today?

jflattery avatar Nov 28 '23 14:11 jflattery