[Nextcloud] Failed to call imaginary

I have been using imaginary for Nextcloud preview for years. Recently after a couple migrations and several server upgrade, I have found that Nextcloud does not call imaginary for preview.

I installed Nextcloud and imaginary via docker. I am certain that the Nextcloud user abc in the container can call imaginary and imaginary logs the calls as show below:

# docker exec -it -u 3008:5004 nextcloud bash
bash: /root/.bashrc: Permission denied
abc@cef674d6be6a:/$ id
uid=3008(abc) gid=5004(abc) groups=5004(abc)
abc@cef674d6be6a:/$ cd /mnt/logs
$ curl -O "http://imaginary:9000/crop?width=500&height=400&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38616  100 38616    0     0  51212      0 --:--:-- --:--:-- --:--:-- 51214

And the container log of imaginary shows:

Imaginary has started
172.47.0.5 - - [06/Jul/2024 18:37:20] "GET /crop?width=500&height=400&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg HTTP/1.1" 200 38616 0.7436

However, when I opened folders with images on Nextcloud, no sign of imaginary being called.

Here is my compose.yaml:

---
services:
  imaginary:
    image: nextcloud/aio-imaginary:latest
    container_name: nextcloud-imaginary
    deploy:
      resources:
        limits:
          memory: 2G
    cap_add:
      - CAP_SYS_NICE
    environment:
       PORT: 9000
    command: -enable-url-source -concurrency 36 -log-level info
    restart: unless-stopped
  mariadb:
    image: "linuxserver/mariadb:latest"
    container_name: nextcloud-mariadb
    deploy:
      resources:
        limits:
          memory: 4G
    env_file:
      - ./secrets.env
    environment:
      - PUID=3008
      - PGID=5004
      - TZ=Europe/London
    volumes:
      - "./config:/config:rw"
      - "/mnt/nextcloud/mariadb/databases:/config/databases:rw"
      - "/mnt/nextcloud/mariadb/log:/config/log:rw"
      - "/mnt/logs/nc/mariadb:/mariadb/log:rw"
    ports:
      - "3306:3306"
    restart: unless-stopped
  nextcloud:
    image: "linuxserver/nextcloud:latest"
    container_name: nextcloud
    deploy:
      resources:
        limits:
          memory: 4G
    cap_add:
      - CAP_SYS_NICE
    environment:
      - PUID=3008
      - PGID=5004
      - TZ=Europe/London
      - DOCKER_MODS=linuxserver/mods:universal-cron
      - PHP_MEMORY_LIMIT=4G
    ports:
#      - "7443:443"
      - "1780:80"
    volumes:
      - type: tmpfs
        target: /tmp:exec
      - "./config:/config:rw"
      - "./custom-cont-init.d:/custom-cont-init.d:ro"
      - "./custom-services.d:/custom-services.d:ro"
      - "./etc/watcher.ini:/etc/watcher.ini:ro"
      - "./etc/logrotate.d/watcher:/etc/logrotate.d/watcher:ro"
      - "./janus_bin:/janus_bin:r"  # bin directory for crontab
      - "/mnt/nextcloud/data:/data:rw"   # data directory
      - "/mnt/cctv:/mnt/cctv:rw"
      - "download:/mnt/download:rw"
      - "/mnt/infinityloop:/mnt/infinityloop:rw"
      - "/mnt/logs:/mnt/logs:rw"
      - "/mnt/media:/mnt/media:rw"
      - "/mnt/private:/mnt/private:rw"
    restart: unless-stopped
    depends_on:
      imaginary:
        condition: service_started
        restart: false
      mariadb:
        condition: service_started
        restart: false
      redis:
        condition: service_started
        restart: false
  redis:
    image: "redis:latest"
    container_name: nextcloud-redis
    deploy:
      resources:
        limits:
          memory: 512M
    command: /usr/local/bin/redis-server /usr/local/etc/redis/redis.conf
    sysctls:
      - net.core.somaxconn=65535
    volumes:
      - "./config:/usr/local/etc/redis"
      - "redis-data:/data"
    restart: unless-stopped
networks:
  default:
    name: nextcloud_default
    ipam:
      config:
        - subnet: 172.47.0.0/16
          ip_range: 172.47.0.0/24
          gateway: 172.47.0.1

volumes:
  redis-data:
    name: nextcloud_redis_data
  download:
    name: nextcloud_download
    external: true

No error was logged from Nextcloud with log level warning.

Environment:
Operating system and version : Debian 12.6 inside systemd-nspawn on top of TrueNAS 24.04.1.1
CPU: 2 x Intel Xeon Silver 4116 CPU @ 2.10GHz

It turned out that I have miss configured Nextcloud. :flushed:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.