Files
speckle-server/packages/preview-service
Kristaps Fabians Geikins 83d8035dc2 chore: upgrade to eslint 9 (#2348)
* root + server

* frontend

* frontend-2

* dui3

* dui3

* tailwind theme

* ui-components

* preview service

* viewer

* viewer-sandbox

* fileimport-service

* webhook service

* objectloader

* shared

* ui-components-nuxt

* WIP full config

* WIP full linter

* eslint projectwide util

* minor fix

* removing redundant ci

* clean up test errors

* fixed prettier formatting

* CI improvements

* TSC lint fix

* 'buildBatch' needs to be async since some batch types (like Text) require it. Removed a disabled liniting rule from ObjLoader

* removed unnecessary void

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
2024-06-12 14:38:02 +03:00
..
2024-06-12 14:38:02 +03:00
2024-04-09 10:05:32 +01:00

PreviewService

This component generates object previews for Speckle Objects.

It reads preview tasks from the DB and uses Puppeteer and an internal Viewer to generate previews, which are currently stored in the DB.

This is an overview of this service:

overview

Run locally

With an updated viewer installed in the current directory, you should first build the frontend-part of the preview service: The simple webpage with the viewer that will be accessed with Puppeteer to generate the preview:

yarn build

This should be rerun whenever you make changes to the viewer (if you make local viewer changes, don't forget to build the viewer module before running this)

After the viewer web page is up to date, run the preview service with:

yarn dev

This will use the default dev DB connection of postgres://speckle:speckle@127.0.0.1/speckle. You can pass the environment variable PG_CONNECTION_STRING to change this to a different DB.

Deployment notes

When deploying the PreviewService, it's important to pay attention to the memory requirements: Speckle streams can be arbitrarily large and the preview service must load the entire stream in order to generate the preview image.

You must limit the PreviewService container memory to a value that you want to allocate for preview generation. If a stream requires more memory then the limit, the preview for that stream will fail, but the entire system remains stable.

To limit the container memory when running with docker run, you can use the -m flag.

With docker compose, you must use a docker compose file at version 2 (not 3) and use the mem_limit option.