[PATCH] Proof-of-concept of a dual PHPâPython stack
lfleischer at archlinux.org
Wed Mar 11 23:44:37 UTC 2020
On Sat, 07 Mar 2020 at 16:01:52, Frédéric Mangano-Tarumi wrote:
> Here\u2019s a demonstration of a Python web stack running next to the current
> PHP stack, such that it\u2019s invisible to the client.
> This approach aims at providing a way to migrate the PHP code base to
> Python, one endpoint after another, with as little glue as possible to
> have the two backends collaborate. Since they are both mounted on the
> web root, Python could implement, say, /packages/ and leave the rest to
> PHP. As soon as PHP yields it by returning 404 on this URL, Python will
> take over automatically.
> aurweb/wsgi.py | 15 +++++++++++++++
> conf/nginx.conf | 23 +++++++++++++++++++++++
> 2 files changed, 38 insertions(+)
> create mode 100644 aurweb/wsgi.py
> create mode 100644 conf/nginx.conf
Thanks! I like the approach. I wonder what the performance impact of
always querying the Python backend first would be, though, especially at
the beginning when most requests are expected to yield a 404.
Alternatively, would it make sense to use multiple location blocks and
use the right upstream based on matching the path against a predefined
set of patterns? It would add some additional maintenance work but since
the overall plan is to migrate everything to Python eventually, it would
exist only temporarily.
I guess we could use a similar approach if we ever wanted to decouple
certain endpoints completely and make them a separate app (optionally
sharing some code with the "main" backend).
For an actual first patch to be merged, I suggest porting the RPC
interface which is rather small and largely independent from other parts
of the code. This patch should also add instructions to the
documentation: both INSTALL and doc/maintenance.txt need to be updated.
Maybe also add a note to README.md.
More information about the aur-dev