Imaginary not working with AiO

Hi guys,

I have issues setting up the imaginary container for the preview generation on my AiO instance and I would like to ask, if you can help me.

I have set up NC Mastercontainer with following settings:

sudo docker run -d \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 8080:8080 \
--env APACHE_PORT=11000 \
--env APACHE_IP_BINDING=0.0.0.0 \
--env BORG_RETENTION_POLICY="--keep-within=7d --keep-weekly=4 --keep-monthly=6" \
--env NEXTCLOUD_MEMORY_LIMIT=3072M \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

From the Mastercontainer I installed the imaginary Container (name: nextcloud-aio-imaginary) via the WebGUI. I then installed the Preview Generator App within NC.

For the configuration of the preview generation, I have following lines in my config.php:

'preview_max_x' => '1024',         
  'preview_max_y' => '1024',        
  'jpeg_quality' => '60',                                            
  'preview_max_memory' => '2048',                                      
  'preview_max_filesize_image' => '50',                          
  'enabledPreviewProviders' =>                  
  array (                            
    1 => 'OC\\Preview\\Image',                    
    2 => 'OC\\Preview\\MarkDown',                                    
    3 => 'OC\\Preview\\MP3',                                         
    4 => 'OC\\Preview\\TXT',       
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',       
    7 => 'OC\\Preview\\Krita',                                       
    8 => 'OC\\Preview\\PNG',                         
    9 => 'OC\\Preview\\JPEG',                                    
    10 => 'OC\\Preview\\GIF',        
    11 => 'OC\\Preview\\HEIC',       
    12 => 'OC\\Preview\\BMP',                        
    13 => 'OC\\Preview\\XBitmap',                                    
    14 => 'OC\\Preview\\MKV',          
    15 => 'OC\\Preview\\MP4',      
    16 => 'OC\\Preview\\AVI',        
    17 => 'OC\\Preview\\PDF',        
    0 => 'OC\\Preview\\Imaginary',                                   
  ),                               
  'enable_previews' => true,           
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',

In the logs of the nextcloud-aio-nextcloud container I can see the following line:

System config value preview_imaginary_url set to string http://nextcloud-aio-imaginary:9000

I can also ping the imaginary container from the nextcloud container, so the connection between the two containers should be fine.

However, when I start the preview generation with following commands:

docker exec -it nextcloud-aio-nextcloud /bin/bash
sudo -u www-data php occ preview:generate-all -vvv

I get two warnings in the first two lines:

Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
The current PHP memory limit is below the recommended value of 512MB.

This is kinda surprising, because the php memory limit for imaginary is set to 2048 MB and for NC itself it is 3072 MB.

What I also notice is, that the log of the imaginary container is empty and that the imaginary docker uses almost no resources (docker stats nextcloud-aio-imaginary: CPU 0-1% and 7 MB RAM).

So I assume the preview generation is done on the NC and not via imaginary.

What can I do to get the previews generated by imaginary?

Thank you very much for your help!

Maginos

Hi, see How to enable and configure the previewgenerator app · nextcloud/all-in-one · Discussion #2810 · GitHub

Thank you for your answer.

I already read this and several guides on how to set up imaginary. Unfortunately, I was not able to get NC working with imaginary.

That’s why I’m asking for help, to get tips on what else I could try.

You ran the wrong command for generating the preview. That is why I pointed at the documentation

Ok, so when I use

sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ preview:generate-all -vvv

instead of executing

sudo -u www-data php occ preview:generate-all -vvv

inside the container, at least the warning with the memory is gone.

Unfortunately, the rest did not change. No increased CPU and RAM usage at the imaginary docker, no entries in the logs.

Ok, I found the solution: Don’t fix it, if it ain’t broken.

Imaginary generates the previews on the fly, so it seems not to be necessary to execute the two commands for the preview generation.

I can observe the following:

When I browse files within the NC, I not only see previews of the files, there also the characteristic “POST /pipeline? …” entries in the logs of the imaginary container. CPU and RAM usage of the docker ramp up to 300% CPU usage and up to 200 MB RAM usage. When I enter a folder, imaginary generates the previews for all specified files and stops afterwards. If the folder is reaccessed again, no previews are generated.

To sum it up, I set up imaginary correctly and it was already functioning, without me knowing, that it was already working perfectly fine.

1 Like