0

I have a service in which I run gunicorn through docker-compose. The part where the gunicorn started is the following line in the .yml file:

my-service:
    command: gunicorn my-service.wsgi:application --name=my-service --timeout=50 --workers=5 --bind=0.0.0.0:8080 --pythonpath=/my-service 

My idea is to stop using gunicorn and move on to using bjoern. Can someone help me in what I should modify?

Thank you so much for your attention.

Esther_5
  • 151
  • 2
  • 10

1 Answers1

0

I am using flask to serve my application. I am connecting oracle 19c database using session pooling. And my wsgi server is bjoern. It runs extremely fast on Ubuntu 20.04. I am not an expert but maybe this will give you some idea.

My Dockerfile is like:

# syntax=docker/dockerfile:1

FROM python:3.9.9-buster

WORKDIR /opt/oracle

RUN apt-get update && apt-get install -y libaio1 wget unzip \
    && wget https://download.oracle.com/otn_software/linux/instantclient/1913000/instantclient-basic-linux.x64-19.13.0.0.0dbru.zip \
    && unzip instantclient-basic-linux.x64-19.13.0.0.0dbru.zip \
    && rm -f instantclient-basic-linux.x64-19.13.0.0.0dbru.zip \
    && cd /opt/oracle/instantclient* \
    && rm -f *jdbc* *occi* *mysql* *README *jar uidrvci genezi adrci \
    && echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf \
    && ldconfig

RUN apt-get install -y libev-dev
RUN apt-get install -y build-essential
RUN pip3 install flask
RUN pip3 install cx-Oracle
RUN pip3 install bjoern
RUN pip3 install Flask-HTTPAuth


WORKDIR /sapsrv

COPY . .

EXPOSE 5001

CMD ["python3", "srv.py"]

And my srv.py is like:

from flask import Flask, jsonify, make_response
import bjoern
import cx_Oracle

app = Flask(__name__)

if __name__=="__main__":
    bjoern.run(app, "0.0.0.0", 5001)
cagri
  • 143
  • 1
  • 6