Merge pull request #465 from phracek/more_outputs_correct_return_states
Add support for OpenShift 3
This commit is contained in:
parent
d246020731
commit
5513184556
23 changed files with 407 additions and 23 deletions
|
|
@ -53,20 +53,11 @@ mv /tmp/src/* "$HOME"
|
|||
# set permissions for any installed artifacts
|
||||
fix-permissions /opt/app-root -P
|
||||
|
||||
# We have to first upgrade pip to at least 19.3 because:
|
||||
# * pip < 9 does not support different packages' versions for Python 2/3
|
||||
# * pip < 19.3 does not support manylinux2014 wheels. Only manylinux2014 wheels
|
||||
# support platforms like ppc64le, aarch64 or armv7
|
||||
echo "---> Upgrading pip to version 19.3.1 ..."
|
||||
if ! pip install -U "pip==19.3.1"; then
|
||||
echo "WARNING: Installation of 'pip==19.3.1' failed, trying again from official PyPI with pip --isolated install"
|
||||
pip install --isolated -U "pip==19.3.1"
|
||||
fi
|
||||
|
||||
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" ]]; then
|
||||
echo "---> Upgrading pip to latest version ..."
|
||||
echo "---> Upgrading pip, setuptools and wheel to latest version ..."
|
||||
if ! pip install -U pip setuptools wheel; then
|
||||
echo "WARNING: Installation of the latest pip,setuptools and wheel failed, trying again from official PyPI with pip --isolated install"
|
||||
echo "WARNING: Installation of the latest pip, setuptools and wheel failed, trying again from official PyPI with pip --isolated install"
|
||||
pip install --isolated -U pip setuptools wheel
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
23
s2i/bin/run
23
s2i/bin/run
|
|
@ -93,6 +93,11 @@ if should_migrate; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# If not set, use 8080 as the default port
|
||||
if [ -z "$PORT" ]; then
|
||||
PORT=8080
|
||||
fi
|
||||
|
||||
if is_gunicorn_installed; then
|
||||
setup_py=$(find "$HOME" -maxdepth 2 -type f -name 'setup.py' -print -quit)
|
||||
# Look for wsgi module in the current directory
|
||||
|
|
@ -105,17 +110,27 @@ if is_gunicorn_installed; then
|
|||
if [[ "$APP_MODULE" ]]; then
|
||||
export WEB_CONCURRENCY=${WEB_CONCURRENCY:-$(get_default_web_concurrency)}
|
||||
|
||||
echo "---> Serving application with gunicorn ($APP_MODULE) ..."
|
||||
exec gunicorn "$APP_MODULE" --bind=0.0.0.0:8080 --access-logfile=- --config "$APP_CONFIG"
|
||||
# Default settings for gunicorn if none of the custom are set
|
||||
if [ -z "$APP_CONFIG" ] && [ -z "$GUNICORN_CMD_ARGS" ]; then
|
||||
GUNICORN_CMD_ARGS="--bind=0.0.0.0:$PORT --access-logfile=-"
|
||||
gunicorn_settings_source="default"
|
||||
else
|
||||
gunicorn_settings_source="custom"
|
||||
fi
|
||||
|
||||
# Gunicorn can read GUNICORN_CMD_ARGS as an env variable but because this is not
|
||||
# supported in Gunicorn < 20 we still need for Python 2, we are using arguments directly.
|
||||
echo "---> Serving application with gunicorn ($APP_MODULE) with $gunicorn_settings_source settings ..."
|
||||
exec gunicorn "$APP_MODULE" $GUNICORN_CMD_ARGS --config "$APP_CONFIG"
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_django_installed; then
|
||||
if [[ -f "$manage_file" ]]; then
|
||||
echo "---> Serving application with 'manage.py runserver' ..."
|
||||
echo "---> Serving application with 'manage.py runserver 0.0.0.0:$PORT' ..."
|
||||
echo "WARNING: this is NOT a recommended way to run you application in production!"
|
||||
echo "Consider using gunicorn or some other production web server."
|
||||
maybe_run_in_init_wrapper python "$manage_file" runserver 0.0.0.0:8080
|
||||
maybe_run_in_init_wrapper python "$manage_file" runserver 0.0.0.0:$PORT
|
||||
else
|
||||
echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."
|
||||
echo "Skipped 'python manage.py runserver'."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue