Squidex
  • Welcome to Squidex
  • Getting Started
    • Squidex Cloud
    • Installation Instructions
      • Platforms
        • Install on Kubernetes
        • Install on AWS (Deprecated)
        • Install on AWS EC2 using Docker
        • Install on Azure
        • Install on Azure using ARM
        • Install on Google Cloud Platform (GCP)
        • Install on Docker
        • Install on Heroku
        • Install on IIS
        • Install on Render
        • Install on Vultr
      • Configuration
        • Deploying the Image Resizer Service
      • Troubleshooting and Support
        • Diagnose Runtime Issues
        • Restoring Deleted Apps
      • Install Identity (Deprecated)
      • External Identity Providers
        • Azure AD (OAuth) with Squidex
    • Contributing and Developing
      • Building
      • Developing
      • Extensions
        • Custom Rule Action
      • Contributing
      • Architecture
      • Translating
      • Squidex Docs Program
    • Roadmap
    • Quick Start Guides
      • Vue.js Blog with Squidex
      • React.js Blog with Squidex
      • Angular Blog with Squidex
  • Documentation
    • Introduction and Use Case
    • Concepts
      • Apps
      • Teams
      • Schemas
        • Field Rules
      • Content
        • Scheduled Publishing
      • Assets
        • Querying Assets
      • Localization
      • Migrations
      • Roles & Permissions
      • Rules
        • Publish an Event to Azure Queues using Rules
        • Populate Elasticsearch Index
      • Backups
      • Subscriptions
        • App Subscriptions v/s Team Subscriptions
      • Notifications
      • Dashboard
      • Workflows
    • Software Development Kits
      • TypeScript
      • .NET
        • Version v14 (and Earlier)
        • Version v15 (and Later)
      • PHP
      • Java
    • Developer Guides
      • API
        • Authentication
        • Postman
        • Queries
        • Assets
      • Automation Tools (CLI)
      • Scripting
        • Scripting Helper Methods
      • Embed Content
      • Custom Workflows
      • Custom Editors
      • Custom Sidebars
      • Preview Content
      • Rule Formatting
        • Simple
        • Script
        • Liquid
      • Tutorials
        • Building a Blog with Squidex and Next.js
  • Next
    • Squidex 3.0: API Compatibility
Powered by GitBook
On this page
  • About The Microservice
  • Authentication
  • Deploying the Microservice
  • Docker Image
  • Kubernetes YAML
  • Configuring Squidex for the Image Resizer Service

Was this helpful?

  1. Getting Started
  2. Installation Instructions
  3. Configuration

Deploying the Image Resizer Service

This Page Describes How You Can Offload Image Resizing to a Separate Image Resizing Service

PreviousConfigurationNextTroubleshooting and Support

Last updated 2 years ago

Was this helpful?

Image resizing could be an expensive task from a performance perspective as it could consume a lot of CPU resources depending on the size and number of images that are being resized. Since most images are compressed, for example a PNG image, in order to resize it has to be loaded to the server, decompressed, resized (in memory), compressed again and sent back.

Squidex uses Imagesharp for this task which works for most formats in combination with ImageMagick for WebP and TGA images.

While these libraries are fast they can still be a bottleneck and a CPU intensive task when resizing images of large size and in large numbers.

Hence, a small microservice was built to offload this task to another service. The aim was to create an external process that can handle the image resizing and the thread that accepted the request to resize the image can handle other HTTP requests while it is waiting for the result. This does not necessarily mean that resizing of images will become faster as this would depend on the resource allocated to the microservice.

About The Microservice

This microservice is available as a docker image and is easy to install.

It does not have any dependencies or database requirements and hence can be simply installed on any server, Kubernetes cluster, or one can also use a managed services like Google Cloud Run () for infinite scalability.

Authentication

It is important to note that Squidex does NOT use any authentication to communicate with the Image Resizer microservice.

Hence it is recommended to host it in the same network, preferably keeping it private. Hosting in the same network also helps in keeping traffic costs low.

Deploying the Microservice

Docker Image

The Docker image is available at .

Running the docker image is as simple as running the following command:

The image resizer runs on port 80 by default. You should map it to a different port if you have a reverse proxy like NGINX also running on port 80/443.

The following command maps image resizer to port 8001 on the host.

docker run -d -p 8001:80 squidex/resizer

Kubernetes YAML

The following YAML file can be used in Kubernetes deployments:

To deploy the resizer in Kubernetes, download/copy the resizer.yml from the link above and simply run the following command:

kubectl apply -f resizer.yml

Configuring Squidex for the Image Resizer Service

Starting with Squidex 6.4.0, the following environment variable can be configured to point to the resizer microservice:

Variable
Description

ASSETS__RESIZERURL

The URL where the image resizer service is running.

.

For example, if you were running the Kubernetes YAML file, then the URL would be .

https://cloud.google.com/run
https://hub.docker.com/repository/docker/squidex/resizer
https://github.com/Squidex/squidex-hosting/blob/master/kubernetes/resizer/resizer.yml
http://resizer.default.svc.cluster.local