Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions services/web/server/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ echo "$INFO" "GUNICORN_CMD_ARGS: $GUNICORN_CMD_ARGS"
if [ "${SC_BOOT_MODE}" = "debug" ]; then
# NOTE: ptvsd is programmatically enabled inside of the service
# this way we can have reload in place as well
exec python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:"${WEBSERVER_REMOTE_DEBUGGING_PORT}" -m gunicorn simcore_service_webserver.cli:app_factory \
exec python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:"${WEBSERVER_REMOTE_DEBUGGING_PORT}" -m \
gunicorn simcore_service_webserver.cli:create_app_runner \
--log-level="${SERVER_LOG_LEVEL}" \
--bind 0.0.0.0:8080 \
--worker-class aiohttp.GunicornUVLoopWebWorker \
Expand All @@ -71,13 +72,16 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then

else

exec gunicorn simcore_service_webserver.cli:app_factory \
exec gunicorn simcore_service_webserver.cli:create_app_runner \
--log-level="${SERVER_LOG_LEVEL}" \
--bind 0.0.0.0:8080 \
--worker-class aiohttp.GunicornUVLoopWebWorker \
--workers="${WEBSERVER_GUNICORN_WORKERS:-1}" \
--name="webserver_$(hostname)_$(date +'%Y-%m-%d_%T')_$$" \
--access-logfile='-' \
--access-logformat='%a %t "%r" %s %b [%Dus] "%{Referer}i" "%{User-Agent}i"' \
--worker-tmp-dir=/dev/shm
--worker-tmp-dir=/dev/shm \
--limit-request-line 4094 \
--limit-request-fields 100 \
--limit-request-field_size 8190
fi
16 changes: 16 additions & 0 deletions services/web/server/src/simcore_service_webserver/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ async def app_factory() -> web.Application:
return app


_ACCESS_LOG_FMT = '%a %t "%r" %s %b [%Dus] "%{Referer}i" "%{User-Agent}i"'


async def create_app_runner() -> web.AppRunner:

app = await app_factory()

# Rejects requests that are oversized. Fixes https://github.com/ITISFoundation/osparc-simcore/issues/7979
return web.AppRunner(
app,
access_log_format=_ACCESS_LOG_FMT,
max_line_size=4094, # request line & single header line cap
max_field_size=8190, # per-header field cap
)


# CLI -------------

main = typer.Typer(name="simcore-service-webserver")
Expand Down
Loading