mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-25 03:51:24 +00:00
366 lines
11 KiB
TOML
366 lines
11 KiB
TOML
## Server configuration
|
|
[server]
|
|
## Optional: pict-rs binding address
|
|
# environment variable: PICTRS__SERVER__ADDRESS
|
|
# default: 0.0.0.0:8080
|
|
address = '0.0.0.0:8080'
|
|
|
|
## Optional: pict-rs worker id
|
|
# environment variable PICTRS__SERVER__WORKER_ID
|
|
# default: pict-rs-1
|
|
#
|
|
# This is used for the internal job queue. It will have more meaning once a shared metadata
|
|
# repository (like postgres) can be defined.
|
|
worker_id = 'pict-rs-1'
|
|
|
|
## Optional: shared secret for internal endpoints
|
|
# environment variable: PICTRS__SERVER__API_KEY
|
|
# default: empty
|
|
#
|
|
# Not specifying api_key disables internal endpoints
|
|
api_key = 'API_KEY'
|
|
|
|
## Optional: connection pool size for internal http client
|
|
# environment variable: PICTRS__SERVER__CLIENT_POOL_SIZE
|
|
# default: 100
|
|
#
|
|
# This number is multiplied the number of cores available to pict-rs. Running on a 2 core machine
|
|
# with the default value will result in 200 pooled connections. Running on a 32 core machine with
|
|
# the default value will result in 3200 pooled connections.
|
|
#
|
|
# This number can be lowered to keep pict-rs within ulimit bounds if you encounter errors related to
|
|
# "Too many open files". Alternatively, increasing the ulimit of your system can solve this problem
|
|
# as well.
|
|
client_pool_size = 100
|
|
|
|
|
|
## Logging configuration
|
|
[tracing.logging]
|
|
## Optional: log format
|
|
# environment variable: PICTRS__TRACING__LOGGING__FORMAT
|
|
# default: normal
|
|
#
|
|
# available options: compact, json, normal, pretty
|
|
format = 'normal'
|
|
|
|
## Optional: log targets
|
|
# environment variable: PICTRS__TRACING__LOGGING__TARGETS
|
|
# default: warn,tracing_actix_web=info,actix_server=info,actix_web=info
|
|
#
|
|
# Dictates which traces should print to stdout
|
|
# Follows the same format as RUST_LOG
|
|
targets = 'warn,tracing_actix_web=info,actix_server=info,actix_web=info'
|
|
|
|
|
|
## Console configuration
|
|
[tracing.console]
|
|
## Optional: console address
|
|
# environment variable: PICTRS__TRACING__CONSOLE__ADDRESS
|
|
# default: empty
|
|
#
|
|
# Dictates whether console should be enabled, and what address it should be exposed on.
|
|
#
|
|
# When set, tokio-console can connect to the pict-rs service
|
|
#
|
|
# Configure your container to expose the console port
|
|
# ```
|
|
# # docker-compose.yml
|
|
# version: '3.3'
|
|
#
|
|
# services:
|
|
# pictrs:
|
|
# image: asonix/pictrs:0.4.1
|
|
# ports:
|
|
# - "127.0.0.1:8080:8080"
|
|
# - "127.0.0.1:6669:6669" # this is the line that exposes console
|
|
# restart: always
|
|
# volumes:
|
|
# - ./volumes/pictrs:/mnt
|
|
# ```
|
|
#
|
|
# Connect from console
|
|
# ```
|
|
# $ tokio-console http://localhost:6669
|
|
# ```
|
|
address = '0.0.0.0:6669'
|
|
|
|
## Optional: console buffer capacity
|
|
# environment variable: PICTRS__TRACING__CONSOLE__BUFFER_CAPACITY
|
|
# default: 102400
|
|
#
|
|
# This is the number of _events_ to buffer, not the number of bytes. In reality, the amount of
|
|
# RAM used will be significatnly larger (in bytes) than the buffer capacity (in events)
|
|
buffer_capacity = 102400
|
|
|
|
|
|
## OpenTelemetry configuration
|
|
[tracing.opentelemetry]
|
|
## Optional: url for exporting otlp traces
|
|
# environment variable: PICTRS__TRACING__OPENTELEMETRY__URL
|
|
# default: empty
|
|
#
|
|
# Not specifying opentelemetry_url means no traces will be exported
|
|
# When set, pict-rs will export OpenTelemetry traces to the provided URL. If the URL is
|
|
# inaccessible, this can cause performance degredation in pict-rs, so it is best left unset unless
|
|
# you have an OpenTelemetry collector
|
|
url = 'http://localhost:4317/'
|
|
|
|
## Optional: name to relate OpenTelemetry traces
|
|
# environment variable: PICTRS__TRACING__OPENTELEMETRY__SERVICE_NAME
|
|
# default: pict-rs
|
|
service_name = 'pict-rs'
|
|
|
|
## Optional: trace level to export
|
|
# environment variable: PICTRS__TRACING__OPENTELEMETRY__TARGETS
|
|
# default: info
|
|
#
|
|
# Follows the same format as RUST_LOG
|
|
targets = 'info'
|
|
|
|
|
|
## Configuration for migrating from pict-rs 0.2
|
|
[old_db]
|
|
## Optional: path to old pict-rs directory
|
|
# environment variable: PICTRS__OLD_DB__PATH
|
|
# default: /mnt
|
|
path = '/mnt'
|
|
|
|
|
|
## Media Processing Configuration
|
|
[media]
|
|
## Optional: preprocessing steps for uploaded images
|
|
# environment variable: PICTRS__MEDIA__PREPROCESS_STEPS
|
|
# default: empty
|
|
#
|
|
# This configuration is the same format as the process endpoint's query arguments
|
|
preprocess_steps = 'crop=16x9&resize=1200&blur=0.2'
|
|
|
|
## Optional: max media width (in pixels)
|
|
# environment variable: PICTRS__MEDIA__MAX_WIDTH
|
|
# default: 10,000
|
|
max_width = 10000
|
|
|
|
## Optional: max media height (in pixels)
|
|
# environment variable: PICTRS__MEDIA__MAX_HEIGHT
|
|
# default: 10,000
|
|
max_height = 10000
|
|
|
|
## Optional: max media area (in pixels)
|
|
# environment variable: PICTRS__MEDIA__MAX_AREA
|
|
# default: 40,000,000
|
|
max_area = 40000000
|
|
|
|
## Optional: max file size (in Megabytes)
|
|
# environment variable: PICTRS__MEDIA__MAX_FILE_SIZE
|
|
# default: 40
|
|
max_file_size = 40
|
|
|
|
## Optional: max frame count
|
|
# environment variable: PICTRS__MEDIA__MAX_FRAME_COUNT
|
|
# default: # 900
|
|
max_frame_count = 900
|
|
|
|
## Optional: enable GIF, MP4, and WEBM uploads (without sound)
|
|
# environment variable: PICTRS__MEDIA__ENABLE_SILENT_VIDEO
|
|
# default: true
|
|
#
|
|
# Set this to false to serve static images only
|
|
enable_silent_video = true
|
|
|
|
## Optional: enable MP4, and WEBM uploads (with sound) and GIF (without sound)
|
|
# environment variable: PICTRS__MEDIA__ENABLE_FULL_VIDEO
|
|
# default: false
|
|
enable_full_video = false
|
|
|
|
## Optional: set the default video codec
|
|
# environment variable: PICTRS__MEDIA__VIDEO_CODEC
|
|
# default: vp9
|
|
#
|
|
# available options: av1, h264, h265, vp8, vp9
|
|
# this setting does nothing if video is not enabled
|
|
video_codec = "vp9"
|
|
|
|
## Optional: set the default audio codec
|
|
# environment variable: PICTRS__MEDIA__AUDIO_CODEC
|
|
# default: empty
|
|
#
|
|
# available options: aac, opus, vorbis
|
|
# The audio codec is automatically selected based on video codec, but can be overriden
|
|
# av1, vp8, and vp9 map to opus
|
|
# h264 and h265 map to aac
|
|
# vorbis is not default for any codec
|
|
# this setting does nothing if full video is not enabled
|
|
audio_codec = "aac"
|
|
|
|
## Optional: set allowed filters for image processing
|
|
# environment variable: PICTRS__MEDIA__FILTERS
|
|
# default: ['blur', 'crop', 'identity', 'resize', 'thumbnail']
|
|
filters = ['blur', 'crop', 'identity', 'resize', 'thumbnail']
|
|
|
|
## Optional: set file type for all uploads
|
|
# environment variable: PICTRS__MEDIA__FORMAT
|
|
# default: empty
|
|
#
|
|
# available options: avif, png, jpeg, jxl, webp
|
|
# When set, all uploaded still images will be converted to this file type. For balancing quality vs
|
|
# file size vs browser support, 'avif', 'jxl', and 'webp' should be considered. By default, images
|
|
# are stored in their original file type.
|
|
format = "webp"
|
|
|
|
## Optional: whether to validate images uploaded through the `import` endpoint
|
|
# environment variable: PICTRS__MEDIA__SKIP_VALIDATE_IMPORTS
|
|
# default: false
|
|
#
|
|
# Set this to true if you want to avoid processing imported media
|
|
skip_validate_imports = false
|
|
|
|
## Gif configuration
|
|
#
|
|
# Making any of these bounds 0 will disable gif uploads
|
|
[media.gif]
|
|
# Optional: Maximum width in pixels for uploaded gifs
|
|
# environment variable: PICTRS__MEDIA__GIF__MAX_WIDTH
|
|
# default: 128
|
|
#
|
|
# If a gif does not fit within this bound, it will either be transcoded to a video or rejected,
|
|
# depending on whether video uploads are enabled
|
|
max_width = 128
|
|
|
|
# Optional: Maximum height in pixels for uploaded gifs
|
|
# environment variable: PICTRS__MEDIA__GIF__MAX_HEIGHT
|
|
# default: 128
|
|
#
|
|
# If a gif does not fit within this bound, it will either be transcoded to a video or rejected,
|
|
# depending on whether video uploads are enabled
|
|
max_height = 128
|
|
|
|
# Optional: Maximum area in pixels for uploaded gifs
|
|
# environment variable: PICTRS__MEDIA__GIF__MAX_AREA
|
|
# default: 16384 (128 * 128)
|
|
#
|
|
# If a gif does not fit within this bound, it will either be transcoded to a video or rejected,
|
|
# depending on whether video uploads are enabled
|
|
max_area = 16384
|
|
|
|
# Optional: Maximum number of frames permitted in uploaded gifs
|
|
# environment variable: PICTRS__MEDIA__GIF__MAX_FRAME_COUNT
|
|
# default: 100
|
|
#
|
|
# If a gif does not fit within this bound, it will either be transcoded to a video or rejected,
|
|
# depending on whether video uploads are enabled
|
|
max_frame_count = 100
|
|
|
|
|
|
## Database configuration
|
|
[repo]
|
|
## Optional: database backend to use
|
|
# environment variable: PICTRS__REPO__TYPE
|
|
# default: sled
|
|
#
|
|
# available options: sled
|
|
type = 'sled'
|
|
|
|
## Optional: path to sled repository
|
|
# environment variable: PICTRS__REPO__PATH
|
|
# default: /mnt/sled-repo
|
|
path = '/mnt/sled-repo'
|
|
|
|
## Optional: in-memory cache capacity for sled data (in bytes)
|
|
# environment variable: PICTRS__REPO__CACHE_CAPACITY
|
|
# default: 67,108,864 (1024 * 1024 * 64, or 64MB)
|
|
cache_capacity = 67108864
|
|
|
|
## Optional: path for storing database exports
|
|
# environment variable: PICTRS__REPO__EXPORT_PATH
|
|
# default: /mnt/exports
|
|
#
|
|
# Used in combination with the /internal/export endpoint to dump the current sled database into a
|
|
# new file. This can be helpful for backing up a running pict-rs server.
|
|
export_path = "/mnt/exports"
|
|
|
|
|
|
## Media storage configuration
|
|
[store]
|
|
## Optional: type of media storage to use
|
|
# environment variable: PICTRS__STORE__TYPE
|
|
# default: filesystem
|
|
#
|
|
# available options: filesystem, object_storage
|
|
type = 'object_storage'
|
|
|
|
## Required: endpoint at which the object storage exists
|
|
# environment variable: PICTRS__STORE__ENDPOINT
|
|
# default: empty
|
|
#
|
|
# examples:
|
|
# - `http://localhost:9000` # minio
|
|
# - `https://s3.dualstack.eu-west-1.amazonaws.com` # s3
|
|
endpoint = 'http://minio:9000'
|
|
|
|
## Optional: How to format object storage requests
|
|
# environment variable: PICTRS__STORE__USE_PATH_STYLE
|
|
# default: false
|
|
#
|
|
# When this is true, objects will be fetched from http{s}://{endpoint}:{port}/{bucket_name}/{object}
|
|
# When false, objects will be fetched from http{s}://{bucket_name}.{endpoint}:{port}/{object}
|
|
#
|
|
# Set to true when using minio
|
|
use_path_style = false
|
|
|
|
## Required: object storage bucket name
|
|
# environment variable: PICTRS__STORE__BUCKET_NAME
|
|
# default: empty
|
|
bucket_name = 'pict-rs'
|
|
|
|
## Required: object storage region
|
|
# environment variable: PICTRS__STORE__REGION
|
|
# default: empty
|
|
#
|
|
# When using minio, this can be set to `minio`
|
|
region = 'minio'
|
|
|
|
## Required: object storage access key
|
|
# environment variable: PICTRS__STORE__ACCESS_KEY
|
|
# default: empty
|
|
access_key = 'ACCESS_KEY'
|
|
|
|
## Required: object storage secret key
|
|
# environment variable: PICTRS__STORE__SECRET_KEY
|
|
# default: empty
|
|
secret_key = 'SECRET_KEY'
|
|
|
|
## Optional: object storage session token
|
|
# environment variable: PICTRS__STORE__SESSION_TOKEN
|
|
# default: empty
|
|
session_token = 'SESSION_TOKEN'
|
|
|
|
## Optional: set how long object storage signatures are valid for (in seconds)
|
|
# environment variable: PICTRS__STORE__SIGNATURE_EXPIRATION
|
|
# default: 15
|
|
#
|
|
# This can be useful if your object storage might take a while to process requests. It should not be
|
|
# increased more than needed to prevent replay attacks.
|
|
signature_expiration = 15
|
|
|
|
## Optional: set how long pict-rs will wait (in seconds) for a response from object storage
|
|
# environment variable: PICTRS__STORE__CLIENT_TIMEOUT
|
|
# default: 30
|
|
#
|
|
# This value is the total wait time, and not additional wait time on top of the
|
|
# signature_expiration.
|
|
client_timeout = 30
|
|
|
|
## Filesystem media storage example
|
|
# ## Media storage configuration
|
|
# [store]
|
|
# ## Optional: type of media storage to use
|
|
# # environment variable: PICTRS__STORE__TYPE
|
|
# # default: filesystem
|
|
# #
|
|
# # available options: filesystem, object_storage
|
|
# type = 'filesystem'
|
|
#
|
|
# ## Optional: path to uploaded media
|
|
# # environment variable: PICTRS__STORE__PATH
|
|
# # default: /mnt/files
|
|
# path = '/mnt/files'
|