I don’t fully understand that answer. Is there a final solution to this codeThe right solution would be an integrated kubernetes cronjob, just like what we did with the... well... cronjob for Nextcloud :)
We might look into it on a later date!
Cronjobs should be handled by kubernetes on SCALE, direct docker use is not advised or supported by iX Systems.
Hence one should use a Kubernetes Cronjob instead, which are not user-accessable, the App creator needs to build them.
For our TrueCharts Nextcloud App, this is being looked at for next year :)
Cronjobs should be handled by kubernetes on SCALE, direct docker use is not advised or supported by iX Systems.
Hence one should use a Kubernetes Cronjob instead, which are not user-accessable, the App creator needs to build them.
For our TrueCharts Nextcloud App, this is being looked at for next year :)
Instead of container ID you can use $(docker ps -qf "name=part of the container name")
example:
docker exec -i --user www-data $(docker ps -qf "name=k8s_nextcloud_nextcloud") php occ preview:pre-generate
if you want to add to cron:
crontab -e
add line, to run every 10 min
*/10 * * * * docker exec -i --user www-data $(docker ps -qf "name=k8s_nextcloud_nextcloud") php occ preview:pre-generate
save
service cron reload
check:
grep CRON /var/log/syslog
What's wrong with that? Linux under which Docker containers run has access to them anyway. It is wrong to run cron jobs from one place for all containers? On a Linux machine where I have a docker, use it this way, instead of cron inside each container. Or is it a problem when using kubernetes?This hack would work, but is going to cause issues, kubernetes Pods and Containers should never be access using docker-exec.
If one want to use something like this, they would need to use the kubernetes alternative instead ;-)
k3s kubectl exec -n ix-nextcloud --stdin --tty $(k3s kubectl get pods -n ix-nextcloud -l "app.kubernetes.io/name"=nextcloud -o name) -c nextcloud -- runuser -u www-data -- php /var/www/html/occ preview:pre-generate