From fb6be7a9a3b6bc1aedc455ab2447d380bdac5450 Mon Sep 17 00:00:00 2001 From: Stavros Kois Date: Wed, 27 Nov 2024 15:43:54 +0200 Subject: [PATCH] apps: use the new docker_socket func that handles group adding as well --- ix-dev/community/dockge/app.yaml | 6 ++--- .../dockge/templates/docker-compose.yaml | 2 +- .../__init__.py | 0 .../{base_v2_0_22 => base_v2_0_23}/configs.py | 0 .../container.py | 4 +++ .../{base_v2_0_22 => base_v2_0_23}/depends.py | 0 .../{base_v2_0_22 => base_v2_0_23}/deploy.py | 0 .../{base_v2_0_22 => base_v2_0_23}/deps.py | 0 .../{base_v2_0_22 => base_v2_0_23}/device.py | 0 .../{base_v2_0_22 => base_v2_0_23}/devices.py | 0 .../{base_v2_0_22 => base_v2_0_23}/dns.py | 0 .../environment.py | 0 .../{base_v2_0_22 => base_v2_0_23}/error.py | 0 .../formatter.py | 0 .../functions.py | 0 .../healthcheck.py | 0 .../{base_v2_0_22 => base_v2_0_23}/labels.py | 0 .../{base_v2_0_22 => base_v2_0_23}/notes.py | 0 .../{base_v2_0_22 => base_v2_0_23}/portal.py | 0 .../{base_v2_0_22 => base_v2_0_23}/portals.py | 0 .../{base_v2_0_22 => base_v2_0_23}/ports.py | 0 .../{base_v2_0_22 => base_v2_0_23}/render.py | 0 .../resources.py | 0 .../{base_v2_0_22 => base_v2_0_23}/restart.py | 0 .../{base_v2_0_22 => base_v2_0_23}/storage.py | 2 +- .../tests/__init__.py | 0 .../tests/test_build_image.py | 0 .../tests/test_configs.py | 0 .../tests/test_container.py | 21 +++++++++++++++ .../tests/test_depends.py | 0 .../tests/test_deps.py | 0 .../tests/test_device.py | 0 .../tests/test_dns.py | 0 .../tests/test_environment.py | 0 .../tests/test_formatter.py | 0 .../tests/test_functions.py | 0 .../tests/test_healthcheck.py | 0 .../tests/test_labels.py | 0 .../tests/test_notes.py | 0 .../tests/test_portal.py | 0 .../tests/test_ports.py | 0 .../tests/test_render.py | 0 .../tests/test_resources.py | 0 .../tests/test_restart.py | 0 .../base_v2_0_23}/tests/test_volumes.py | 6 ++--- .../validations.py | 0 .../volume_mount.py | 0 .../volume_mount_types.py | 0 .../volume_sources.py | 0 .../volume_types.py | 0 .../{base_v2_0_22 => base_v2_0_23}/volumes.py | 0 ix-dev/community/uptime-kuma/app.yaml | 6 ++--- .../uptime-kuma/templates/docker-compose.yaml | 2 +- .../__init__.py | 0 .../{base_v2_0_21 => base_v2_0_23}/configs.py | 0 .../container.py | 4 +++ .../{base_v2_0_21 => base_v2_0_23}/depends.py | 0 .../{base_v2_0_21 => base_v2_0_23}/deploy.py | 0 .../{base_v2_0_21 => base_v2_0_23}/deps.py | 0 .../{base_v2_0_21 => base_v2_0_23}/device.py | 0 .../{base_v2_0_21 => base_v2_0_23}/devices.py | 0 .../{base_v2_0_21 => base_v2_0_23}/dns.py | 0 .../environment.py | 0 .../{base_v2_0_21 => base_v2_0_23}/error.py | 0 .../formatter.py | 0 .../functions.py | 27 ++++++++++++++++++- .../healthcheck.py | 0 .../{base_v2_0_21 => base_v2_0_23}/labels.py | 0 .../{base_v2_0_21 => base_v2_0_23}/notes.py | 0 .../{base_v2_0_21 => base_v2_0_23}/portal.py | 0 .../{base_v2_0_21 => base_v2_0_23}/portals.py | 0 .../{base_v2_0_21 => base_v2_0_23}/ports.py | 0 .../{base_v2_0_21 => base_v2_0_23}/render.py | 0 .../resources.py | 0 .../{base_v2_0_21 => base_v2_0_23}/restart.py | 0 .../{base_v2_0_21 => base_v2_0_23}/storage.py | 2 +- .../tests/__init__.py | 0 .../tests/test_build_image.py | 0 .../tests/test_configs.py | 0 .../tests/test_container.py | 21 +++++++++++++++ .../tests/test_depends.py | 0 .../tests/test_deps.py | 0 .../tests/test_device.py | 0 .../tests/test_dns.py | 0 .../tests/test_environment.py | 0 .../tests/test_formatter.py | 0 .../tests/test_functions.py | 13 +++++++++ .../tests/test_healthcheck.py | 0 .../tests/test_labels.py | 0 .../tests/test_notes.py | 0 .../tests/test_portal.py | 0 .../tests/test_ports.py | 0 .../tests/test_render.py | 0 .../tests/test_resources.py | 0 .../tests/test_restart.py | 0 .../base_v2_0_23}/tests/test_volumes.py | 6 ++--- .../validations.py | 0 .../volume_mount.py | 0 .../volume_mount_types.py | 0 .../volume_sources.py | 0 .../volume_types.py | 0 .../{base_v2_0_21 => base_v2_0_23}/volumes.py | 0 102 files changed, 105 insertions(+), 17 deletions(-) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/__init__.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/configs.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/container.py (98%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/depends.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/deploy.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/deps.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/device.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/devices.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/dns.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/environment.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/error.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/formatter.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/functions.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/healthcheck.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/labels.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/notes.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/portal.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/portals.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/ports.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/render.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/resources.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/restart.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/storage.py (97%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/__init__.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_build_image.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_configs.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_container.py (92%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_depends.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_deps.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_device.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_dns.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_environment.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_formatter.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_functions.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_healthcheck.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_labels.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_notes.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_portal.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_ports.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_render.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_resources.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/tests/test_restart.py (100%) rename ix-dev/community/{uptime-kuma/templates/library/base_v2_0_21 => dockge/templates/library/base_v2_0_23}/tests/test_volumes.py (99%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/validations.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/volume_mount.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/volume_mount_types.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/volume_sources.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/volume_types.py (100%) rename ix-dev/community/dockge/templates/library/{base_v2_0_22 => base_v2_0_23}/volumes.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/__init__.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/configs.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/container.py (98%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/depends.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/deploy.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/deps.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/device.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/devices.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/dns.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/environment.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/error.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/formatter.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/functions.py (70%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/healthcheck.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/labels.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/notes.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/portal.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/portals.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/ports.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/render.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/resources.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/restart.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/storage.py (97%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/__init__.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_build_image.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_configs.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_container.py (92%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_depends.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_deps.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_device.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_dns.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_environment.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_formatter.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_functions.py (79%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_healthcheck.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_labels.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_notes.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_portal.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_ports.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_render.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_resources.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/tests/test_restart.py (100%) rename ix-dev/community/{dockge/templates/library/base_v2_0_22 => uptime-kuma/templates/library/base_v2_0_23}/tests/test_volumes.py (99%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/validations.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/volume_mount.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/volume_mount_types.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/volume_sources.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/volume_types.py (100%) rename ix-dev/community/uptime-kuma/templates/library/{base_v2_0_21 => base_v2_0_23}/volumes.py (100%) diff --git a/ix-dev/community/dockge/app.yaml b/ix-dev/community/dockge/app.yaml index 056e9aa1ee..7359f08c9c 100644 --- a/ix-dev/community/dockge/app.yaml +++ b/ix-dev/community/dockge/app.yaml @@ -28,8 +28,8 @@ icon: https://media.sys.truenas.net/apps/dockge/icons/icon.svg keywords: - docker - compose -lib_version: 2.0.22 -lib_version_hash: a5314152df87f4b7a76f4fa3a2923e4508d82b530ac48f033466114befe2db3b +lib_version: 2.0.23 +lib_version_hash: 8909de0f230ddb07f219f65eb8e67f9b8a112e9c310bee801834248854aa91af maintainers: - email: dev@ixsystems.com name: truenas @@ -48,4 +48,4 @@ sources: - https://github.com/louislam/dockge title: Dockge train: community -version: 1.1.0 +version: 1.1.1 diff --git a/ix-dev/community/dockge/templates/docker-compose.yaml b/ix-dev/community/dockge/templates/docker-compose.yaml index 49d8e56bff..73d4839d06 100644 --- a/ix-dev/community/dockge/templates/docker-compose.yaml +++ b/ix-dev/community/dockge/templates/docker-compose.yaml @@ -21,7 +21,7 @@ {% do c1.environment.add_user_envs(values.dockge.additional_env) %} {% do c1.ports.add_port(values.network.web_port, values.network.web_port) %} -{% do c1.storage.add_docker_socket(read_only=False) %} +{% do c1.add_docker_socket(read_only=False) %} {% do c1.add_storage(values.consts.data_path, values.storage.data) %} {# Note that the DOCKGE_STACKS_DIR (container path) must be the SAME path as the host path #} diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/__init__.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/__init__.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/__init__.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/__init__.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/configs.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/configs.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/configs.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/configs.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/container.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/container.py similarity index 98% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/container.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/container.py index 1994caf704..34df9ec83b 100644 --- a/ix-dev/community/dockge/templates/library/base_v2_0_22/container.py +++ b/ix-dev/community/dockge/templates/library/base_v2_0_23/container.py @@ -192,6 +192,10 @@ def set_command(self, command: list[str]): def add_storage(self, mount_path: str, config: "IxStorage"): self._storage.add(mount_path, config) + def add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): + self.add_group(999) + self._storage._add_docker_socket(read_only, mount_path) + def set_shm_size_mb(self, size: int): self._shm_size = size diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/depends.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/depends.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/depends.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/depends.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/deploy.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/deploy.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/deploy.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/deploy.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/deps.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/deps.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/deps.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/deps.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/device.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/device.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/device.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/device.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/devices.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/devices.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/devices.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/devices.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/dns.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/dns.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/dns.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/dns.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/environment.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/environment.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/environment.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/environment.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/error.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/error.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/error.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/error.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/formatter.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/formatter.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/formatter.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/formatter.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/functions.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/functions.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/functions.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/functions.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/healthcheck.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/healthcheck.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/healthcheck.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/healthcheck.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/labels.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/labels.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/labels.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/labels.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/notes.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/notes.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/notes.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/notes.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/portal.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/portal.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/portal.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/portal.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/portals.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/portals.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/portals.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/portals.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/ports.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/ports.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/ports.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/ports.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/render.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/render.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/render.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/render.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/resources.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/resources.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/resources.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/resources.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/restart.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/restart.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/restart.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/restart.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/storage.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/storage.py similarity index 97% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/storage.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/storage.py index 3e5b629790..bf39d45daa 100644 --- a/ix-dev/community/dockge/templates/library/base_v2_0_22/storage.py +++ b/ix-dev/community/dockge/templates/library/base_v2_0_23/storage.py @@ -91,7 +91,7 @@ def add(self, mount_path: str, config: "IxStorage"): volume_mount = VolumeMount(self._render_instance, mount_path, config) self._volume_mounts.add(volume_mount) - def add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): + def _add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): cfg: "IxStorage" = { "type": "host_path", "read_only": read_only, diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/__init__.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/__init__.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/__init__.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/__init__.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_build_image.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_build_image.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_build_image.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_build_image.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_configs.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_configs.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_configs.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_configs.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_container.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_container.py similarity index 92% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_container.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_container.py index 35f26f43af..5e51b86198 100644 --- a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_container.py +++ b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_container.py @@ -148,6 +148,27 @@ def test_add_group_as_string(mock_values): c1.add_group("1000") +def test_add_docker_socket(mock_values): + render = Render(mock_values) + c1 = render.add_container("test_container", "test_image") + c1.healthcheck.disable() + c1.add_docker_socket() + output = render.render() + assert output["services"]["test_container"]["group_add"] == [568, 999] + assert output["services"]["test_container"]["volumes"] == [ + { + "type": "bind", + "source": "/var/run/docker.sock", + "target": "/var/run/docker.sock", + "read_only": True, + "bind": { + "propagation": "rprivate", + "create_host_path": False, + }, + } + ] + + def test_shm_size(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_depends.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_depends.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_depends.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_depends.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_deps.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_deps.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_deps.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_deps.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_device.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_device.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_device.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_device.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_dns.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_dns.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_dns.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_dns.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_environment.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_environment.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_environment.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_environment.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_formatter.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_formatter.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_formatter.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_formatter.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_functions.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_functions.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_functions.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_functions.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_healthcheck.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_healthcheck.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_healthcheck.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_healthcheck.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_labels.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_labels.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_labels.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_labels.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_notes.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_notes.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_notes.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_notes.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_portal.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_portal.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_portal.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_portal.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_ports.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_ports.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_ports.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_ports.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_render.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_render.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_render.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_render.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_resources.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_resources.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_resources.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_resources.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_restart.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_restart.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_restart.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_restart.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_volumes.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_volumes.py similarity index 99% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_volumes.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_volumes.py index e0ae9a6953..2084de09e0 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_volumes.py +++ b/ix-dev/community/dockge/templates/library/base_v2_0_23/tests/test_volumes.py @@ -619,7 +619,7 @@ def test_add_docker_socket(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket() + c1.storage._add_docker_socket() output = render.render() assert output["services"]["test_container"]["volumes"] == [ { @@ -636,7 +636,7 @@ def test_add_docker_socket_not_read_only(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket(read_only=False) + c1.storage._add_docker_socket(read_only=False) output = render.render() assert output["services"]["test_container"]["volumes"] == [ { @@ -653,7 +653,7 @@ def test_add_docker_socket_mount_path(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket(mount_path="/some/path") + c1.storage._add_docker_socket(mount_path="/some/path") output = render.render() assert output["services"]["test_container"]["volumes"] == [ { diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/validations.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/validations.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/validations.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/validations.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/volume_mount.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/volume_mount.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/volume_mount.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/volume_mount.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/volume_mount_types.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/volume_mount_types.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/volume_mount_types.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/volume_mount_types.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/volume_sources.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/volume_sources.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/volume_sources.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/volume_sources.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/volume_types.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/volume_types.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/volume_types.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/volume_types.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/volumes.py b/ix-dev/community/dockge/templates/library/base_v2_0_23/volumes.py similarity index 100% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/volumes.py rename to ix-dev/community/dockge/templates/library/base_v2_0_23/volumes.py diff --git a/ix-dev/community/uptime-kuma/app.yaml b/ix-dev/community/uptime-kuma/app.yaml index c77294c17e..ec28f33fc0 100644 --- a/ix-dev/community/uptime-kuma/app.yaml +++ b/ix-dev/community/uptime-kuma/app.yaml @@ -11,8 +11,8 @@ icon: https://media.sys.truenas.net/apps/uptime-kuma/icons/icon.svg keywords: - uptime - monitor -lib_version: 2.0.21 -lib_version_hash: e2faccd282b768e411919a7386a03e8491d1a7fda2da586dcf9af0d412733b8a +lib_version: 2.0.23 +lib_version_hash: 8909de0f230ddb07f219f65eb8e67f9b8a112e9c310bee801834248854aa91af maintainers: - email: dev@ixsystems.com name: truenas @@ -31,4 +31,4 @@ sources: - https://github.com/louislam/uptime-kuma title: Uptime Kuma train: community -version: 1.0.6 +version: 1.0.7 diff --git a/ix-dev/community/uptime-kuma/templates/docker-compose.yaml b/ix-dev/community/uptime-kuma/templates/docker-compose.yaml index b60598c3a3..bba1c9b625 100644 --- a/ix-dev/community/uptime-kuma/templates/docker-compose.yaml +++ b/ix-dev/community/uptime-kuma/templates/docker-compose.yaml @@ -8,7 +8,7 @@ {% do c1.add_storage("/app/data", values.storage.data) %} {% if values.uptime_kuma.mount_docker_socket %} - {% do c1.storage.add_docker_socket() %} + {% do c1.add_docker_socket() %} {% endif %} {% for store in values.storage.additional_storage %} diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/__init__.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/__init__.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/__init__.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/__init__.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/configs.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/configs.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/configs.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/configs.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/container.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/container.py similarity index 98% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/container.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/container.py index 1994caf704..34df9ec83b 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/container.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/container.py @@ -192,6 +192,10 @@ def set_command(self, command: list[str]): def add_storage(self, mount_path: str, config: "IxStorage"): self._storage.add(mount_path, config) + def add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): + self.add_group(999) + self._storage._add_docker_socket(read_only, mount_path) + def set_shm_size_mb(self, size: int): self._shm_size = size diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/depends.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/depends.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/depends.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/depends.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/deploy.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/deploy.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/deploy.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/deploy.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/deps.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/deps.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/deps.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/deps.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/device.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/device.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/device.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/device.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/devices.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/devices.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/devices.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/devices.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/dns.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/dns.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/dns.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/dns.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/environment.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/environment.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/environment.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/environment.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/error.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/error.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/error.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/error.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/formatter.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/formatter.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/formatter.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/formatter.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/functions.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/functions.py similarity index 70% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/functions.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/functions.py index a8799c3963..304dc1300f 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/functions.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/functions.py @@ -9,8 +9,10 @@ try: from .error import RenderError + from .volume_sources import HostPathSource, IxVolumeSource except ImportError: from error import RenderError + from volume_sources import HostPathSource, IxVolumeSource class Functions: @@ -85,10 +87,32 @@ def _merge_dicts(self, *dicts): merged_dict.update(dictionary) return merged_dict - def _disallow_chars(self, string, chars, key): + def _disallow_chars(self, string: str, chars: list[str], key: str): for char in chars: if char in string: raise RenderError(f"Disallowed character [{char}] in [{key}]") + return string + + def _get_host_path(self, storage): + source_type = storage.get("type", "") + if not source_type: + raise RenderError("Expected [type] to be set for volume mounts.") + + match source_type: + case "host_path": + mount_config = storage.get("host_path_config") + if mount_config is None: + raise RenderError("Expected [host_path_config] to be set for [host_path] type.") + host_source = HostPathSource(self._render_instance, mount_config).get() + return host_source + case "ix_volume": + mount_config = storage.get("ix_volume_config") + if mount_config is None: + raise RenderError("Expected [ix_volume_config] to be set for [ix_volume] type.") + ix_source = IxVolumeSource(self._render_instance, mount_config).get() + return ix_source + case _: + raise RenderError(f"Storage type [{source_type}] does not support host path.") def func_map(self): # TODO: Check what is no longer used and remove @@ -108,4 +132,5 @@ def func_map(self): "must_match_regex": self._must_match_regex, "secure_string": self._secure_string, "disallow_chars": self._disallow_chars, + "get_host_path": self._get_host_path, } diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/healthcheck.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/healthcheck.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/healthcheck.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/healthcheck.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/labels.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/labels.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/labels.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/labels.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/notes.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/notes.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/notes.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/notes.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/portal.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/portal.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/portal.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/portal.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/portals.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/portals.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/portals.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/portals.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/ports.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/ports.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/ports.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/ports.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/render.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/render.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/render.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/render.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/resources.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/resources.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/resources.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/resources.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/restart.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/restart.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/restart.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/restart.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/storage.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/storage.py similarity index 97% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/storage.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/storage.py index 3e5b629790..bf39d45daa 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/storage.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/storage.py @@ -91,7 +91,7 @@ def add(self, mount_path: str, config: "IxStorage"): volume_mount = VolumeMount(self._render_instance, mount_path, config) self._volume_mounts.add(volume_mount) - def add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): + def _add_docker_socket(self, read_only: bool = True, mount_path: str = "/var/run/docker.sock"): cfg: "IxStorage" = { "type": "host_path", "read_only": read_only, diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/__init__.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/__init__.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/__init__.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/__init__.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_build_image.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_build_image.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_build_image.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_build_image.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_configs.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_configs.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_configs.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_configs.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_container.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_container.py similarity index 92% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_container.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_container.py index 35f26f43af..5e51b86198 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_container.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_container.py @@ -148,6 +148,27 @@ def test_add_group_as_string(mock_values): c1.add_group("1000") +def test_add_docker_socket(mock_values): + render = Render(mock_values) + c1 = render.add_container("test_container", "test_image") + c1.healthcheck.disable() + c1.add_docker_socket() + output = render.render() + assert output["services"]["test_container"]["group_add"] == [568, 999] + assert output["services"]["test_container"]["volumes"] == [ + { + "type": "bind", + "source": "/var/run/docker.sock", + "target": "/var/run/docker.sock", + "read_only": True, + "bind": { + "propagation": "rprivate", + "create_host_path": False, + }, + } + ] + + def test_shm_size(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_depends.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_depends.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_depends.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_depends.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_deps.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_deps.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_deps.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_deps.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_device.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_device.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_device.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_device.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_dns.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_dns.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_dns.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_dns.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_environment.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_environment.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_environment.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_environment.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_formatter.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_formatter.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_formatter.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_formatter.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_functions.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_functions.py similarity index 79% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_functions.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_functions.py index a75e7c4084..6857fce3f1 100644 --- a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_functions.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_functions.py @@ -18,6 +18,7 @@ def mock_values(): def test_funcs(mock_values): + mock_values["ix_volumes"] = {"test": "/mnt/test123"} render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() @@ -49,6 +50,18 @@ def test_funcs(mock_values): {"func": "must_match_regex", "values": ["my_user", "^[0-9]$"], "expect_raise": True}, {"func": "must_match_regex", "values": ["1", "^[0-9]$"], "expected": "1"}, {"func": "secure_string", "values": [10], "expect_regex": r"^[a-zA-Z0-9-_]+$"}, + {"func": "disallow_chars", "values": ["my_user", ["$", "@"], "my_key"], "expected": "my_user"}, + {"func": "disallow_chars", "values": ["my_user$", ["$", "@"], "my_key"], "expect_raise": True}, + { + "func": "get_host_path", + "values": [{"type": "host_path", "host_path_config": {"path": "/mnt/test"}}], + "expected": "/mnt/test", + }, + { + "func": "get_host_path", + "values": [{"type": "ix_volume", "ix_volume_config": {"dataset_name": "test"}}], + "expected": "/mnt/test123", + }, ] for test in tests: diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_healthcheck.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_healthcheck.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_healthcheck.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_healthcheck.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_labels.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_labels.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_labels.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_labels.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_notes.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_notes.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_notes.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_notes.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_portal.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_portal.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_portal.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_portal.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_ports.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_ports.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_ports.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_ports.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_render.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_render.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_render.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_render.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_resources.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_resources.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_resources.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_resources.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_restart.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_restart.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/tests/test_restart.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_restart.py diff --git a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_volumes.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_volumes.py similarity index 99% rename from ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_volumes.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_volumes.py index e0ae9a6953..2084de09e0 100644 --- a/ix-dev/community/dockge/templates/library/base_v2_0_22/tests/test_volumes.py +++ b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/tests/test_volumes.py @@ -619,7 +619,7 @@ def test_add_docker_socket(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket() + c1.storage._add_docker_socket() output = render.render() assert output["services"]["test_container"]["volumes"] == [ { @@ -636,7 +636,7 @@ def test_add_docker_socket_not_read_only(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket(read_only=False) + c1.storage._add_docker_socket(read_only=False) output = render.render() assert output["services"]["test_container"]["volumes"] == [ { @@ -653,7 +653,7 @@ def test_add_docker_socket_mount_path(mock_values): render = Render(mock_values) c1 = render.add_container("test_container", "test_image") c1.healthcheck.disable() - c1.storage.add_docker_socket(mount_path="/some/path") + c1.storage._add_docker_socket(mount_path="/some/path") output = render.render() assert output["services"]["test_container"]["volumes"] == [ { diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/validations.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/validations.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/validations.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/validations.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_mount.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_mount.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_mount.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_mount.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_mount_types.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_mount_types.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_mount_types.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_mount_types.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_sources.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_sources.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_sources.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_sources.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_types.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_types.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volume_types.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volume_types.py diff --git a/ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volumes.py b/ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volumes.py similarity index 100% rename from ix-dev/community/uptime-kuma/templates/library/base_v2_0_21/volumes.py rename to ix-dev/community/uptime-kuma/templates/library/base_v2_0_23/volumes.py