Files
opencloud-compose/thumbnails/imagor.yml
Jörn Friedrich Dreyer dd58b4a9a2 add imagor as thumbnail generator
thumbnails/imagor.yml runs ghcr.io/cshum/imagor-magick and points
WEBDAV_THUMBNAILS_GENERATOR_URL at it. The built-in thumbnails service
is no longer started, it is going to lose libvips and with it most
formats. All COMPOSE_FILE examples include the new file.

imagor only gets unsigned /unsafe/ URLs from webdav, so it must only be
reachable on opencloud-net. It is configured with the same limits as
the built-in service and only accepts uploads, it never fetches URLs.

On top of the built-in list we announce previews for heic, heif, avif,
jp2, psd, tga, pcx, svg and ico. I checked each against a running
stack. pdf is read by imagor, but webdav 9.0.0 only passes image types
to the generator. jxl ends up as application/octet-stream in reva, so
it would need a mime mapping first.

OC_EXCLUDE_RUN_SERVICES is now set by imagor.yml and the idm files, and
compose keeps only the value of the last file. Each file prepends the
new EXCLUDE_ADDITIONAL_SERVICES, so combining them works when it lists
all of them: EXCLUDE_ADDITIONAL_SERVICES=idm,idp,thumbnails

related: https://github.com/opencloud-eu/opencloud/issues/3912

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-09 16:20:41 +01:00

46 lines
2.3 KiB
YAML

---
services:
opencloud:
environment:
# webdav posts the image to imagor instead of the built-in thumbnails service
WEBDAV_THUMBNAILS_GENERATOR_URL: http://imagor:8000
# announce previews for the formats imagor-magick reads on top of the built-in list
OC_THUMBNAILS_ADDITIONAL_SOURCE_TYPES: ${IMAGOR_ADDITIONAL_SOURCE_TYPES:-image/heic,image/heif,image/avif,image/jp2,image/vnd.adobe.photoshop,image/x-tga,image/x-pcx,image/svg+xml,image/x-icon,image/vnd.microsoft.icon}
# in bytes, the same value is handed to imagor below so both refuse the same files
OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE: "${IMAGOR_MAX_INPUT_FILE_SIZE:-50000000}"
# the built-in thumbnails service is not needed when imagor makes the thumbnails
# compose takes this value from the last file in COMPOSE_FILE, so when combining with
# idm/ldap-keycloak.yml or idm/external-idp.yml set EXCLUDE_ADDITIONAL_SERVICES=idm,idp,thumbnails
OC_EXCLUDE_RUN_SERVICES: ${EXCLUDE_ADDITIONAL_SERVICES:-}${EXCLUDE_ADDITIONAL_SERVICES:+,}thumbnails
depends_on:
imagor:
condition: service_healthy
imagor:
# renovate: depName=ghcr.io/cshum/imagor-magick
image: ${IMAGOR_DOCKER_IMAGE:-ghcr.io/cshum/imagor-magick}:${IMAGOR_DOCKER_TAG:-1.9.11}
networks:
opencloud-net:
environment:
# webdav only sends unsigned /unsafe/ URLs. imagor is only reachable on the
# internal opencloud-net bridge and no port is published to the host.
# Do NOT publish a port or expose imagor via the reverse proxy.
IMAGOR_UNSAFE: "true"
# webdav posts the image, imagor must not fetch anything by itself
UPLOAD_LOADER_ENABLE: "true"
HTTP_LOADER_DISABLE: "true"
# quoted, an unquoted large number reaches imagor as 5e+07 which it cannot parse
UPLOAD_LOADER_MAX_ALLOWED_SIZE: "${IMAGOR_MAX_INPUT_FILE_SIZE:-50000000}"
# the limits of the built-in thumbnails service
VIPS_MAX_WIDTH: ${IMAGOR_MAX_WIDTH:-7680}
VIPS_MAX_HEIGHT: ${IMAGOR_MAX_HEIGHT:-7680}
VIPS_MAX_ANIMATION_FRAMES: ${IMAGOR_MAX_ANIMATION_FRAMES:-100}
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8000/healthcheck"]
interval: 5s
timeout: 5s
retries: 12
logging:
driver: ${LOG_DRIVER:-local}
restart: always