Commit graph

3872 commits

Author SHA1 Message Date
657b2cc87d
Create the default configuration file even if --config is supplied but the file doesn't exist. 2023-08-17 11:25:49 +02:00
afa4de5673
Dockerfile moved to application root 2023-08-17 10:38:21 +02:00
24b04d9103
s/--config-file/--config/ option in Dockerfile. 2023-08-17 10:35:40 +02:00
f07b774e75
A better Dockerfile. 2023-08-17 03:04:34 +02:00
bf7d060b81
Added @ensure_initialized decorator to actions in variable.
The `variable` plugin may break in the constructor the first time the
application is started.

That's because it tries to initialize the cache of stored variables, but
the local database hasn't yet been initialized.

That's because plugins are registered _before_ the entities engine is
initialized, as the entities engine assumes that it already has plugins
to scan for entities.

Therefore, the initialization of the `variable` plugin's cache should be
lazy (only done upon the first call to `get`/`set` etc.), in order to
prevent deadlock situations where the plugin waits for the engine to
start, but the engine will be initialized only after the plugin is
ready.

And the lazy initialization logic should also ensure that the entities
engine has been properly started (and emit a `TimeoutError` if that's
not the case), in order to prevent race conditions.
2023-08-17 02:47:30 +02:00
adfedfa2dd
s/TimeoutError/AssertionError/ if get_entities_engine times out. 2023-08-17 02:36:40 +02:00
ec2b8da983
Ignore Redis errors when a backend sends an unregister notify event.
When that happens, it's most likely that the application is already
stopping and the Redis service has already been terminated.
2023-08-17 01:49:41 +02:00
3bf068e0b2
The __main__ function should take no arguments.
setup.py won't pass any arguments to `main()`, so the default entry
point should get them itself from `sys.argv`.
2023-08-17 01:35:39 +02:00
a52de0e086
Removed tz dependency. 2023-08-17 00:35:39 +02:00
e9dbcff1a8
Removed old bin/platypush script.
It's already been replaced by the setup.py entry point.
2023-08-16 23:52:54 +02:00
98e9abde18
Extended manifest files with Python system packages (if available).
- If a Python optional dependency is available as a system package on
  the target system, try and install it that route rather than pip. It's
  usually faster and it decreases the risk of breaking system packages.

- Added support for apk dependencies in manifest files. This brings the
  number of distros officially supported by all the extensions to four:

  - Alpine
  - Arch
  - Debian
  - Ubuntu
2023-08-16 22:43:51 +02:00
c2a17f0d75 Merge pull request '[#272] Support for external stop/restart control on the application' (#273) from 272/external-proc-controller into master
Reviewed-on: platypush/platypush#273
2023-08-15 21:34:43 +02:00
fef6513cc8
Alpine Linux requires the linux-headers package to build psutil. 2023-08-15 11:40:02 +02:00
00863a176e
Added application plugin. 2023-08-15 11:20:24 +02:00
f51beb271e
Large refactor + stability fixes for the external process control logic. 2023-08-15 11:12:21 +02:00
46245e851f
Synchronize with the currently running stop thread (if any) in Backend.wait_stop. 2023-08-15 02:08:47 +02:00
a8a7ceb2ac
Implemented HttpBackend._stop_workers.
The Tornado WSGI container won't guarantee the termination of the
spawned workers upon termination, so the code of the backend has to take
care of it and terminate all the children processes of the server
process when it terminates.

This also means that `psutil` is now a required base dependency, as we
need to expand the process subtree under the webserver launcher.
2023-08-15 00:13:34 +02:00
04921c759f
Added wait_stop method to the entities engine and cron scheduler. 2023-08-14 23:49:47 +02:00
ceb9d6d1ba
Removed redundant Backend._get_redis() method.
It was used only once, and it could easily be replaced by
`platypush.utils.get_redis()`.
2023-08-14 23:37:38 +02:00
7157936b87
Added get_remaining_timeout utility function. 2023-08-14 23:17:50 +02:00
dc1a152433
Added get_default_pid_file utility method. 2023-08-14 10:47:25 +02:00
c11bc69a66
Handle KeyboardInterrupt and process return code in the main. 2023-08-13 23:55:40 +02:00
8819a0ed4c
Added CommandStream to the main Application.
The stream will be used to communicate command messages from the
application to its runner.
2023-08-13 23:51:21 +02:00
06111587f7
Added CommandStream class.
This abstraction is used to write and read commands over a UNIX socket.
2023-08-13 23:37:51 +02:00
c89f992867
Added StopCommand and RestartCommand. 2023-08-13 23:36:36 +02:00
b1f244a812
Added ControllableProcess class.
This class can be used to easily control the execution of underlying
processes.
2023-08-13 23:33:08 +02:00
efef9d7bc0
Added commands module. 2023-08-13 23:21:36 +02:00
97adc3f775
Moved application argument parser to an external platypush.cli module. 2023-08-13 22:27:16 +02:00
1819ee75ef
s/Application.stop_app/Application.stop/g 2023-08-13 22:23:15 +02:00
827b564006
Using a single constant for DEFAULT_REDIS_QUEUE.
Also, catch `AttributeError` on `self._proc.terminate` in the
`HttpBackend`, since the process may already have been terminated and
set to null by another worker process.
2023-08-13 22:20:16 +02:00
4062ddbcf0
More improvements to the inspect plugin.
- Support for distinct `type` field on constructor and method arguments.

- Added `has_varargs` field.

- Added `required` field.

- Better logic for parsing arguments `default` values.
2023-08-08 20:47:27 +02:00
9beb0a7af3
Skip :type: annotations from docstring args documentation. 2023-08-08 20:47:27 +02:00
2a30f060b4
Parse the arguments list from obj_type.__init__.__doc__ too. 2023-08-08 20:47:27 +02:00
1474685cc0
[Automatic] Updated UI files 2023-08-06 22:51:57 +00:00
26b4dcba46
Reduced padding of ConfirmDialog body element. 2023-08-07 00:50:10 +02:00
435cbe7b1f
Keep track of the original .git/config path before running cd. 2023-08-07 00:45:51 +02:00
5184543a3e
Normalize the size of the camera frame container from window size.
If the window is smaller than the camera resolution, then we should
scale down the container size accordingly.
2023-08-07 00:38:19 +02:00
8b245a1618
Backup/restore the git configuration in the build-ui step.
This is to ensure that following steps that depend on the default
username and email (e.g. the AUR release step) won't fail because of
mismatching identities.
2023-08-07 00:19:02 +02:00
39fb3026bf
Prevent push loops in build-ui pipeline.
The pipeline should check if the latest commit is an automated UI build
commit before proceeding with a new build.

We need this check in place to prevent pipelines triggered by a push in
another pipeline that end up triggering other pipelines until a manual
cancel.
2023-08-07 00:10:46 +02:00
2005bc9f62
Always run notify-build-status - including on failure. 2023-08-07 00:05:13 +02:00
dd313c6371
[Automatic] Updated UI files 2023-08-06 21:50:25 +00:00
2f007888fc
[Automatic] Updated UI files 2023-08-06 21:48:33 +00:00
609a8c6052
[Automatic] Updated UI files 2023-08-06 21:46:44 +00:00
276a9a7421
[Automatic] Updated UI files 2023-08-06 21:44:51 +00:00
715cdcfcff
More consistent style for the buttons on the tokens settings page. 2023-08-06 23:42:50 +02:00
6453b7d391
Explicitly re-add the repo SSH origin and push.
Committing alone doesn't seem to suffice in the build-ui Drone CI step.
2023-08-06 23:40:35 +02:00
bd49e460d5
More style improvements for the user settings panel. 2023-08-06 23:36:06 +02:00
51f907e1b5
Make sure that neither dist nor node_modules are present before building the UI. 2023-08-06 23:19:43 +02:00
6eed558342
More improvements on the users settings panel. 2023-08-06 23:14:54 +02:00
d92da5fe6f
Simplified Drone CI DAG.
Removed redundant `depends_on` steps in the pipeline.
2023-08-06 22:36:04 +02:00