Better Docker support #277

Merged
blacklight merged 66 commits from 276/better-docker into master 2023-09-04 02:49:15 +02:00

66 Commits

Author SHA1 Message Date
Fabio Manganiello b3c82fe0d1
More resilient termination logic for `CommandStream`.
continuous-integration/drone/push Build is passing Details
2023-09-04 02:47:18 +02:00
Fabio Manganiello c69f97c0a5
Updated default config.yaml.
continuous-integration/drone/push Build is passing Details
The new configuration:

- Enables `backend.http` by default
- Removes the extra `config.auto.yaml` dependency
- Includes many more examples, lots of updates for existing examples,
  and extensive comments.
2023-09-04 02:22:46 +02:00
Fabio Manganiello 07c2eee890
Changed (fixed) default location for config dir if not existing.
Following some common UNIX conventions, if no configuration file is
specified and none exists under the default locations, then a new
configuration directory should be created under:

```
- if root: /etc/platypush
- else:
  - if XDG_CONFIG_HOME:
    - $XDG_CONFIG_HOME/platypush
  - else:
    - ~/.config/platypush
```
2023-09-04 02:19:13 +02:00
Fabio Manganiello b6c0ff799b
Rewritten the `http.webpage` plugin. 2023-09-03 17:33:25 +02:00
Fabio Manganiello 669f2eb2d2
LINT/black for `tts.mimic3` plugin. 2023-09-02 12:40:34 +02:00
Fabio Manganiello 35416f3ee3
Some LINT on the old `http.request.rss` plugin. 2023-09-02 01:01:16 +02:00
Fabio Manganiello 759075f1d9
Updated sample nginx configuration. 2023-09-01 01:09:38 +02:00
Fabio Manganiello 5481ae753d
gitignore should only skip /config, not any config directories. 2023-08-31 23:56:57 +02:00
Fabio Manganiello 9aaf2559fa
Added `utils.is_root` method. 2023-08-31 23:21:32 +02:00
Fabio Manganiello 1be40f30d6
Merge branch 'master' into 276/better-docker
continuous-integration/drone/push Build is passing Details
2023-08-31 02:34:17 +02:00
Fabio Manganiello 011f6d3a66
(Try and) pull the current branch from Github instead of master.
continuous-integration/drone/push Build is passing Details
2023-08-31 02:32:42 +02:00
Fabio Manganiello 86ce2647e4
Removed the -f flag from git push.
continuous-integration/drone/push Build is failing Details
2023-08-31 02:23:13 +02:00
Fabio Manganiello 867198a092
Try and force push the commits to Github.
continuous-integration/drone/push Build is passing Details
2023-08-31 02:22:01 +02:00
Fabio Manganiello a87a713f5e
Ignore the Dockerfile in the root folder
continuous-integration/drone/push Build is failing Details
2023-08-31 02:15:59 +02:00
Fabio Manganiello a88b57fff2
Dockerfile moved to application root 2023-08-31 02:15:59 +02:00
Fabio Manganiello 91fde717c9
Dockerfile moved to application root 2023-08-31 02:15:59 +02:00
Fabio Manganiello 0e02e617b3
Skip checksum in platypush-git AUR package.
The master branch can move fast and easily get out of sync with the
released version.
2023-08-31 02:15:58 +02:00
Fabio Manganiello ee955882bf
Always rebase when pulling from the Github remote.
continuous-integration/drone/push Build is failing Details
2023-08-31 02:11:50 +02:00
Fabio Manganiello e6b5abe909
Added SIGTERM handler for clean termination in Docker contexts.
continuous-integration/drone/push Build is failing Details
2023-08-31 02:09:23 +02:00
Fabio Manganiello 4dd713ffd2
Refactored Platydock and Platyvenv.
The two scripts now share the same command interface, behaviour and base
class.

Also, Platydock now builds a Docker image instead of just printing a
Dockerfile, unless the `--print` option is passed.
2023-08-31 01:16:56 +02:00
Fabio Manganiello 429658e7c8
Refactored `PackageManager` classes.
continuous-integration/drone/push Build is passing Details
Instead of having a custom `get_installed` callable field, with
replicated code for each package manager, the field has now been
promoted to a class method containing the common logic, and the
instances now expect a `list` field (base command to list the installed
packages using the specified package manager) and a `parse_list_line`
callback field (to extract the base package name given a raw line from
the command above).

Also, we shouldn't run the list command if we're running within a Docker
context - the host and container environments will be different.
2023-08-28 01:26:19 +02:00
Fabio Manganiello 86e5f74645
platyvenv should generate (and document) a run.sh helper script. 2023-08-27 23:20:03 +02:00
Fabio Manganiello 9e6430a9ac Clone git repo if platyvenv is not running from a srcdir 2023-08-23 20:02:04 +02:00
Fabio Manganiello dafd65dc21
Added new platyvenv Python script. 2023-08-23 11:55:25 +02:00
Fabio Manganiello f230fa79bb
`to_pkg_install_commands` should skip already installed sys packages. 2023-08-23 11:51:53 +02:00
Fabio Manganiello 449821673c
Added `PackageManager.get_installed`. 2023-08-23 10:50:29 +02:00
Fabio Manganiello b10ccdb313
Added get_src_root utility function. 2023-08-23 02:53:31 +02:00
Fabio Manganiello 1ef0d804db
Added `full_command` argument to `to_pip_install_commands`.
This is useful if we just want to get the list of pip dependencies and
create our own pip command.
2023-08-23 02:19:54 +02:00
Fabio Manganiello 2bff4c9cf1
Exclude python-* system packages when installing in a venv. 2023-08-23 02:17:19 +02:00
Fabio Manganiello cddf318fa7
Dependencies.from_config should include the base system deps. 2023-08-23 02:16:33 +02:00
Fabio Manganiello 8f39231d31
Added new utility methods to the Dependencies class. 2023-08-23 02:15:50 +02:00
Fabio Manganiello 782ddf5097
Removed legacy platyvenv bash script.
The script is being migrated to a Python implementation.
2023-08-23 02:08:51 +02:00
Fabio Manganiello ce68250b4d
Refactor/documentation round for platydock. 2023-08-22 02:49:05 +02:00
Fabio Manganiello 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
Fabio Manganiello 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
Fabio Manganiello a28dcb7a8d
Remove /var/cache/apk from container image after installation. 2023-08-20 14:19:04 +02:00
Fabio Manganiello a6752ed034
Fixed wrong event path in a manifest file. 2023-08-20 14:08:22 +02:00
Fabio Manganiello 700b8e1d16
Added header and footer to generated Dockerfile. 2023-08-20 14:05:22 +02:00
Fabio Manganiello f66c4aa071
Ignore the Dockerfile in the root folder
continuous-integration/drone/push Build is passing Details
2023-08-20 13:48:55 +02:00
Fabio Manganiello a6f8021150
`PackageManager` has both `install` and `uninstall`.
continuous-integration/drone/push Build is passing Details
2023-08-20 13:33:49 +02:00
Fabio Manganiello 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
Fabio Manganiello 28ba042810
If no configuration file is passed to platydock generate a minimal Dockerfile.
continuous-integration/drone/push Build was killed Details
2023-08-20 03:36:34 +02:00
Fabio Manganiello 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
Fabio Manganiello 71c5291190
Refactored the interface of Platydock and manifest utils. 2023-08-19 22:46:37 +02:00
Fabio Manganiello a99ffea37c
Fixed apt dependencies for `mpd` plugin. 2023-08-19 21:46:08 +02:00
Fabio Manganiello 7889b2f1db
Updated `generate_missing_docs` to use the new manifest API. 2023-08-19 13:49:31 +02:00
Fabio Manganiello 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
Fabio Manganiello 9002f3034a
Tweaked package managers install command arguments. 2023-08-19 13:46:08 +02:00
Fabio Manganiello 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
Fabio Manganiello 1cb686bdab
Updated the `inspect` plugin to the new manifest utils interface. 2023-08-19 13:31:48 +02:00
Fabio Manganiello 043f303761
`s/HttpBackend._DEFAULT_HTTP_PORT/HttpBackend.DEFAULT_HTTP_PORT/g` 2023-08-19 13:30:51 +02:00
Fabio Manganiello 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
Fabio Manganiello 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
Fabio Manganiello 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
Fabio Manganiello a8836f95f5
Support explicit `workdir` parameter override in `Config` constructor. 2023-08-19 13:15:29 +02:00
Fabio Manganiello 5bc82dfe64
s/Config._cfgfile/Config.config_file/g 2023-08-19 13:13:36 +02:00
Fabio Manganiello 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
Fabio Manganiello c2b3ec8ce3
Fixed manifest files with outdated formats. 2023-08-19 12:54:33 +02:00
Fabio Manganiello e463a52435
Use `sys.executable` rather than `'python'` to launch the application. 2023-08-19 12:40:57 +02:00
Fabio Manganiello 0a5fc40dc5
Merge branch 'master' into 276/better-docker 2023-08-18 17:34:56 +02:00
Fabio Manganiello ec64b0ef8b
Added `--device_id` command line option.
continuous-integration/drone/push Build is failing Details
2023-08-17 23:16:24 +02:00
Fabio Manganiello ac83b43f98
Support for custom key-value overrides on `Config.init`. 2023-08-17 22:03:39 +02:00
Fabio Manganiello 657b2cc87d
Create the default configuration file even if --config is supplied but the file doesn't exist.
continuous-integration/drone/push Build is failing Details
2023-08-17 11:25:49 +02:00
Fabio Manganiello afa4de5673
Dockerfile moved to application root
continuous-integration/drone/push Build is passing Details
2023-08-17 10:38:21 +02:00
Fabio Manganiello 24b04d9103
s/--config-file/--config/ option in Dockerfile.
continuous-integration/drone/push Build is failing Details
2023-08-17 10:35:40 +02:00
Fabio Manganiello f07b774e75
A better Dockerfile.
continuous-integration/drone/push Build is passing Details
2023-08-17 03:04:34 +02:00