Skip to content

Commit

Permalink
Call api by specific entrypoint
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
mdellweg committed Aug 10, 2023
1 parent 55df58b commit abf4163
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
10 changes: 9 additions & 1 deletion images/assets/pulp-api
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ if [ -n "${PULP_ADMIN_PASSWORD}" ]; then
fi
set -x

if which pulpcore-api
then
PULP_API_GUNICORN="pulpcore-api"
else
PULP_API_GUNICORN="gunicorn pulpcore.app.wsgi:application"
fi

# NOTE: Due to the Linux dual-stack functionality, this will listen on both IPv4
# IPv6, even though netstat may seem to indicate it is IPv6 only.
# Due to containers using network namespaces, even if the host has this disabled
# with /proc/sys/net/ipv6/bindv6only=1, the container will still have
# it enabled with /proc/sys/net/ipv6/bindv6only=0 .
exec gunicorn --bind '[::]:24817' pulpcore.app.wsgi:application \
exec ${PULP_API_GUNICORN} \
--bind '[::]:24817' \
--name pulp-api \
--timeout "${PULP_GUNICORN_TIMEOUT}" \
--workers "${PULP_API_WORKERS}"
17 changes: 4 additions & 13 deletions images/assets/pulp-worker
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@
/usr/bin/wait_on_postgres.py
/usr/bin/wait_on_database_migrations.sh

NEW_TASKING_SYSTEM=$(python3 -c "from packaging.version import parse; from pulpcore.app.apps import PulpAppConfig; print('yes' if parse(PulpAppConfig.version) >= parse('3.13.0.dev0') else 'no')")
echo $NEW_TASKING_SYSTEM

if [[ "$NEW_TASKING_SYSTEM" == "no" ]]; then
# TODO: Set ${PULP_WORKER_NUMBER} to the Pod Number
# In the meantime, the hostname provides uniqueness.
exec rq worker --url "redis://${REDIS_SERVICE_HOST}:${REDIS_SERVICE_PORT}" -w "pulpcore.tasking.worker.PulpWorker" -c "pulpcore.rqconfig"
else
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
export PULP_SETTINGS=/etc/pulp/settings.py
export PATH=/usr/local/bin:/usr/bin/
exec pulpcore-worker
fi
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
export PULP_SETTINGS=/etc/pulp/settings.py
export PATH=/usr/local/bin:/usr/bin/
exec /usr/local/bin/pulpcore-worker
10 changes: 9 additions & 1 deletion images/s6_assets/init/pulpcore-api
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ fi
if [ "${PULP_OTEL_ENABLED}" = "true" ]; then
OTEL_PREFIX="/usr/local/bin/opentelemetry-instrument --service_name pulp-api"
fi
exec $OTEL_PREFIX /usr/local/bin/gunicorn pulpcore.app.wsgi:application --bind "127.0.0.1:24817" --name pulp-api --timeout "${PULP_GUNICORN_TIMEOUT}" --workers "${PULP_API_WORKERS}" --access-logfile - --access-logformat "pulp [%({correlation-id}o)s]: %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" ${PULP_GUNICORN_RELOAD_STRING}

if which pulpcore-api
then
PULP_API_GUNICORN="pulpcore-api"
else
PULP_API_GUNICORN="gunicorn pulpcore.app.wsgi:application"
fi

exec ${OTEL_PREFIX} ${PULP_API_GUNICORN} --bind "127.0.0.1:24817" --name pulp-api --timeout "${PULP_GUNICORN_TIMEOUT}" --workers "${PULP_API_WORKERS}" --access-logfile - --access-logformat "pulp [%({correlation-id}o)s]: %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" ${PULP_GUNICORN_RELOAD_STRING}

0 comments on commit abf4163

Please sign in to comment.