ChatDeBlofeld / seafile-arm-docker-base

https://hub.docker.com/r/franchetti/seafile-arm
Apache License 2.0
14 stars 5 forks source link

Add cron job for seafile-gc #42

Open Cub0n opened 1 year ago

Cub0n commented 1 year ago

Hello,

is it possible to add a cron job for cleaning up seafile (via seafile-gc, see https://github.com/klangborste/seafile_gc_cron_script/blob/master/seafile_gc_cron.sh) and to configure it via environment variables?

Otherwise the job has to be triggered outside from the container.

Thanks in advance

ChatDeBlofeld commented 1 year ago

Hi,

I'm a bit annoyed.

IMHO, it's against Docker philosophy. Docker containers aren't VMs nor servers. Period... but, well, this image does not even follows the "one application per container" idiom, for the sake of simplicity at the time. I can deal with philosophy, but I think there is still an issue here.

Currently there's no process supervision, meaning that if seafile server or seahub fails, the container doesn't. Adding a process which purpose precisely is to kill the two others at some point will probably be the death of any room of improvement here.

That said, I'm not against adding a cron job as "Temporary feature" or something. I've never run the GC in 2 years because I didn't care, it's probably time to do something...

Cub0n commented 1 year ago

@ChatDeBlofeld Thanks for your answer. I missed the aspect of the "Docker philosophy" by my own. I fully agree that a job which kills the main application (or the precondition is a not running main process) is error prone. I can life with my own solution. I asked perhaps there exist a more elegant way to address this topic.

ChatDeBlofeld commented 1 year ago

Something I definitively want to have a look at is a separate container for the cron job. This container would have access to the docker socket and can perform the following operations:

  1. Stop the seafile container
  2. Launch a new container which executes the gc
  3. Restart the seafile container

I imagine something very similar to some projects like ofelia but more radical, because it will see containers as processes and won't try to "dig" (i.e. docker exec) in them.