-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
# ================================================================= | ||
# | ||
# Authors: Just van den Broecke <[email protected]> | ||
# Ben Webb <[email protected]> | ||
# | ||
# Copyright (c) 2019 Just van den Broecke | ||
# Copyright (c) 2024 Ben Webb | ||
# | ||
# Permission is hereby granted, free of charge, to any person | ||
# obtaining a copy of this software and associated documentation | ||
|
@@ -102,8 +104,30 @@ case ${entry_cmd} in | |
--bind ${CONTAINER_HOST}:${CONTAINER_PORT} \ | ||
pygeoapi.flask_app:APP | ||
;; | ||
|
||
# Run pygeoapi server with hot reload | ||
hot-reload) | ||
# Lock all Python files (for gunicorn hot reload) | ||
find . -type f -name "*.py" | xargs chmod 0444 | ||
|
||
# SCRIPT_NAME should not have value '/' | ||
[[ "${SCRIPT_NAME}" = '/' ]] && export SCRIPT_NAME="" && echo "make SCRIPT_NAME empty from /" | ||
|
||
echo "Start gunicorn name=${CONTAINER_NAME} on ${CONTAINER_HOST}:${CONTAINER_PORT} with ${WSGI_WORKERS} workers and SCRIPT_NAME=${SCRIPT_NAME}" | ||
exec gunicorn --workers ${WSGI_WORKERS} \ | ||
--worker-class=${WSGI_WORKER_CLASS} \ | ||
--timeout ${WSGI_WORKER_TIMEOUT} \ | ||
--name=${CONTAINER_NAME} \ | ||
--bind ${CONTAINER_HOST}:${CONTAINER_PORT} \ | ||
--reload \ | ||
--reload-extra-file ${PYGEOAPI_CONFIG} \ | ||
pygeoapi.flask_app:APP | ||
|
||
touch ${PYGEOAPI_CONFIG} | ||
;; | ||
|
||
*) | ||
error "unknown command arg: must be run (default) or test" | ||
error "unknown command arg: must be run (default), hot-reload, or test" | ||
;; | ||
esac | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters