Added support for Thumbor (#1373)

This commit is contained in:
Peter Mein 2018-09-16 14:21:13 +02:00 committed by Shao Yu-Lung (Allen)
parent 61576c0b1b
commit 6a3b3fac2d
4 changed files with 258 additions and 0 deletions

View File

@ -1043,6 +1043,27 @@ docker-compose up -d minio
<br>
<a name="Use-Thumbor"></a>
## Use Thumbor
Thumbor is a smart imaging service. It enables on-demand crop, resizing and flipping of images. ([Thumbor](https://github.com/thumbor/thumbor))
1 - Configure Thumbor:
- Checkout all the options under the thumbor settings
2 - Run the Thumbor Container (`minio`) with the `docker-compose up` command. Example:
```bash
docker-compose up -d thumbor
```
3 - Navigate to an example image on `http://localhost:8000/unsafe/300x300/i.imgur.com/bvjzPct.jpg`
For more documentation on Thumbor visit the [Thumbor documenation](http://thumbor.readthedocs.io/en/latest/index.html) page
<br> <br>
<a name="Use-AWS"></a> <a name="Use-AWS"></a>
## Use AWS ## Use AWS

View File

@ -707,6 +707,122 @@ services:
networks: networks:
- backend - backend
### Thumbor #########################################
thumbor:
build: ./thumbor
volumes:
- ${DATA_SAVE_PATH}/thumbor/data:/data
- ${DATA_SAVE_PATH}/thumbor/data:/logs
ports:
- "${THUMBOR_PORT}:8000"
environment:
- THUMBOR_LOG_FORMAT=${THUMBOR_LOG_FORMAT}
- THUMBOR_LOG_DATE_FORMAT=${THUMBOR_LOG_DATE_FORMAT}
- MAX_WIDTH=${MAX_WIDTH}
- MAX_HEIGHT=${MAX_HEIGHT}
- MIN_WIDTH=${MIN_WIDTH}
- MIN_HEIGHT=${MIN_HEIGHT}
- ALLOWED_SOURCES=${ALLOWED_SOURCES}
- QUALITY=${QUALITY}
- WEBP_QUALITY=${WEBP_QUALITY}
- PNG_COMPRESSION_LEVEL=${PNG_COMPRESSION_LEVEL}
- AUTO_WEBP=${AUTO_WEBP}
- MAX_AGE=${MAX_AGE}
- MAX_AGE_TEMP_IMAGE=${MAX_AGE_TEMP_IMAGE}
- RESPECT_ORIENTATION=${RESPECT_ORIENTATION}
- IGNORE_SMART_ERRORS=${IGNORE_SMART_ERRORS}
- PRESERVE_EXIF_INFO=${PRESERVE_EXIF_INFO}
- ALLOW_ANIMATED_GIFS=${ALLOW_ANIMATED_GIFS}
- USE_GIFSICLE_ENGINE=${USE_GIFSICLE_ENGINE}
- USE_BLACKLIST=${USE_BLACKLIST}
- LOADER=${LOADER}
- STORAGE=${STORAGE}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- RESULT_STORAGE=${RESULT_STORAGE}
- ENGINE=${ENGINE}
- SECURITY_KEY=${SECURITY_KEY}
- ALLOW_UNSAFE_URL=${ALLOW_UNSAFE_URL}
- ALLOW_OLD_URLS=${ALLOW_OLD_URLS}
- FILE_LOADER_ROOT_PATH=${FILE_LOADER_ROOT_PATH}
- HTTP_LOADER_CONNECT_TIMEOUT=${HTTP_LOADER_CONNECT_TIMEOUT}
- HTTP_LOADER_REQUEST_TIMEOUT=${HTTP_LOADER_REQUEST_TIMEOUT}
- HTTP_LOADER_FOLLOW_REDIRECTS=${HTTP_LOADER_FOLLOW_REDIRECTS}
- HTTP_LOADER_MAX_REDIRECTS=${HTTP_LOADER_MAX_REDIRECTS}
- HTTP_LOADER_FORWARD_USER_AGENT=${HTTP_LOADER_FORWARD_USER_AGENT}
- HTTP_LOADER_DEFAULT_USER_AGENT=${HTTP_LOADER_DEFAULT_USER_AGENT}
- HTTP_LOADER_PROXY_HOST=${HTTP_LOADER_PROXY_HOST}
- HTTP_LOADER_PROXY_PORT=${HTTP_LOADER_PROXY_PORT}
- HTTP_LOADER_PROXY_USERNAME=${HTTP_LOADER_PROXY_USERNAME}
- HTTP_LOADER_PROXY_PASSWORD=${HTTP_LOADER_PROXY_PASSWORD}
- HTTP_LOADER_CA_CERTS=${HTTP_LOADER_CA_CERTS}
- HTTP_LOADER_VALIDATE_CERTS=${HTTP_LOADER_VALIDATE_CERTS}
- HTTP_LOADER_CLIENT_KEY=${HTTP_LOADER_CLIENT_KEY}
- HTTP_LOADER_CLIENT_CERT=${HTTP_LOADER_CLIENT_CERT}
- HTTP_LOADER_CURL_ASYNC_HTTP_CLIENT=${HTTP_LOADER_CURL_ASYNC_HTTP_CLIENT}
- STORAGE_EXPIRATION_SECONDS=${STORAGE_EXPIRATION_SECONDS}
- STORES_CRYPTO_KEY_FOR_EACH_IMAGE=${STORES_CRYPTO_KEY_FOR_EACH_IMAGE}
- FILE_STORAGE_ROOT_PATH=${FILE_STORAGE_ROOT_PATH}
- UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE}
- UPLOAD_ENABLED=${UPLOAD_ENABLED}
- UPLOAD_PHOTO_STORAGE=${UPLOAD_PHOTO_STORAGE}
- UPLOAD_DELETE_ALLOWED=${UPLOAD_DELETE_ALLOWED}
- UPLOAD_PUT_ALLOWED=${UPLOAD_PUT_ALLOWED}
- UPLOAD_DEFAULT_FILENAME=${UPLOAD_DEFAULT_FILENAME}
- MONGO_STORAGE_SERVER_HOST=${MONGO_STORAGE_SERVER_HOST}
- MONGO_STORAGE_SERVER_PORT=${MONGO_STORAGE_SERVER_PORT}
- MONGO_STORAGE_SERVER_DB=${MONGO_STORAGE_SERVER_DB}
- MONGO_STORAGE_SERVER_COLLECTION=${MONGO_STORAGE_SERVER_COLLECTION}
- REDIS_STORAGE_SERVER_HOST=${REDIS_STORAGE_SERVER_HOST}
- REDIS_STORAGE_SERVER_PORT=${REDIS_STORAGE_SERVER_PORT}
- REDIS_STORAGE_SERVER_DB=${REDIS_STORAGE_SERVER_DB}
- REDIS_STORAGE_SERVER_PASSWORD=${REDIS_STORAGE_SERVER_PASSWORD}
- REDIS_RESULT_STORAGE_SERVER_HOST=${REDIS_RESULT_STORAGE_SERVER_HOST}
- REDIS_RESULT_STORAGE_SERVER_PORT=${REDIS_RESULT_STORAGE_SERVER_PORT}
- REDIS_RESULT_STORAGE_SERVER_DB=${REDIS_RESULT_STORAGE_SERVER_DB}
- REDIS_RESULT_STORAGE_SERVER_PASSWORD=${REDIS_RESULT_STORAGE_SERVER_PASSWORD}
- MEMCACHE_STORAGE_SERVERS=${MEMCACHE_STORAGE_SERVERS}
- MIXED_STORAGE_FILE_STORAGE=${MIXED_STORAGE_FILE_STORAGE}
- MIXED_STORAGE_CRYPTO_STORAGE=${MIXED_STORAGE_CRYPTO_STORAGE}
- MIXED_STORAGE_DETECTOR_STORAGE=${MIXED_STORAGE_DETECTOR_STORAGE}
- META_CALLBACK_NAME=${META_CALLBACK_NAME}
- DETECTORS=${DETECTORS}
- FACE_DETECTOR_CASCADE_FILE=${FACE_DETECTOR_CASCADE_FILE}
- OPTIMIZERS=${OPTIMIZERS}
- JPEGTRAN_PATH=${JPEGTRAN_PATH}
- PROGRESSIVE_JPEG=${PROGRESSIVE_JPEG}
- RESULT_STORAGE_EXPIRATION_SECONDS=${RESULT_STORAGE_EXPIRATION_SECONDS}
- RESULT_STORAGE_FILE_STORAGE_ROOT_PATH=${RESULT_STORAGE_FILE_STORAGE_ROOT_PATH}
- RESULT_STORAGE_STORES_UNSAFE=${RESULT_STORAGE_STORES_UNSAFE}
- REDIS_QUEUE_SERVER_HOST=${REDIS_QUEUE_SERVER_HOST}
- REDIS_QUEUE_SERVER_PORT=${REDIS_QUEUE_SERVER_PORT}
- REDIS_QUEUE_SERVER_DB=${REDIS_QUEUE_SERVER_DB}
- REDIS_QUEUE_SERVER_PASSWORD=${REDIS_QUEUE_SERVER_PASSWORD}
- SQS_QUEUE_KEY_ID=${SQS_QUEUE_KEY_ID}
- SQS_QUEUE_KEY_SECRET=${SQS_QUEUE_KEY_SECRET}
- SQS_QUEUE_REGION=${SQS_QUEUE_REGION}
- USE_CUSTOM_ERROR_HANDLING=${USE_CUSTOM_ERROR_HANDLING}
- ERROR_HANDLER_MODULE=${ERROR_HANDLER_MODULE}
- ERROR_FILE_LOGGER=${ERROR_FILE_LOGGER}
- ERROR_FILE_NAME_USE_CONTEXT=${ERROR_FILE_NAME_USE_CONTEXT}
- SENTRY_DSN_URL=${SENTRY_DSN_URL}
- TC_AWS_REGION=${TC_AWS_REGION}
- TC_AWS_ENDPOINT=${TC_AWS_ENDPOINT}
- TC_AWS_STORAGE_BUCKET=${TC_AWS_STORAGE_BUCKET}
- TC_AWS_STORAGE_ROOT_PATH=${TC_AWS_STORAGE_ROOT_PATH}
- TC_AWS_LOADER_BUCKET=${TC_AWS_LOADER_BUCKET}
- TC_AWS_LOADER_ROOT_PATH=${TC_AWS_LOADER_ROOT_PATH}
- TC_AWS_RESULT_STORAGE_BUCKET=${TC_AWS_RESULT_STORAGE_BUCKET}
- TC_AWS_RESULT_STORAGE_ROOT_PATH=${TC_AWS_RESULT_STORAGE_ROOT_PATH}
- TC_AWS_STORAGE_SSE=${TC_AWS_STORAGE_SSE}
- TC_AWS_STORAGE_RRS=${TC_AWS_STORAGE_RRS}
- TC_AWS_ENABLE_HTTP_LOADER=${TC_AWS_ENABLE_HTTP_LOADER}
- TC_AWS_ALLOWED_BUCKETS=${TC_AWS_ALLOWED_BUCKETS}
- TC_AWS_STORE_METADATA=${TC_AWS_STORE_METADATA}
networks:
- frontend
- backend
### AWS EB-CLI ################################################ ### AWS EB-CLI ################################################
aws: aws:
build: build:

View File

@ -365,6 +365,122 @@ CADDY_CONFIG_PATH=./caddy/caddy
LARAVEL_ECHO_SERVER_PORT=6001 LARAVEL_ECHO_SERVER_PORT=6001
### DOCKER-SYNC ########################################################################################################
# osx: 'native_osx' (default)
# windows: 'unison'
# linux: docker-sync not required
DOCKER_SYNC_STRATEGY=native_osx
### THUMBOR ############################################################################################################
THUMBOR_PORT=8000
THUMBOR_LOG_FORMAT="%(asctime)s %(name)s:%(levelname)s %(message)s"
THUMBOR_LOG_DATE_FORMAT="%Y-%m-%d %H:%M:%S"
MAX_WIDTH=0
MAX_HEIGHT=0
MIN_WIDTH=1
MIN_HEIGHT=1
ALLOWED_SOURCES=[]
QUALITY=80
WEBP_QUALITY=None
PNG_COMPRESSION_LEVEL=6
AUTO_WEBP=False
MAX_AGE=86400
MAX_AGE_TEMP_IMAGE=0
RESPECT_ORIENTATION=False
IGNORE_SMART_ERRORS=False
PRESERVE_EXIF_INFO=False
ALLOW_ANIMATED_GIFS=True
USE_GIFSICLE_ENGINE=False
USE_BLACKLIST=False
LOADER=thumbor.loaders.http_loader
STORAGE=thumbor.storages.file_storage
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
RESULT_STORAGE=thumbor.result_storages.file_storage
ENGINE=thumbor.engines.pil
SECURITY_KEY="MY_SECURE_KEY"
ALLOW_UNSAFE_URL=True
ALLOW_OLD_URLS=True
FILE_LOADER_ROOT_PATH=/data/loader
HTTP_LOADER_CONNECT_TIMEOUT=5
HTTP_LOADER_REQUEST_TIMEOUT=20
HTTP_LOADER_FOLLOW_REDIRECTS=True
HTTP_LOADER_MAX_REDIRECTS=5
HTTP_LOADER_FORWARD_USER_AGENT=False
HTTP_LOADER_DEFAULT_USER_AGENT="Thumbor/5.2.1"
HTTP_LOADER_PROXY_HOST=None
HTTP_LOADER_PROXY_PORT=None
HTTP_LOADER_PROXY_USERNAME=None
HTTP_LOADER_PROXY_PASSWORD=None
HTTP_LOADER_CA_CERTS=None
HTTP_LOADER_VALIDATE_CERTS=True
HTTP_LOADER_CLIENT_KEY=None
HTTP_LOADER_CLIENT_CERT=None
HTTP_LOADER_CURL_ASYNC_HTTP_CLIENT=False
STORAGE_EXPIRATION_SECONDS=2592000
STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False
FILE_STORAGE_ROOT_PATH=/data/storage
UPLOAD_MAX_SIZE=0
UPLOAD_ENABLED=False
UPLOAD_PHOTO_STORAGE=thumbor.storages.file_storage
UPLOAD_DELETE_ALLOWED=False
UPLOAD_PUT_ALLOWED=False
UPLOAD_DEFAULT_FILENAME=image
MONGO_STORAGE_SERVER_HOST=mongo
MONGO_STORAGE_SERVER_PORT=27017
MONGO_STORAGE_SERVER_DB=thumbor
MONGO_STORAGE_SERVER_COLLECTION=images
REDIS_STORAGE_SERVER_HOST=redis
REDIS_STORAGE_SERVER_PORT=6379
REDIS_STORAGE_SERVER_DB=0
REDIS_STORAGE_SERVER_PASSWORD=None
REDIS_RESULT_STORAGE_SERVER_HOST=redis
REDIS_RESULT_STORAGE_SERVER_PORT=6379
REDIS_RESULT_STORAGE_SERVER_DB=0
REDIS_RESULT_STORAGE_SERVER_PASSWORD=None
MEMCACHE_STORAGE_SERVERS=["localhost:11211",]
MIXED_STORAGE_FILE_STORAGE=thumbor.storages.no_storage
MIXED_STORAGE_CRYPTO_STORAGE=thumbor.storages.no_storage
MIXED_STORAGE_DETECTOR_STORAGE=thumbor.storages.no_storage
META_CALLBACK_NAME=None
DETECTORS=[]
FACE_DETECTOR_CASCADE_FILE=haarcascade_frontalface_alt.xml
OPTIMIZERS=[]
JPEGTRAN_PATH=/usr/bin/jpegtran
PROGRESSIVE_JPEG=True
FILTERS=["thumbor.filters.brightness", "thumbor.filters.contrast", "thumbor.filters.rgb", "thumbor.filters.round_corner", "thumbor.filters.quality", "thumbor.filters.noise", "thumbor.filters.watermark", "thumbor.filters.equalize", "thumbor.filters.fill", "thumbor.filters.sharpen", "thumbor.filters.strip_icc", "thumbor.filters.frame", "thumbor.filters.grayscale", "thumbor.filters.rotate", "thumbor.filters.format", "thumbor.filters.max_bytes", "thumbor.filters.convolution", "thumbor.filters.blur", "thumbor.filters.extract_focal", "thumbor.filters.no_upscale"]
RESULT_STORAGE_EXPIRATION_SECONDS=0
RESULT_STORAGE_FILE_STORAGE_ROOT_PATH=/data/result_storage
RESULT_STORAGE_STORES_UNSAFE=False
REDIS_QUEUE_SERVER_HOST=redis
REDIS_QUEUE_SERVER_PORT=6379
REDIS_QUEUE_SERVER_DB="0"
REDIS_QUEUE_SERVER_PASSWORD=None
SQS_QUEUE_KEY_ID=None
SQS_QUEUE_KEY_SECRET=None
SQS_QUEUE_REGION=us-east-1
USE_CUSTOM_ERROR_HANDLING=False
ERROR_HANDLER_MODULE=thumbor.error_handlers.sentry
ERROR_FILE_LOGGER=None
ERROR_FILE_NAME_USE_CONTEXT="False"
SENTRY_DSN_URL=
TC_AWS_REGION=eu-west-1
TC_AWS_ENDPOINT=None
TC_AWS_STORAGE_BUCKET=
TC_AWS_STORAGE_ROOT_PATH=
TC_AWS_LOADER_BUCKET=
TC_AWS_LOADER_ROOT_PATH=
TC_AWS_RESULT_STORAGE_BUCKET=
TC_AWS_RESULT_STORAGE_ROOT_PATH=
TC_AWS_STORAGE_SSE=False
TC_AWS_STORAGE_RRS=False
TC_AWS_ENABLE_HTTP_LOADER=False
TC_AWS_ALLOWED_BUCKETS=False
TC_AWS_STORE_METADATA=False
### SOLR ################################################## ### SOLR ##################################################
SOLR_VERSION=5.5 SOLR_VERSION=5.5

5
thumbor/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM apsl/thumbor
CMD ["thumbor"]
EXPOSE 8000