I'm trying to get my gunicorn flask app working with openziti. Using your examples as reference I have managed to get the same flask app but using waitress to serve the app to work. However ideally I would like to you use gunicorn rather than waitress. However swapping them directly does not seem to work error seen here.
Here are the 2 methods with the ziti decorator using the same binding object. Waitress works but gunicorn does not.
bind_opts = {
'ztx': ziti_path('identity.json'),
'service': 'example-service-name'
}
@openziti.zitify(bindings={'0.0.0.0:5000': bind_opts})
def gunicorn_run_zitty(self):
self.run() # self is an instance of gunicorn's BaseApplication
@openziti.zitify(bindings={'0.0.0.0:5000': bind_opts})
def run_waitress_ziti(self):
from waitress import serve
print("starting server on OpenZiti overlay")
serve(self.application, host="0.0.0.0", port=5000)
the options currently passed to the gunicorn contructor are
{
'bind': '0.0.0.0:5000,
'workers': 4,
"certfile": cert_path('cert.pem'),
"keyfile": cert_path('key.pem')
}
gunicorn is currently running using a self-sign certificate & thus the endpoints running in the flask app require https, however waitress does not support this natively so is running on http.