Commit graph

3908 commits

Author SHA1 Message Date
ce68250b4d
Refactor/documentation round for platydock. 2023-08-22 02:49:05 +02:00
10c0e5fcad
Added default_os field to PackageManagers enum elements.
This is useful to determine which is the default set of scripts that
should be used by the installer depending on the detected installed
package manager.
2023-08-20 21:21:37 +02:00
2c46b6fe14
Added git a required manifest dependency when needed.
It is needed for packages that install pip packages via git.
2023-08-20 21:19:15 +02:00
a28dcb7a8d
Remove /var/cache/apk from container image after installation. 2023-08-20 14:19:04 +02:00
a6752ed034
Fixed wrong event path in a manifest file. 2023-08-20 14:08:22 +02:00
700b8e1d16
Added header and footer to generated Dockerfile. 2023-08-20 14:05:22 +02:00
f66c4aa071
Ignore the Dockerfile in the root folder 2023-08-20 13:48:55 +02:00
a6f8021150
PackageManager has both install and uninstall. 2023-08-20 13:33:49 +02:00
5efcae64c1
Better Dockerfile logic to retrieve sources.
If the /install folder on the container doesn't contain a copy of the
source files, then the git repository will be cloned under that folder.

The user can specify via `-r/--ref` option which tag/branch/commit they
want to install.
2023-08-20 13:31:13 +02:00
28ba042810
If no configuration file is passed to platydock generate a minimal Dockerfile. 2023-08-20 03:36:34 +02:00
199ac5f0f7
New way of managing installation scripts and dependencies.
Created `platypush/install` folder that contains:

- Dockerfiles for the supported distros
- Lists of required base dependencies for the supported distros
- Install and run scripts
- Added Debian to supported base images
2023-08-20 02:28:10 +02:00
71c5291190
Refactored the interface of Platydock and manifest utils. 2023-08-19 22:46:37 +02:00
a99ffea37c
Fixed apt dependencies for mpd plugin. 2023-08-19 21:46:08 +02:00
7889b2f1db
Updated generate_missing_docs to use the new manifest API. 2023-08-19 13:49:31 +02:00
980af16984
Rewritten platydock utility.
Platydock now will only print out a Dockerfile given a configuration
file.

No more maintaining the state of containers, storing separate workdirs
and configuration directories etc. - that introduced way too much
overhead over Docker.
2023-08-19 13:47:43 +02:00
9002f3034a
Tweaked package managers install command arguments. 2023-08-19 13:46:08 +02:00
69706eaabe
s/logger/_logger/ in the plugins module.
The `logger` name may clash with the context of an action, where
`logger` may have been set to something else.
2023-08-19 13:32:19 +02:00
1cb686bdab
Updated the inspect plugin to the new manifest utils interface. 2023-08-19 13:31:48 +02:00
043f303761
s/HttpBackend._DEFAULT_HTTP_PORT/HttpBackend.DEFAULT_HTTP_PORT/g 2023-08-19 13:30:51 +02:00
dd3a701a2e
Full rewrite of platypush.utils.manifest.
The new version encapsulates all the utility functions into three
classes - `Manifest`, `Manifests` and `Dependencies`.
2023-08-19 13:28:40 +02:00
a8255f3621
Pass the configuration file used by the application to the Alembic process.
The database settings could also be overridden in the configuration file
besides the command line.

We should therefore pass the path to the runtime configuration file, so
the Alembic process can initialize its configuration from the same file
and use the same settings.
2023-08-19 13:23:20 +02:00
1825b492b3
Replaced Config.workdir with Config.get_workdir().
Again, Python < 3.9 doesn't like class properties.
2023-08-19 13:21:24 +02:00
a8836f95f5
Support explicit workdir parameter override in Config constructor. 2023-08-19 13:15:29 +02:00
5bc82dfe64
s/Config._cfgfile/Config.config_file/g 2023-08-19 13:13:36 +02:00
181da63c89
Pass the database engine to the Alembic process as an extra argument.
If the path of the default database engine is overridden via `--workdir`
option then it won't be visible to the new `python` subprocess spawned
for Alembic.
2023-08-19 13:02:05 +02:00
c2b3ec8ce3
Fixed manifest files with outdated formats. 2023-08-19 12:54:33 +02:00
e463a52435
Use sys.executable rather than 'python' to launch the application. 2023-08-19 12:40:57 +02:00
0a5fc40dc5
Merge branch 'master' into 276/better-docker 2023-08-18 17:34:56 +02:00
3236e235ef Merge pull request '278/fix-variable-errors-on-python-3-8' (#279) from 278/fix-variable-errors-on-python-3-8 into master
Reviewed-on: platypush/platypush#279
2023-08-18 17:25:08 +02:00
2cab836bdf
Entity.columns class property replaced by Entity.get_columns method.
Again, Python < 3.9 doesn't like the combination of `@property` +
`@classmethod`.
2023-08-18 17:20:53 +02:00
a9cdff900e
_variable should be an external global function rather than a class property.
The combination of `@property` + `@classmethod` isn't supported on
Python < 3.9.
2023-08-18 16:16:47 +02:00
d0c89f88a8
Fixed parenthesised multi-with statement.
This syntax is not supported on Python < 3.9, and therefore it should be
broken down as a multi-line statement.
2023-08-18 16:10:31 +02:00
ca95490412
Added timeout parameter to requests.get in the rss plugin. 2023-08-18 15:53:30 +02:00
5dd7345c0b
Sync the latest parse timestamps in main instead of __init__ in rss.
We should load the latest timestamps from the db when the thread starts
instead of doing it in the constructor.

The constructor may be invoked when the entities engine hasn't been
initialized yet, and result in deadlocks.
2023-08-18 15:51:11 +02:00
ec64b0ef8b
Added --device_id command line option. 2023-08-17 23:16:24 +02:00
ac83b43f98
Support for custom key-value overrides on Config.init. 2023-08-17 22:03:39 +02:00
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