unlimitedbacon / stl-thumb

Thumbnail generator for STL files
MIT License
1.13k stars 97 forks source link

Add a note about running on a headless server #55

Open Bonemind opened 2 years ago

Bonemind commented 2 years ago

Currently, if you run stl-thumb on a fully headless server, so no X11/Wayland installed, only accessible through ssh, I get the following error:

⟩ stl-thumb 32mm.stl 32mm.png
thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:619:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The app can be run by using xvfb-run:

xvfb-run stl-thumb 32mm.stl 32mm.png

Which generates a thumbnail correctly. This is on Arch linux. Figured it might be of interest to anyone passing by trying to run this on a server for example.

Also, amazing tool, there are surprisingly few ways to quickly generate a png from an stl.

unlimitedbacon commented 2 years ago

Are you on the latest version? It should be able to run without xvfb-run now. Note that it may be printing the error message but successfully generating an image anyways.

Bonemind commented 2 years ago

Ah, you're right. It does generate the image successfully, exit code also seems to make sense. So the error seems to be mostly cosmetic. Thanks!

unlimitedbacon commented 2 years ago

No problem. I will try to suppress the error message in the future.

demonlibra commented 2 years ago

For server can try fast and compact https://github.com/aslze/minirender At this moment using minirender to create thumbnails for telegram bot. ./minirender -o -- -w 500 model.stl | convert - thumb.png