Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
14.23k stars 1.7k forks source link

Consider alternative Web Servers #456

Open FabienLelaquais opened 1 year ago

FabienLelaquais commented 1 year ago

Description

Flask has a convenient built-in Web Server that is blocking. Some of our users need to potentially serve multiple, simultaneous requests therefore requesting the use of concurrent request processing from the web server.

The first candidates that come to mind are Apache (HTTP & Tomcat), Nginx or Unicorn.

We need to come up with scenarios of Web Server deployments when the Taipy GUI WSGI application can sit.

Acceptance Criteria

FredLL-Avaiga commented 1 year ago

gunicorn has already been used

dinhlongviolin1 commented 7 months ago

We can consider closing this issue if you think it is not necessary anymore @FabienLelaquais

FabienLelaquais commented 7 months ago

I would love to see sections in the doc that show how to integrate a Taipy GUI app in Apache HTTP Server, IIS, Nginc or Jetty... At least a how-to.

The point of this issue is to address potential integration issues in the code if there are any.

florian-vuillemot commented 4 months ago

The WSGI required the following interface, which defined a callable:

def simple_app(environ, start_response):
        data = b"Hello, World!\n"
        start_response("200 OK", [
            ("Content-Type", "text/plain"),
            ("Content-Length", str(len(data)))
        ])
        return iter([data])

This interface can be implemented via a function or object defining the __call__ method. This method is called by the Web server, as shown in the following example for Gunicorn:

gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 -b 0.0.0.0:8000 <filename>:<callable>

Note: The option -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" is to provide the correct websocket support to Gunicorn and is not related to the topic.

Here is a POC of this potential implementation for Taipy:

$ cat main.py
....
class CallableGui(Gui):
    def __call__(self, *args, **kwargs):
        flask_app = self.get_flask_app()
        return flask_app(*args, **kwargs)

app = CallableGui(pages=pages)
tp.Core().run()
app.run(title="Covid Dashboard", run_server=False)

$ gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 -b 0.0.0.0:8000 main.py:app
ScalarJerk commented 2 weeks ago

@FabienLelaquais to clarify the end result after the discussion here, we're looking to add a report(?) in the pull request? I didn't get that part. What is the exact deliverable we're looking for?

KunjShah95 commented 2 weeks ago

Kindly assign it to me

jrobinAV commented 2 weeks ago

@KunjShah95 You are already assigned to another issue. For hacktoberfest, we only assign issues one at a time. Please submit a PR on the other issue first, or remove your assignment.

Thank you.

kailashchoudhary11 commented 2 weeks ago

Hey @jrobinAV can you please assign this issue to me?

FabienLelaquais commented 2 weeks ago

@ScalarJerk To respond to your question... What Taipy GUI really does is rely on Flask to create a web app. We want to show how this can integrate other environments instead of the internal web server. Although this is great for dev, we don't want this for deployment.

Therefore, we want to:

AlexandreSajus commented 2 weeks ago

Assigned

quest-bot[bot] commented 1 week ago

New Quest! image New Quest!

A new Quest has been launched in @Avaiga’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.


Some loot has been stashed in this issue to reward the solver!

🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!

⚔️ When you submit a PR, comment @quest-bot loot #456 to link your PR to this Quest.

Questions? Check out the docs.