Commit graph

1310 commits

Author SHA1 Message Date
72797e73ff
Changed the Tornado paradigm to start the WSGI workers.
Use `bind_sockets`/`fork_processes` instead of reinventing the wheel
with our own multiprocessing handling.
2023-05-13 12:35:20 +02:00
ac4fe4447e
Revert "Added a multi-worker approach to the Tornado WSGI container."
This reverts commit 71401a4936.

Temporarily reverted this commit because the `reuse_address` on the
application's `listen` method has only been implemented in Tornado 6.2 -
and Debian stable still shipts Tornado 6.1.
2023-05-13 02:36:20 +02:00
71401a4936
Added a multi-worker approach to the Tornado WSGI container.
The WSGI container is a good option to wrap a multi-modal webapp
(Flask + websocket routes), but it's constrained to a single-process
approach and queued/pre-buffered requests. That makes performance poor
when handling requests that may take a few seconds to complete.
2023-05-13 01:26:18 +02:00
b7b93edbae
Updated dist files 2023-05-12 03:52:33 +02:00
a15191d4ca
Updated dist files 2023-05-12 03:51:59 +02:00
d4f8e51caf
A less blocking implementation of the entities loading UI logic. 2023-05-12 03:49:20 +02:00
62d846ddda
Updated dist files 2023-05-12 03:42:17 +02:00
23a5e90e2e
Updated dist files 2023-05-12 03:26:55 +02:00
6cd9cb6e76
Better entities caching on the frontend. 2023-05-12 03:18:22 +02:00
79871e0fa1
Fixed devServer routes in vue.config.js.
Use `127.0.0.1` instead of `localhost` for the Vue proxy.
2023-05-12 02:57:14 +02:00
f49ad4c349
Updated dist files 2023-05-10 02:52:24 +02:00
6b0f0883ee
A proper way to proxy websocket calls using the Vue devServer. 2023-05-10 02:27:01 +02:00
78c12212c6
[#260] A simple entities caching mechanism using the browser storage. 2023-05-10 02:26:06 +02:00
74ab884b7a
Proper redirects upon /execute failure.
If a call to `/execute` fails with a 401 or 412 status, then redirect
the user to `/register` or `/login`.
2023-05-10 02:24:50 +02:00
ab2425ebd0
[#260] Removed legacy backend.websocket.
It has now been replaced by the `/ws/events` and `/ws/requests`
websocket routes under `backend.http`.
2023-05-09 02:46:43 +02:00
a069d23bb7
[#260] Added `/ws/requests` websocket route. 2023-05-09 02:40:32 +02:00
7716a416e9
[#260] Support for sending events via websocket over /ws/events. 2023-05-09 02:18:58 +02:00
edb7197f71
[#260] Implemented authentication for websocket routes.
Plus, refactored the `backend.http.app.utils` module by breaking it down
into multiple components, as the module was starting to get too large.
2023-05-09 00:03:11 +02:00
2d4b179879
Include the path info in the logging messages in WSRoute. 2023-05-08 12:35:54 +02:00
f5fcccb0bd
Refactored the new websocket routes.
Defined a `platypush.backend.http.ws` package with all the routes, a
base `WSRoute` class that all the websocket routes can extend, and a
logic in the HTTP backend to automatically scan the package to register
exposed websocket routes.
2023-05-08 11:45:14 +02:00
56dc8d0972
Migrated the webapp to Tornado.
It was just too painful to find a combination of versions of  gunicorn,
gevent, eventlet, pyuwsgi etc. that could work on all of my systems.

On the other hand, Tornado works out of the box with no headaches.

Also in this commit:

- Updated a bunch of outdated/required integration dependencies.
- Black'd and LINTed a couple of old plugins.
2023-05-08 02:06:45 +02:00
f81e9061a3
lifespan=on is actually not required on Flask config level. 2023-05-07 16:30:41 +02:00
692180c653
Back to uvicorn workers from eventlet.
The eventlet API has way too many dependency issues with gunicorn.

Still TODO: Fix or at least mitigate the WSGI workers timeout issue when
they handle websocket connections.
2023-05-07 15:37:58 +02:00
8102178ba4
Updated dist files 2023-05-07 13:00:48 +02:00
c0a948f8ce
Removed remaining references to websocket port. 2023-05-07 12:54:13 +02:00
bdbbd24e6f
Only include /ws/events as a proxied websocket, without messing with the /ws route exposed by the Vue debugger 2023-05-07 12:22:51 +02:00
059fff8558
Updated dist files 2023-05-07 12:19:13 +02:00
f9b0bc905e
Migrated websocket service.
The websocket service is no longer provided by a different service,
controlled by a different thread running on another port.

Instead, it's now exposed directly over Flask routes, using
WSGI+eventlet+simple_websocket.

Also, the SSL context options have been removed from `backend.http`, for
sake of simplicity. If you want to enable SSL, you can serve Platypush
through a reverse proxy like nginx.
2023-05-07 12:08:28 +02:00
3aefc9607d
Migrated from waitress to gunicorn.
`waitress`, unlike `gunicorn`, doesn't provide an easy way to plug into
a WSGI socket that can be used for the websocket interface.
2023-05-07 00:42:57 +02:00
9951d62511
Added logic to automatically generate the secret key for Flask. 2023-05-06 22:04:48 +02:00
e33a391d25
Updated dist files 2023-05-06 12:37:00 +02:00
4f78d61223
Improved UI on mobile. 2023-05-06 12:34:27 +02:00
6e939bbe62
Close modals and dropdown when ESC is pressed. 2023-05-05 20:46:42 +02:00
e9e59c857a
Updated dist files 2023-05-05 02:51:33 +02:00
59bf1c2aa0
Added close button to the modal's header. 2023-05-05 02:48:41 +02:00
8af3ae17b8
A more efficient way of detecting the entity groups to display.
Instead of iterating over each of the entities in a grouping to find out
which groups should be displayed based on the selector's policy, the
selector can directly keep its `selectedGroups` attribute in sync with
the index.
2023-05-05 02:33:34 +02:00
98b9d31dd4
Updated dist files 2023-05-05 01:10:24 +02:00
4383dbb2b4
Bluetooth UI toggle aligned to the right - like all other toggles. 2023-05-05 01:04:39 +02:00
285f3941d9
Always use an external uWSGI server to run the web service.
Added `waitress` dependency. For performance and security reasons, it's
better to always run the Flask application inside of a uWSGI server.

`waitress` also makes things easier by avoiding to ask the user to
manually provide the external executable arguments, as it was the case
with `uwsgi` and `gunicorn`.
2023-05-05 00:07:13 +02:00
99311a6e71
Updated dist files 2023-05-04 02:23:24 +02:00
7db09276ca
Some small style improvements. 2023-05-04 02:20:40 +02:00
2398cac572
A more efficient and clean logic for selectedEntities calculation. 2023-05-04 02:19:55 +02:00
394e27eaf2
Refactored style for UI dropdowns. 2023-05-04 02:19:09 +02:00
5d1c8cf8e9
Additional null check on this.searchTerm 2023-05-03 03:33:34 +02:00
3482c29679
Updated dist files 2023-05-03 03:18:44 +02:00
a06d0ef6a1
Merged all the items in the entities panel's header in the Selector component. 2023-05-03 03:14:46 +02:00
7c7818dd76
Fixed entity search.
It was broken by the previous refactor of the entities panel, which no
longer triggers the `watch` callback on the upstream `entityGroups`.

The new approach listens for entity updates on the frontend bus and
dynamically creates the entity groupings in `selectedGroups` if they are
missing.
2023-05-03 02:12:14 +02:00
9922305ac5
Fixed grouping for entityGroups.id.
Unlike the other entity groupings, which are 4-layered (`grouping ->
group -> entity_id -> entity`), the grouping by ID only needs 3 layers
(`grouping -> entity_id -> entity`).
2023-05-03 02:09:51 +02:00
cc2ec1db7f
The HTTP Zeroconf service should be registered before the server starts. 2023-05-02 21:24:50 +02:00
55cb87d14f
Updated dist files 2023-05-02 10:24:11 +02:00