mirror of https://github.com/zulip/zulip.git
thumbnaling: Support S3 upload backend in thumbor.
Credits for doing this goes to @sampritipanda.
This commit is contained in:
parent
98a4e87e1d
commit
529e4e76c8
|
@ -254,6 +254,7 @@ ENABLE_FILE_LINKS = False
|
|||
LOCAL_UPLOADS_DIR = "/home/zulip/uploads"
|
||||
#S3_AUTH_UPLOADS_BUCKET = ""
|
||||
#S3_AVATAR_BUCKET = ""
|
||||
#S3_REGION = ""
|
||||
|
||||
# Maximum allowed size of uploaded files, in megabytes. DO NOT SET
|
||||
# ABOVE 80MB. The file upload implementation doesn't support chunked
|
||||
|
|
|
@ -166,6 +166,8 @@ DEFAULT_SETTINGS = {
|
|||
# File uploads and avatars
|
||||
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
||||
'S3_AVATAR_BUCKET': '',
|
||||
'S3_AUTH_UPLOADS_BUCKET': '',
|
||||
'S3_REGION': '',
|
||||
'LOCAL_UPLOADS_DIR': None,
|
||||
'MAX_FILE_UPLOAD_SIZE': 25,
|
||||
|
||||
|
|
|
@ -23,18 +23,17 @@ if PRODUCTION:
|
|||
else:
|
||||
from zproject.dev_settings import LOCAL_UPLOADS_DIR
|
||||
|
||||
IS_LOCAL_STORAGE = bool(LOCAL_UPLOADS_DIR)
|
||||
|
||||
################################# File Loader ##################################
|
||||
|
||||
## The root path where the File Loader will try to find images
|
||||
if IS_LOCAL_STORAGE:
|
||||
if os.path.isabs(LOCAL_UPLOADS_DIR):
|
||||
FILE_LOADER_ROOT_PATH = LOCAL_UPLOADS_DIR
|
||||
else:
|
||||
FILE_LOADER_ROOT_PATH = os.path.join(ZULIP_PATH, LOCAL_UPLOADS_DIR)
|
||||
|
||||
################################################################################
|
||||
|
||||
IS_LOCAL_STORAGE = bool(LOCAL_UPLOADS_DIR)
|
||||
|
||||
################################### Logging ####################################
|
||||
|
||||
## Logging configuration as json
|
||||
|
@ -560,6 +559,7 @@ ALLOW_OLD_URLS = False
|
|||
|
||||
## Path where the Result storage will store generated images
|
||||
## Defaults to: '/tmp/thumbor/result_storage'
|
||||
if IS_LOCAL_STORAGE:
|
||||
RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = os.path.join(FILE_LOADER_ROOT_PATH, 'thumbnails')
|
||||
|
||||
## Indicates whether unsafe requests should also be stored in the Result Storage
|
||||
|
@ -651,16 +651,23 @@ RESULT_STORAGE_STORES_UNSAFE = True
|
|||
|
||||
|
||||
################################### AWS S3 settings ############################
|
||||
# TC_AWS_REGION= # AWS Region
|
||||
|
||||
# TC_AWS_STORAGE_BUCKET= # S3 bucket for Storage
|
||||
# TC_AWS_STORAGE_ROOT_PATH= # S3 path prefix for Storage bucket
|
||||
if not IS_LOCAL_STORAGE:
|
||||
if PRODUCTION:
|
||||
from zproject.prod_settings import S3_AUTH_UPLOADS_BUCKET, S3_REGION
|
||||
else:
|
||||
from zproject.dev_settings import S3_AUTH_UPLOADS_BUCKET, S3_REGION
|
||||
|
||||
# TC_AWS_LOADER_BUCKET= #S3 bucket for loader
|
||||
# TC_AWS_LOADER_ROOT_PATH= # S3 path prefix for Loader bucket
|
||||
TC_AWS_REGION = S3_REGION # AWS Region
|
||||
|
||||
# TC_AWS_RESULT_STORAGE_BUCKET= # S3 bucket for result Storage
|
||||
# TC_AWS_RESULT_STORAGE_ROOT_PATH= # S3 path prefix for Result storage bucket
|
||||
TC_AWS_STORAGE_BUCKET = S3_AUTH_UPLOADS_BUCKET # S3 bucket for Storage
|
||||
TC_AWS_STORAGE_ROOT_PATH = 'thumbnails' # S3 path prefix for Storage bucket
|
||||
|
||||
TC_AWS_LOADER_BUCKET = S3_AUTH_UPLOADS_BUCKET #S3 bucket for loader
|
||||
TC_AWS_LOADER_ROOT_PATH = '' # S3 path prefix for Loader bucket
|
||||
|
||||
TC_AWS_RESULT_STORAGE_BUCKET = S3_AUTH_UPLOADS_BUCKET # S3 bucket for result Storage
|
||||
TC_AWS_RESULT_STORAGE_ROOT_PATH = 'thumbnails' # S3 path prefix for Result storage bucket
|
||||
|
||||
TC_AWS_MAX_RETRY=0 # Max retries for get image from S3 Bucket. Default is 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue