Switch to uwsgi

Use the opendev uwsgi base image.  A few additional changes are
needed beyond the container switch:

* WSGI protocol says headers must be a python list.  Uwsgi is very
  literal about that and does not permit an iterable, so we coerce
  items() to a list.
* Add the zuul_storage_proxy package to the setup.cfg files list so
  it gets installed.
* Remove a debug print.

Change-Id: I801d8b37699af8b937cc68d32f2a85c50eb91eb9
This commit is contained in:
James E. Blair 2021-02-11 14:26:39 -08:00
parent 8f35ff5f0f
commit 98e92bdd46
4 changed files with 8 additions and 5 deletions

View File

@ -3,10 +3,11 @@ FROM docker.io/opendevorg/python-builder as builder
COPY . /tmp/src COPY . /tmp/src
RUN assemble RUN assemble
FROM docker.io/opendevorg/python-base as zuul-storage-proxy FROM docker.io/opendevorg/uwsgi-base as zuul-storage-proxy
COPY --from=builder /output/ /output COPY --from=builder /output/ /output
RUN /output/install-from-bindep RUN /output/install-from-bindep
EXPOSE 8000 EXPOSE 8000
CMD ["/usr/local/bin/gunicorn", "-k", "eventlet", "-t", "3600", "--workers", "10", "swift_proxy:proxy"] ENV UWSGI_HTTP_SOCKET=:8000 UWSGI_PROCESSES=10 UWSGI_THREADS=1
CMD uwsgi --mount /=zuul_storage_proxy:proxy

View File

@ -1,2 +1 @@
gunicorn[eventlet]
openstacksdk openstacksdk

View File

@ -6,3 +6,7 @@ requires-dist =
[pbr] [pbr]
warnerrors = True warnerrors = True
[files]
packages = zuul_storage_proxy

View File

@ -102,7 +102,7 @@ def handle_get(start_response, clouds, container, path):
start_response( start_response(
"{} {}".format(response.status_code, response.reason), "{} {}".format(response.status_code, response.reason),
response_headers.items()) list(response_headers.items()))
# We want to forward the compressed data stream here so use the raw # We want to forward the compressed data stream here so use the raw
# response stream. # response stream.
@ -163,7 +163,6 @@ def swift_proxy(environ, start_response, clouds, container_prefix):
path = components[1] path = components[1]
container = container_prefix + container container = container_prefix + container
print('%s request %s/%s' % (method, container, path))
try: try:
if method == 'GET': if method == 'GET':
for chunk in handle_get(start_response, clouds, container, path): for chunk in handle_get(start_response, clouds, container, path):