Thumbnail Server Overview¶
Since Seafile 13.0, a new component thumbnail server is added. Thumbnail server can create thumbnails for images, videos, PDFs and other file types. Thumbnail server uses a task queue based architecture, it can better handle workloads than thumbnail generating inside Seahub component.
Use this feature by forwarding thumbnail requests directly to thumbnail server via caddy or a reverse proxy.
How to configure and run¶
First download thumbnail-server.yml
to Seafile directory:
wget https://manual.seafile.com/13.0/repo/docker/thumbnail-server.yml
Modify .env
, and insert thumbnail-server.yml
into COMPOSE_FILE
:
COMPOSE_FILE='seafile-server.yml,caddy.yml,thumbnail-server.yml'
Add following configuration in seahub_settings.py
to enable thumbnail for videos:
# video thumbnails (disabled by default)
ENABLE_VIDEO_THUMBNAIL = True
Finally, You can run thumbnail server with the following command:
docker compose down
docker compose up -d
Thumbnail Server in Seafile cluster¶
There is no additional features for thumbnail server in the Pro Edition. It works the same as in community edition.
If you enable clustering, You need to deploy thumbnail server on one of the servers, or a separate server. The load balancer should forward websockets requests to this node.
Download .env
and thumbnail-server.yml
to thumbnail server directory:
wget https://manual.seafile.com/13.0/repo/docker/thumbnail-server/thumbnail-server.yml
wget -O .env https://manual.seafile.com/13.0/repo/docker/thumbnail-server/env
Then modify the .env
file according to your environment. The following fields are needed to be modified:
variable | description |
---|---|
SEAFILE_VOLUME |
The volume directory of thumbnail server data |
SEAFILE_MYSQL_DB_HOST |
Seafile MySQL host |
SEAFILE_MYSQL_DB_USER |
Seafile MySQL user, default is seafile |
SEAFILE_MYSQL_DB_PASSWORD |
Seafile MySQL password |
TIME_ZONE |
Time zone |
JWT_PRIVATE_KEY |
JWT key, the same as the config in Seafile .env file |
INNER_SEAHUB_SERVICE_URL |
Intranet URL for accessing Seahub component, like http://<your Seafile server intranet IP> . |
SEAF_SERVER_STORAGE_TYPE |
What kind of the Seafile data for storage. Available options are disk (i.e., local disk), s3 and multiple (see the details of multiple storage backends) |
S3_COMMIT_BUCKET |
S3 storage backend commit objects bucket |
S3_FS_BUCKET |
S3 storage backend fs objects bucket |
S3_BLOCK_BUCKET |
S3 storage backend block objects bucket |
S3_KEY_ID |
S3 storage backend key ID |
S3_SECRET_KEY |
S3 storage backend secret key |
S3_AWS_REGION |
Region of your buckets |
S3_HOST |
Host of your buckets |
S3_USE_HTTPS |
Use HTTPS connections to S3 if enabled |
S3_USE_V4_SIGNATURE |
Use the v4 protocol of S3 if enabled |
S3_PATH_STYLE_REQUEST |
This option asks Seafile to use URLs like https://192.168.1.123:8080/bucketname/object to access objects. In Amazon S3, the default URL format is in virtual host style, such as https://bucketname.s3.amazonaws.com/object . But this style relies on advanced DNS server setup. So most self-hosted storage systems only implement the path style format. |
S3_SSE_C_KEY |
A string of 32 characters can be generated by openssl rand -base64 24. It can be any 32-character long random string. It's required to use V4 authentication protocol and https if you enable SSE-C. |
Then you can run thumbnail server with the following command:
docker compose up -d
You need to configure load balancer according to the following forwarding rules:
- Forward
/thumbnail
requests to thumbnail server via http protocol.
Here is a configuration that uses haproxy to support thumbnail server. Haproxy version needs to be >= 2.0. You should use similar configurations for other load balancers.
#/etc/haproxy/haproxy.cfg
# Other existing haproxy configurations
......
frontend seafile
bind 0.0.0.0:80
mode http
option httplog
option dontlognull
option forwardfor
acl thumbnail_request url_sub -i /thumbnail/
use_backend thumbnail_backend if thumbnail_request
default_backend backup_nodes
backend backup_nodes
cookie SERVERID insert indirect nocache
server seafileserver01 192.168.0.2:80
backend thumbnail_backend
option forwardfor
server thumbnail 192.168.0.9:80
Thumbnail server has to access Seafile' storage
The thumbnail server needs to access Seafile storage.
-
If you use local storage, you need to mount the
/opt/seafile-data
directory of the Seafile node to the thumbnail node, and setSEAFILE_VOLUME
to the mounted directory correctly. -
If you use single backend S3 storage, please correctly set relative environment vairables in
.env
. -
If you are using multiple storage backends, you have to copy the
seafile.conf
of the Seafile node to the/opt/seafile-data/seafile/conf
directory of the thumbnail node, and setSEAF_SERVER_STORAGE_TYPE=multiple
in.env
.
Thumbnail server directory structure¶
/opt/seafile-data
Placeholder spot for shared volumes. You may elect to store certain persistent information outside of a container, in our case we keep various log files outside. This allows you to rebuild containers easily without losing important information.
- /opt/seafile-data/conf: This is the directory for config files.
- /opt/seafile-data/logs: This is the directory for logs.
- /opt/seafile-data/seafile-data: This is the directory for seafile storage (if you use local storage).
- /opt/seafile-data/seahub-data/thumbnail: This is the directory for thumbnail files.