Nextcloud Preview generator

sstruke

Dabbler
Joined
Feb 2, 2017
Messages
37
Hello I wonder if anyone knows cron Command for Nextcloud Preview generator This "php / var / www / nextcloud / occ preview: pre-generate" is definitely missing something
 

sstruke

Dabbler
Joined
Feb 2, 2017
Messages
37
Somehow I compiled this code to work Temporarily

docker exec -i --user www-data "CONTAINER ID" php -d memory_limit=32768M occ preview:generate

Each time you restart, the "Container ID" changes So this is not quite the right solution
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
787
The 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!
 

sstruke

Dabbler
Joined
Feb 2, 2017
Messages
37
The 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!
I don’t fully understand that answer. Is there a final solution to this code
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
787
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 :)
 

sstruke

Dabbler
Joined
Feb 2, 2017
Messages
37
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 :)
 

sstruke

Dabbler
Joined
Feb 2, 2017
Messages
37
This is my first experience with a Linux system and I just don’t know exactly how it works
I will wait for a better solution.
When you find a solution I would be happy if you share it with me.
Thanks for the reply
 

vanhalf

Cadet
Joined
Jan 26, 2022
Messages
3
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
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
787
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

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 ;-)
 

vanhalf

Cadet
Joined
Jan 26, 2022
Messages
3
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 ;-)
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?
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
787
SCALE runs kubernetes behind a middleware layer... skipping multiple steps and directly messing with the engine itself is generally not a good idea.
Primarly because kubernetes already offers tools to do the same.
 

vanhalf

Cadet
Joined
Jan 26, 2022
Messages
3
If someone still needs it, this is probably better way:

Code:
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


I think the TRUECHART nextcloud app already does this automatically.
But sometimes it is useful for other commands inside the container. (occ preview:generate-all etc....)
 
Top