plugin app manager: various improvements:

- Generated password must now be named and are stored, so they are re-used on following
  restarts. Password size can now be specified.
- New `not` filter for `!libervia_param` to inverse a boolean value.
- Former `front_url` field has been renamed to `web_url_path` as it is the URL path used
  for web frontend. All Web frontend related field are prefixed with `web_`.
- `front_url` is now used to specify a whole front URL (notably useful if an app uses its
  own domain). A list can be used to retrieve a key, like for `url_prefix`, and `https`
  scheme is added if no scheme is specified.
- An abstract class is now used for App Managers.
- Last application start time is stored in persistent data.
This commit is contained in:
Goffi 2024-05-31 11:08:14 +02:00
commit da80cae625
2 changed files with 176 additions and 39 deletions

View file

@ -22,6 +22,7 @@ from libervia.backend.core.i18n import _
from libervia.backend.core.constants import Const as C
from libervia.backend.core import exceptions
from libervia.backend.core.log import getLogger
from libervia.backend.plugins.plugin_misc_app_manager.models import AppManagerBackend
from libervia.backend.tools.common import async_process
log = getLogger(__name__)
@ -40,7 +41,7 @@ PLUGIN_INFO = {
}
class AppManagerDocker:
class AppManagerDocker(AppManagerBackend):
name = "docker-compose"
discover_path = Path(__file__).parent
@ -52,9 +53,7 @@ class AppManagerDocker:
raise exceptions.NotFound(
'"docker-compose" executable not found, Docker can\'t be used with '
'application manager')
self.host = host
self._am = host.plugins['APP_MANAGER']
self._am.register(self)
super().__init__(host)
async def start(self, app_data: dict) -> None:
await self._am.start_common(app_data)
@ -83,7 +82,7 @@ class AppManagerDocker:
path=str(working_dir),
)
async def compute_expose(self, app_data: dict) -> dict:
async def compute_expose(self, app_data: dict) -> None:
working_dir = app_data['_instance_dir_path']
expose = app_data['expose']
ports = expose.get('ports', {})

View file

@ -20,14 +20,14 @@ override:
WEBLATE_SERVER_EMAIL: !libervia_conf ["", "email_from", "weblate@example.com"]
WEBLATE_DEFAULT_FROM_EMAIL: !libervia_conf ["", "email_from", "weblate@example.com"]
WEBLATE_SITE_DOMAIN: !libervia_conf ["", "public_url"]
WEBLATE_ADMIN_PASSWORD: !libervia_generate_pwd
WEBLATE_ADMIN_PASSWORD: !libervia_generate_pwd {name: admin}
WEBLATE_ADMIN_EMAIL: !libervia_conf ["", "email_admins_list", "", "first"]
WEBLATE_ENABLE_HTTPS: !libervia_conf ["", "weblate_enable_https", "1"]
volumes:
- ./settings-override.py:/app/data/settings-override.py:ro
expose:
url_prefix: [override, services, weblate, environment, WEBLATE_URL_PREFIX]
front_url: !libervia_param [front_url, /translate]
web_url_path: !libervia_param [front_url_path, /translate]
web_label: Translate
ports:
web: