zrb 0.27.1__py3-none-any.whl → 0.28.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zrb/action/runner.py +0 -2
- zrb/builtin/devtool/install/zsh/install.sh +1 -1
- zrb/builtin/git/get_file_changes.py +13 -5
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/start.py +7 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/start.py +7 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/remove.py +8 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/stop.py +8 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/start.py +15 -3
- zrb/config/config.py +0 -9
- zrb/helper/asyncio_task.py +15 -5
- zrb/helper/git/detect_changes.py +7 -2
- zrb/task/base_task/base_task.py +39 -9
- zrb/task/cmd_task.py +9 -10
- zrb/task/docker_compose_start_task.py +30 -27
- zrb/task/docker_compose_task.py +50 -19
- zrb/task/looper.py +1 -1
- {zrb-0.27.1.dist-info → zrb-0.28.1.dist-info}/METADATA +1 -1
- {zrb-0.27.1.dist-info → zrb-0.28.1.dist-info}/RECORD +21 -27
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_helper.py +0 -8
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/_helper.py +0 -24
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/_helper.py +0 -22
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/_helper.py +0 -30
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/.generator-version +0 -1
- zrb/shell-scripts/ensure-podman-is-installed.sh +0 -55
- {zrb-0.27.1.dist-info → zrb-0.28.1.dist-info}/LICENSE +0 -0
- {zrb-0.27.1.dist-info → zrb-0.28.1.dist-info}/WHEEL +0 -0
- {zrb-0.27.1.dist-info → zrb-0.28.1.dist-info}/entry_points.txt +0 -0
zrb/action/runner.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import sys
|
2
1
|
from collections.abc import Callable, Mapping
|
3
2
|
from typing import Any, Union
|
4
3
|
|
@@ -122,7 +121,6 @@ class Runner:
|
|
122
121
|
function(*args, **kwargs)
|
123
122
|
except Exception:
|
124
123
|
stop_asyncio_sync()
|
125
|
-
sys.exit(1)
|
126
124
|
finally:
|
127
125
|
task.clear_xcom()
|
128
126
|
|
@@ -16,12 +16,19 @@ from zrb.task_input.str_input import StrInput
|
|
16
16
|
description="Get modified files",
|
17
17
|
inputs=[
|
18
18
|
StrInput(
|
19
|
-
name="commit",
|
19
|
+
name="current-commit",
|
20
20
|
shortcut="c",
|
21
|
-
description="commit hash/tag",
|
22
|
-
prompt="
|
21
|
+
description="current commit hash/tag",
|
22
|
+
prompt="Current commit hash/Tag",
|
23
23
|
default="HEAD",
|
24
24
|
),
|
25
|
+
StrInput(
|
26
|
+
name="source-commit",
|
27
|
+
shortcut="s",
|
28
|
+
description="source commit hash/tag",
|
29
|
+
prompt="Source commit hash/Tag",
|
30
|
+
default="main",
|
31
|
+
),
|
25
32
|
BoolInput(
|
26
33
|
name="include-new",
|
27
34
|
description="include new files",
|
@@ -44,11 +51,12 @@ from zrb.task_input.str_input import StrInput
|
|
44
51
|
runner=runner,
|
45
52
|
)
|
46
53
|
async def get_git_file_changes(*args: Any, **kwargs: Any):
|
47
|
-
|
54
|
+
current_commit = kwargs.get("current_commit", "HEAD")
|
55
|
+
source_commit = kwargs.get("source_commit", "main")
|
48
56
|
include_new = kwargs.get("include_new", True)
|
49
57
|
include_removed = kwargs.get("include_removed", True)
|
50
58
|
include_updated = kwargs.get("include_updated", True)
|
51
|
-
modified_file_states = get_modified_file_states(
|
59
|
+
modified_file_states = get_modified_file_states(current_commit, source_commit)
|
52
60
|
modified_file_keys = []
|
53
61
|
output = []
|
54
62
|
for modified_file, state in modified_file_states.items():
|
@@ -21,7 +21,6 @@ from .._input import enable_monitoring_input
|
|
21
21
|
from .._service_config import snake_zrb_app_name_service_configs
|
22
22
|
from ..remove import remove_snake_zrb_app_name_container
|
23
23
|
from ._group import snake_zrb_app_name_microservices_container_group
|
24
|
-
from ._helper import activate_microservices_compose_profile
|
25
24
|
|
26
25
|
start_snake_zrb_app_name_microservices_container = DockerComposeStartTask(
|
27
26
|
icon="🐳",
|
@@ -38,7 +37,13 @@ start_snake_zrb_app_name_microservices_container = DockerComposeStartTask(
|
|
38
37
|
should_execute="{{ input.local_snake_zrb_app_name}}",
|
39
38
|
upstreams=[build_snake_zrb_app_name_image, remove_snake_zrb_app_name_container],
|
40
39
|
cwd=RESOURCE_DIR,
|
41
|
-
|
40
|
+
compose_profiles=[
|
41
|
+
'{{"postgres" if env.APP_DB_CONNECTION.startswith("postgresql") else ""}}',
|
42
|
+
'{{"kafka" if env.APP_BROKER_TYPE == "kafka" else ""}}',
|
43
|
+
'{{"rabbitmq" if env.APP_BROKER_TYPE == "rabbitmq" else ""}}',
|
44
|
+
'{{"monitoring" if input.enable_snake_zrb_app_name_monitoring else ""}}',
|
45
|
+
"microservices",
|
46
|
+
],
|
42
47
|
compose_env_prefix="CONTAINER_ZRB_ENV_PREFIX",
|
43
48
|
compose_service_configs=snake_zrb_app_name_service_configs,
|
44
49
|
env_files=[compose_env_file],
|
@@ -21,7 +21,6 @@ from .._input import enable_monitoring_input
|
|
21
21
|
from .._service_config import snake_zrb_app_name_service_configs
|
22
22
|
from ..remove import remove_snake_zrb_app_name_container
|
23
23
|
from ._group import snake_zrb_app_name_monolith_container_group
|
24
|
-
from ._helper import activate_monolith_compose_profile
|
25
24
|
|
26
25
|
start_snake_zrb_app_name_monolith_container = DockerComposeStartTask(
|
27
26
|
icon="🐳",
|
@@ -38,7 +37,13 @@ start_snake_zrb_app_name_monolith_container = DockerComposeStartTask(
|
|
38
37
|
should_execute="{{ input.local_snake_zrb_app_name}}",
|
39
38
|
upstreams=[build_snake_zrb_app_name_image, remove_snake_zrb_app_name_container],
|
40
39
|
cwd=RESOURCE_DIR,
|
41
|
-
|
40
|
+
compose_profiles=[
|
41
|
+
'{{"postgres" if env.APP_DB_CONNECTION.startswith("postgresql") else ""}}',
|
42
|
+
'{{"kafka" if env.APP_BROKER_TYPE == "kafka" else ""}}',
|
43
|
+
'{{"rabbitmq" if env.APP_BROKER_TYPE == "rabbitmq" else ""}}',
|
44
|
+
'{{"monitoring" if input.enable_snake_zrb_app_name_monitoring else ""}}',
|
45
|
+
"monolith",
|
46
|
+
],
|
42
47
|
compose_env_prefix="CONTAINER_ZRB_ENV_PREFIX",
|
43
48
|
compose_service_configs=snake_zrb_app_name_service_configs,
|
44
49
|
env_files=[compose_env_file],
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/remove.py
CHANGED
@@ -5,7 +5,6 @@ from .._constant import RESOURCE_DIR
|
|
5
5
|
from ..image._env import image_env
|
6
6
|
from ._env import compose_env_file
|
7
7
|
from ._group import snake_zrb_app_name_container_group
|
8
|
-
from ._helper import activate_all_compose_profile
|
9
8
|
from ._service_config import snake_zrb_app_name_service_configs
|
10
9
|
|
11
10
|
remove_snake_zrb_app_name_container = DockerComposeTask(
|
@@ -14,8 +13,15 @@ remove_snake_zrb_app_name_container = DockerComposeTask(
|
|
14
13
|
description="Remove human readable zrb app name container",
|
15
14
|
group=snake_zrb_app_name_container_group,
|
16
15
|
cwd=RESOURCE_DIR,
|
17
|
-
setup_cmd=activate_all_compose_profile,
|
18
16
|
compose_cmd="down",
|
17
|
+
compose_profiles=[
|
18
|
+
"postgres",
|
19
|
+
"kafka",
|
20
|
+
"rabbitmq",
|
21
|
+
"monitoring",
|
22
|
+
"monolith",
|
23
|
+
"microservices",
|
24
|
+
],
|
19
25
|
compose_env_prefix="CONTAINER_ZRB_ENV_PREFIX",
|
20
26
|
compose_service_configs=snake_zrb_app_name_service_configs,
|
21
27
|
env_files=[compose_env_file],
|
@@ -5,7 +5,6 @@ from .._constant import RESOURCE_DIR
|
|
5
5
|
from ..image._env import image_env
|
6
6
|
from ._env import compose_env_file, host_port_env
|
7
7
|
from ._group import snake_zrb_app_name_container_group
|
8
|
-
from ._helper import activate_all_compose_profile
|
9
8
|
from ._service_config import snake_zrb_app_name_service_configs
|
10
9
|
|
11
10
|
stop_snake_zrb_app_name_container = DockerComposeTask(
|
@@ -14,8 +13,15 @@ stop_snake_zrb_app_name_container = DockerComposeTask(
|
|
14
13
|
description="Stop human readable zrb app name container",
|
15
14
|
group=snake_zrb_app_name_container_group,
|
16
15
|
cwd=RESOURCE_DIR,
|
17
|
-
setup_cmd=activate_all_compose_profile,
|
18
16
|
compose_cmd="stop",
|
17
|
+
compose_profiles=[
|
18
|
+
"postgres",
|
19
|
+
"kafka",
|
20
|
+
"rabbitmq",
|
21
|
+
"monitoring",
|
22
|
+
"monolith",
|
23
|
+
"microservices",
|
24
|
+
],
|
19
25
|
compose_env_prefix="CONTAINER_ZRB_ENV_PREFIX",
|
20
26
|
compose_service_configs=snake_zrb_app_name_service_configs,
|
21
27
|
env_files=[compose_env_file],
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/start.py
CHANGED
@@ -17,7 +17,6 @@ from .._input import enable_monitoring_input
|
|
17
17
|
from .._service_config import snake_zrb_app_name_service_configs
|
18
18
|
from ..remove import remove_snake_zrb_app_name_container
|
19
19
|
from ._group import snake_zrb_app_name_support_container_group
|
20
|
-
from ._helper import activate_support_compose_profile, should_start_support_container
|
21
20
|
|
22
21
|
start_snake_zrb_app_name_support_container = DockerComposeStartTask(
|
23
22
|
icon="🐳",
|
@@ -31,10 +30,23 @@ start_snake_zrb_app_name_support_container = DockerComposeStartTask(
|
|
31
30
|
https_input,
|
32
31
|
image_input,
|
33
32
|
],
|
34
|
-
should_execute=should_start_support_container,
|
35
33
|
upstreams=[remove_snake_zrb_app_name_container],
|
36
34
|
cwd=RESOURCE_DIR,
|
37
|
-
|
35
|
+
should_execute=" ".join(
|
36
|
+
[
|
37
|
+
"{{",
|
38
|
+
'env.APP_DB_CONNECTION.startswith("postgresql")',
|
39
|
+
'or env.APP_BROKER_TYPE in ("kafka", "rabbitmq")',
|
40
|
+
"or input.enable_snake_zrb_app_name_monitoring",
|
41
|
+
"}}",
|
42
|
+
]
|
43
|
+
),
|
44
|
+
compose_profiles=[
|
45
|
+
'{{"postgres" if env.APP_DB_CONNECTION.startswith("postgresql") else ""}}',
|
46
|
+
'{{"kafka" if env.APP_BROKER_TYPE == "kafka" else ""}}',
|
47
|
+
'{{"rabbitmq" if env.APP_BROKER_TYPE == "rabbitmq" else ""}}',
|
48
|
+
'{{"monitoring" if input.enable_snake_zrb_app_name_monitoring else ""}}',
|
49
|
+
],
|
38
50
|
compose_env_prefix="CONTAINER_ZRB_ENV_PREFIX",
|
39
51
|
compose_service_configs=snake_zrb_app_name_service_configs,
|
40
52
|
env_files=[compose_env_file],
|
zrb/config/config.py
CHANGED
@@ -18,12 +18,6 @@ def _get_current_shell() -> str:
|
|
18
18
|
return "bash"
|
19
19
|
|
20
20
|
|
21
|
-
def _get_valid_container_backend(container_backend: str) -> str:
|
22
|
-
if container_backend.lower().strip() == "podman":
|
23
|
-
return "podman"
|
24
|
-
return "docker"
|
25
|
-
|
26
|
-
|
27
21
|
def _get_default_tmp_dir() -> str:
|
28
22
|
if os.path.isdir("/tmp"):
|
29
23
|
return "/tmp"
|
@@ -52,7 +46,4 @@ SHOW_ADVERTISEMENT = untyped_to_boolean(os.getenv("ZRB_SHOW_ADVERTISEMENT", "1")
|
|
52
46
|
SHOW_PROMPT = untyped_to_boolean(os.getenv("ZRB_SHOW_PROMPT", "1"))
|
53
47
|
SHOW_TIME = untyped_to_boolean(os.getenv("ZRB_SHOW_TIME", "1"))
|
54
48
|
VERSION = _get_version()
|
55
|
-
CONTAINER_BACKEND = _get_valid_container_backend(
|
56
|
-
os.getenv("ZRB_CONTAINER_BACKEND", "docker")
|
57
|
-
)
|
58
49
|
ENABLE_TYPE_CHECKING = untyped_to_boolean(os.getenv("ZRB_ENABLE_TYPE_CHECKING", "1"))
|
zrb/helper/asyncio_task.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
+
import sys
|
2
3
|
|
3
4
|
from zrb.helper.accessories.color import colored
|
4
5
|
from zrb.helper.log import logger
|
@@ -6,11 +7,22 @@ from zrb.helper.log import logger
|
|
6
7
|
logger.debug(colored("Loading zrb.helper.asyncio_task", attrs=["dark"]))
|
7
8
|
|
8
9
|
|
10
|
+
def _surpress_event_loop_error(unraisable):
|
11
|
+
if not (
|
12
|
+
isinstance(unraisable.exc_value, RuntimeError)
|
13
|
+
and str(unraisable.exc_value) == "Event loop is closed"
|
14
|
+
):
|
15
|
+
# Raise exception for anything except "event loop is closed"
|
16
|
+
sys.__unraisablehook__(unraisable)
|
17
|
+
|
18
|
+
|
19
|
+
sys.unraisablehook = _surpress_event_loop_error
|
20
|
+
|
21
|
+
|
9
22
|
async def stop_asyncio():
|
10
23
|
tasks = [task for task in asyncio.all_tasks() if task is not asyncio.current_task()]
|
11
24
|
for task in tasks:
|
12
25
|
task.cancel()
|
13
|
-
|
14
26
|
# Wait until all tasks are cancelled
|
15
27
|
await asyncio.gather(*tasks, return_exceptions=True)
|
16
28
|
|
@@ -20,7 +32,5 @@ def stop_asyncio_sync():
|
|
20
32
|
loop = asyncio.get_event_loop()
|
21
33
|
if loop.is_running():
|
22
34
|
loop.create_task(stop_asyncio())
|
23
|
-
|
24
|
-
|
25
|
-
except Exception:
|
26
|
-
pass
|
35
|
+
except asyncio.CancelledError:
|
36
|
+
logger.warning("Task is cancelled")
|
zrb/helper/git/detect_changes.py
CHANGED
@@ -16,8 +16,13 @@ class ModificationState:
|
|
16
16
|
|
17
17
|
|
18
18
|
@typechecked
|
19
|
-
def get_modified_file_states(
|
20
|
-
|
19
|
+
def get_modified_file_states(
|
20
|
+
current_commit: str, source_commit: str = "main"
|
21
|
+
) -> Mapping[str, ModificationState]:
|
22
|
+
# git show b176b5a main
|
23
|
+
exit_status, output = subprocess.getstatusoutput(
|
24
|
+
f"git diff {source_commit} {current_commit}"
|
25
|
+
)
|
21
26
|
if exit_status != 0:
|
22
27
|
raise Exception(output)
|
23
28
|
lines = output.split("\n")
|
zrb/task/base_task/base_task.py
CHANGED
@@ -159,16 +159,15 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
159
159
|
def copy(self) -> AnyTask:
|
160
160
|
return copy.deepcopy(self)
|
161
161
|
|
162
|
-
def
|
162
|
+
def __get_async_function(
|
163
163
|
self,
|
164
164
|
env_prefix: str = "",
|
165
165
|
raise_error: bool = True,
|
166
|
-
is_async: bool = False,
|
167
166
|
show_done_info: bool = True,
|
168
167
|
should_clear_xcom: bool = False,
|
169
168
|
should_stop_looper: bool = False,
|
170
169
|
) -> Callable[..., Any]:
|
171
|
-
async def
|
170
|
+
async def async_function(*args: Any, **kwargs: Any) -> Any:
|
172
171
|
self.log_info("Copy task")
|
173
172
|
self_cp: AnyTask = self.copy()
|
174
173
|
result = await self_cp._run_and_check_all(
|
@@ -184,9 +183,41 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
184
183
|
self_cp.clear_xcom()
|
185
184
|
return result
|
186
185
|
|
186
|
+
return async_function
|
187
|
+
|
188
|
+
def __to_sync_function(
|
189
|
+
self, async_function: Callable[..., Any]
|
190
|
+
) -> Callable[..., Any]:
|
191
|
+
def sync_function(*args: Any, **kwargs: Any) -> Any:
|
192
|
+
try:
|
193
|
+
return asyncio.run(async_function(*args, **kwargs))
|
194
|
+
except RuntimeError as e:
|
195
|
+
if "event loop is closed" not in str(e).lower():
|
196
|
+
raise e
|
197
|
+
except asyncio.CancelledError:
|
198
|
+
self.print_out_dark("Task is cancelled")
|
199
|
+
|
200
|
+
return sync_function
|
201
|
+
|
202
|
+
def to_function(
|
203
|
+
self,
|
204
|
+
env_prefix: str = "",
|
205
|
+
raise_error: bool = True,
|
206
|
+
is_async: bool = False,
|
207
|
+
show_done_info: bool = True,
|
208
|
+
should_clear_xcom: bool = False,
|
209
|
+
should_stop_looper: bool = False,
|
210
|
+
) -> Callable[..., Any]:
|
211
|
+
async_function = self.__get_async_function(
|
212
|
+
env_prefix=env_prefix,
|
213
|
+
raise_error=raise_error,
|
214
|
+
show_done_info=show_done_info,
|
215
|
+
should_clear_xcom=should_clear_xcom,
|
216
|
+
should_stop_looper=should_stop_looper,
|
217
|
+
)
|
187
218
|
if is_async:
|
188
|
-
return
|
189
|
-
return
|
219
|
+
return async_function
|
220
|
+
return self.__to_sync_function(async_function)
|
190
221
|
|
191
222
|
async def run(self, *args: Any, **kwargs: Any) -> Any:
|
192
223
|
if self._run_function is not None:
|
@@ -287,9 +318,6 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
287
318
|
result = results[-1]
|
288
319
|
self._print_result(result)
|
289
320
|
return result
|
290
|
-
except RuntimeError as e:
|
291
|
-
if raise_error and ("event loop is closed" not in str(e).lower()):
|
292
|
-
raise e
|
293
321
|
except Exception as e:
|
294
322
|
self.log_error(f"{e}")
|
295
323
|
if raise_error:
|
@@ -384,7 +412,9 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
384
412
|
is_failed: bool = False
|
385
413
|
while self._should_attempt():
|
386
414
|
try:
|
387
|
-
self.log_debug(
|
415
|
+
self.log_debug(
|
416
|
+
f"Started with args: {args} and kwargs: {local_kwargs}"
|
417
|
+
) # noqa
|
388
418
|
await self.on_started()
|
389
419
|
self.__running_tasks.append(self)
|
390
420
|
result = await run_async(self.run, *args, **local_kwargs)
|
zrb/task/cmd_task.py
CHANGED
@@ -291,8 +291,6 @@ class CmdTask(BaseTask):
|
|
291
291
|
for pid in self._pids:
|
292
292
|
self.__kill_by_pid(pid)
|
293
293
|
stop_asyncio_sync()
|
294
|
-
_print_out_dark(f"Exiting with signal {signum}")
|
295
|
-
sys.exit(signum)
|
296
294
|
|
297
295
|
def __on_exit(self):
|
298
296
|
self._global_state.no_more_attempt = True
|
@@ -351,14 +349,15 @@ class CmdTask(BaseTask):
|
|
351
349
|
)
|
352
350
|
)
|
353
351
|
# wait process
|
354
|
-
await
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
await
|
361
|
-
|
352
|
+
await asyncio.gather(
|
353
|
+
process.wait(),
|
354
|
+
stdout_process,
|
355
|
+
stderr_process,
|
356
|
+
)
|
357
|
+
# stop messages in queue
|
358
|
+
await asyncio.gather(stdout_queue.put(None), stderr_queue.put(None))
|
359
|
+
# end logging
|
360
|
+
await asyncio.gather(stdout_log_process, stderr_log_process)
|
362
361
|
|
363
362
|
def get_cmd_script(self, *args: Any, **kwargs: Any) -> str:
|
364
363
|
return self._create_cmd_script(self._cmd_path, self._cmd, *args, **kwargs)
|
@@ -45,6 +45,7 @@ class DockerComposeStartTask(DockerComposeTask):
|
|
45
45
|
compose_options: Mapping[JinjaTemplate, JinjaTemplate] = {},
|
46
46
|
compose_flags: Iterable[JinjaTemplate] = [],
|
47
47
|
compose_args: Iterable[JinjaTemplate] = [],
|
48
|
+
compose_profiles: Iterable[JinjaTemplate] = [],
|
48
49
|
compose_env_prefix: str = "",
|
49
50
|
setup_cmd: CmdVal = "",
|
50
51
|
setup_cmd_path: CmdVal = "",
|
@@ -85,9 +86,11 @@ class DockerComposeStartTask(DockerComposeTask):
|
|
85
86
|
executable=executable,
|
86
87
|
compose_service_configs=compose_service_configs,
|
87
88
|
compose_file=compose_file,
|
89
|
+
compose_cmd="up",
|
88
90
|
compose_options=compose_options,
|
89
91
|
compose_flags=compose_flags,
|
90
92
|
compose_args=compose_args,
|
93
|
+
compose_profiles=compose_profiles,
|
91
94
|
compose_env_prefix=compose_env_prefix,
|
92
95
|
setup_cmd=setup_cmd,
|
93
96
|
setup_cmd_path=setup_cmd_path,
|
@@ -116,31 +119,31 @@ class DockerComposeStartTask(DockerComposeTask):
|
|
116
119
|
should_show_working_directory=should_show_working_directory,
|
117
120
|
)
|
118
121
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
122
|
-
|
122
|
+
def _get_execute_docker_compose_script(
|
123
|
+
self,
|
124
|
+
compose_cmd: JinjaTemplate,
|
125
|
+
compose_options: Mapping[JinjaTemplate, JinjaTemplate],
|
126
|
+
compose_flags: Iterable[JinjaTemplate],
|
127
|
+
compose_args: Iterable[JinjaTemplate],
|
128
|
+
*args: Any
|
129
|
+
) -> JinjaTemplate:
|
130
|
+
return "\n".join(
|
131
|
+
[
|
132
|
+
# compose start
|
133
|
+
super()._get_execute_docker_compose_script(
|
134
|
+
compose_cmd=compose_cmd,
|
135
|
+
compose_options=compose_options,
|
136
|
+
compose_flags=list(compose_flags) + ["-d"],
|
137
|
+
compose_args=compose_args,
|
138
|
+
*args,
|
139
|
+
),
|
140
|
+
# compose log
|
141
|
+
super()._get_execute_docker_compose_script(
|
142
|
+
compose_cmd="logs",
|
143
|
+
compose_options={},
|
144
|
+
compose_flags=["-f"],
|
145
|
+
compose_args=[],
|
146
|
+
*args,
|
147
|
+
),
|
148
|
+
]
|
123
149
|
)
|
124
|
-
cmd_list = [setup_cmd] if setup_cmd.strip() != "" else []
|
125
|
-
# compose command
|
126
|
-
cmd_list = cmd_list + [
|
127
|
-
# compose start
|
128
|
-
self._get_docker_compose_cmd_script(
|
129
|
-
compose_cmd="up",
|
130
|
-
compose_options=self._compose_options,
|
131
|
-
compose_flags=list(self._compose_flags) + ["-d"],
|
132
|
-
compose_args=self._compose_args,
|
133
|
-
*args,
|
134
|
-
),
|
135
|
-
# compose log
|
136
|
-
self._get_docker_compose_cmd_script(
|
137
|
-
compose_cmd="logs",
|
138
|
-
compose_options={},
|
139
|
-
compose_flags=["-f"],
|
140
|
-
compose_args=[],
|
141
|
-
*args,
|
142
|
-
),
|
143
|
-
]
|
144
|
-
cmd_str = "\n".join(cmd_list)
|
145
|
-
self.log_info(f"Command: {cmd_str}")
|
146
|
-
return cmd_str
|
zrb/task/docker_compose_task.py
CHANGED
@@ -3,7 +3,6 @@ import pathlib
|
|
3
3
|
from collections.abc import Callable, Iterable, Mapping
|
4
4
|
from typing import Any, Optional, TypeVar, Union
|
5
5
|
|
6
|
-
from zrb.config.config import CONTAINER_BACKEND
|
7
6
|
from zrb.helper.accessories.color import colored
|
8
7
|
from zrb.helper.accessories.name import get_random_name
|
9
8
|
from zrb.helper.docker_compose.fetch_external_env import fetch_compose_file_env_map
|
@@ -42,24 +41,13 @@ ensure_container_backend = CmdTask(
|
|
42
41
|
name="ensure-compose-backend",
|
43
42
|
cmd_path=[
|
44
43
|
os.path.join(SHELL_SCRIPT_DIR, "_common-util.sh"),
|
45
|
-
os.path.join(SHELL_SCRIPT_DIR,
|
44
|
+
os.path.join(SHELL_SCRIPT_DIR, "ensure-docker-is-installed.sh"),
|
46
45
|
],
|
47
46
|
preexec_fn=None,
|
48
47
|
should_print_cmd_result=False,
|
49
48
|
should_show_cmd=False,
|
50
49
|
should_show_working_directory=False,
|
51
50
|
)
|
52
|
-
ensure_zrb_network_task = CmdTask(
|
53
|
-
name="ensure-zrb-network",
|
54
|
-
cmd=[
|
55
|
-
f"{CONTAINER_BACKEND} network inspect zrb >/dev/null 2>&1 || \\",
|
56
|
-
f"{CONTAINER_BACKEND} network create -d bridge zrb",
|
57
|
-
],
|
58
|
-
upstreams=[ensure_container_backend],
|
59
|
-
should_print_cmd_result=False,
|
60
|
-
should_show_cmd=False,
|
61
|
-
should_show_working_directory=False,
|
62
|
-
)
|
63
51
|
|
64
52
|
|
65
53
|
@typechecked
|
@@ -94,6 +82,7 @@ class DockerComposeTask(CmdTask):
|
|
94
82
|
compose_options: Mapping[JinjaTemplate, JinjaTemplate] = {},
|
95
83
|
compose_flags: Iterable[JinjaTemplate] = [],
|
96
84
|
compose_args: Iterable[JinjaTemplate] = [],
|
85
|
+
compose_profiles: CmdVal = "",
|
97
86
|
compose_env_prefix: str = "",
|
98
87
|
setup_cmd: CmdVal = "",
|
99
88
|
setup_cmd_path: CmdVal = "",
|
@@ -134,7 +123,7 @@ class DockerComposeTask(CmdTask):
|
|
134
123
|
executable=executable,
|
135
124
|
cwd=cwd,
|
136
125
|
should_render_cwd=should_render_cwd,
|
137
|
-
upstreams=[
|
126
|
+
upstreams=[ensure_container_backend] + upstreams,
|
138
127
|
fallbacks=fallbacks,
|
139
128
|
on_triggered=on_triggered,
|
140
129
|
on_waiting=on_waiting,
|
@@ -168,6 +157,7 @@ class DockerComposeTask(CmdTask):
|
|
168
157
|
self._compose_flags = compose_flags
|
169
158
|
self._compose_args = compose_args
|
170
159
|
self._compose_env_prefix = compose_env_prefix
|
160
|
+
self._compose_profiles = compose_profiles
|
171
161
|
self._compose_template_file = self.__get_compose_template_file(compose_file)
|
172
162
|
self._compose_runtime_file = self.__get_compose_runtime_file(
|
173
163
|
self._compose_template_file
|
@@ -333,14 +323,24 @@ class DockerComposeTask(CmdTask):
|
|
333
323
|
raise Exception(f"Invalid compose file: {compose_file}")
|
334
324
|
|
335
325
|
def get_cmd_script(self, *args: Any, **kwargs: Any) -> str:
|
326
|
+
cmd_list = []
|
327
|
+
# create network
|
328
|
+
create_network_script = self._get_create_compose_network_script()
|
329
|
+
if create_network_script.strip() != "":
|
330
|
+
cmd_list.append(create_network_script)
|
331
|
+
# set compose profiles
|
332
|
+
compose_profile_script = self._get_compose_profile_script(*args, **kwargs)
|
333
|
+
if compose_profile_script.strip() != "":
|
334
|
+
cmd_list.append(compose_profile_script)
|
336
335
|
# setup
|
337
|
-
|
336
|
+
setup_script = self._create_cmd_script(
|
338
337
|
self._setup_cmd_path, self._setup_cmd, *args, **kwargs
|
339
338
|
)
|
340
|
-
|
339
|
+
if setup_script.strip() != "":
|
340
|
+
cmd_list.append(setup_script)
|
341
341
|
# compose command
|
342
342
|
cmd_list.append(
|
343
|
-
self.
|
343
|
+
self._get_execute_docker_compose_script(
|
344
344
|
compose_cmd=self._compose_cmd,
|
345
345
|
compose_options=self._compose_options,
|
346
346
|
compose_flags=self._compose_flags,
|
@@ -352,7 +352,38 @@ class DockerComposeTask(CmdTask):
|
|
352
352
|
self.log_info(f"Command: {cmd_str}")
|
353
353
|
return cmd_str
|
354
354
|
|
355
|
-
def
|
355
|
+
def _get_compose_profile_script(self, *args, **kwargs) -> str:
|
356
|
+
# Get list representation of self._compose_profiles
|
357
|
+
compose_profiles = self._compose_profiles
|
358
|
+
if callable(compose_profiles):
|
359
|
+
compose_profiles = self._compose_profiles(*args, **kwargs)
|
360
|
+
if isinstance(compose_profiles, str):
|
361
|
+
compose_profiles = compose_profiles.split(",")
|
362
|
+
# Get only non empty profiles
|
363
|
+
filtered_compose_profiles = [
|
364
|
+
self.render_str(profile)
|
365
|
+
for profile in compose_profiles
|
366
|
+
if self.render_str(profile).strip() != ""
|
367
|
+
]
|
368
|
+
if len(filtered_compose_profiles) == 0:
|
369
|
+
return ""
|
370
|
+
compose_profiles_str = ",".join(filtered_compose_profiles)
|
371
|
+
return f"export COMPOSE_PROFILES={compose_profiles_str}"
|
372
|
+
|
373
|
+
def _get_create_compose_network_script(self) -> str:
|
374
|
+
compose_data = read_compose_file(self._compose_runtime_file)
|
375
|
+
networks: Mapping[str, Mapping[str, Any]] = compose_data.get("networks", {})
|
376
|
+
scripts = []
|
377
|
+
for key, config in networks.items():
|
378
|
+
if not config.get("external", False):
|
379
|
+
continue
|
380
|
+
network_name = config.get("name", key)
|
381
|
+
scripts.append(
|
382
|
+
f"docker network inspect {network_name} > /dev/null 2>&1 || docker network create -d bridge{network_name}" # noqa
|
383
|
+
)
|
384
|
+
return "\n".join(scripts)
|
385
|
+
|
386
|
+
def _get_execute_docker_compose_script(
|
356
387
|
self,
|
357
388
|
compose_cmd: str,
|
358
389
|
compose_options: Mapping[JinjaTemplate, JinjaTemplate],
|
@@ -383,4 +414,4 @@ class DockerComposeTask(CmdTask):
|
|
383
414
|
if self.render_str(arg) != ""
|
384
415
|
]
|
385
416
|
)
|
386
|
-
return f"
|
417
|
+
return f"docker compose {options} {compose_cmd} {flags} {args}"
|
zrb/task/looper.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
zrb/__init__.py,sha256=dQs1S6z3XbG1BeQ62YYxc6cUs5ejw9T9ajkPgNVEs34,2875
|
2
2
|
zrb/__main__.py,sha256=-_k0XOahDF-06n41Uly-oUMkZ8XDSxO-WUUImWz6GiA,171
|
3
3
|
zrb/action/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
zrb/action/runner.py,sha256=
|
4
|
+
zrb/action/runner.py,sha256=pSQMtJKP7xb0IZ1X5iGPX0y4ZA8COO7gGQGfjlVKKtc,5140
|
5
5
|
zrb/advertisement.py,sha256=E-8Dv0oPhw0j-bKEc_IsWV9NPUIs24r1Jgp0p0exAMU,664
|
6
6
|
zrb/builtin/__init__.py,sha256=Nw3gZS1S-HKt_LTQuhffZT4NcZAdelJabCSFdkm6E8g,3407
|
7
7
|
zrb/builtin/_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -59,7 +59,7 @@ zrb/builtin/devtool/install/terraform/terraform.py,sha256=jBtBFoSEh6jrDV2_mUOqty
|
|
59
59
|
zrb/builtin/devtool/install/tmux/install.sh,sha256=RsmLzKVzY9O7wBNMc-xE7S1sH0aJDsCiVgEXsRXqQ8w,1229
|
60
60
|
zrb/builtin/devtool/install/tmux/resource/config.sh,sha256=wQCb4Q-mNkxIPOcvpN84X9RUWkGY16u3Vd-pOhVidgg,416
|
61
61
|
zrb/builtin/devtool/install/tmux/tmux.py,sha256=Qvv9mSZhzBtoPRL5zs49G2GdJpY674s8Bt4nFWbIF-o,1322
|
62
|
-
zrb/builtin/devtool/install/zsh/install.sh,sha256=
|
62
|
+
zrb/builtin/devtool/install/zsh/install.sh,sha256=J2GdFuTRo8s33LcFmjKMYpCZ_wZB4iK0aEeL7XtcYyE,1719
|
63
63
|
zrb/builtin/devtool/install/zsh/resource/config.sh,sha256=2ZEmmiu5KS-FSMlj48IDPh5dhx5fnbzri86CtzI5Np0,5068
|
64
64
|
zrb/builtin/devtool/install/zsh/zsh.py,sha256=JJMyNSDt0uMTJppYRT2bWy446D8ArQ8ZRPZLV117s7g,1325
|
65
65
|
zrb/builtin/docker/__init__.py,sha256=H6mkl7hojJYiHArn2Q1ppw9yZC8TxTRnrYajRJcR77Y,142
|
@@ -80,7 +80,7 @@ zrb/builtin/explain/task.py,sha256=HaWEwHn9lwXT1hrEgmQw-sW2qY62qaPsCEtY92F7yzA,3
|
|
80
80
|
zrb/builtin/git/__init__.py,sha256=1oIuwaOTyXomYGLjS65VLRXCLgTOqT79R2YGkVhcdGk,239
|
81
81
|
zrb/builtin/git/_group.py,sha256=yDZD0dIXDI8oG2DQpWsZhDS07HKAHrLj-luKTscI0ng,106
|
82
82
|
zrb/builtin/git/clear_branch.py,sha256=4eccEAlSoo1GcP7VZQTg-0d8gohuxlBZpBQohGIe3tg,479
|
83
|
-
zrb/builtin/git/get_file_changes.py,sha256=
|
83
|
+
zrb/builtin/git/get_file_changes.py,sha256=ejnRt4iL8T7yKKygHfvE1YweUMB7gJwXr0BzQdfu53s,2763
|
84
84
|
zrb/builtin/group.py,sha256=6k4TM49C93GZF63srUNkoVwdoIaoD5__dw66krPipGo,1292
|
85
85
|
zrb/builtin/md5/__init__.py,sha256=UQVSJdQTrLF8XDKNRhkFG05DHjfGQiarlwoatqRJwn0,196
|
86
86
|
zrb/builtin/md5/_group.py,sha256=dimqCmJItc7qx7yRm64tL608oMAjOVXRycP7NTSSFi0,100
|
@@ -226,23 +226,19 @@ zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/config
|
|
226
226
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/__init__.py,sha256=UllmGaHqIT4JrsyVN6kQAcSVA32sUdYpBpOQpxmLQ_M,988
|
227
227
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_env.py,sha256=2ysgQ6yJWb6h3u0tMvNXFgXwbUEE7CJX6k_8VxOOnNg,333
|
228
228
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_group.py,sha256=WbQq0AprHwudJPP38VpDB0cTnQP1HCZK_xVJY8_D1n0,240
|
229
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_helper.py,sha256=uXHHTi3qjmgPd-hBsXdbCjyXHVxl84nZQao1eaQb5xk,280
|
230
229
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_input.py,sha256=uBXfLqOQxiVn8UGfGhgTbUV_1Se6nNVQZKxF9mpTW6k,246
|
231
230
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_service_config.py,sha256=lOvwhfIbdMuQ-QYoibG5FMW2U-ZuOWcLd-puWAVcj-A,2048
|
232
231
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/__init__.py,sha256=ftU92OGyRh2VZr-fkR1rJA-VLxevBlIypHqrlNW3OMc,250
|
233
232
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/_group.py,sha256=PI6pgBfZRyG6YQqLoEZQLD9TKVZcrn2Yx8wqpunROwo,292
|
234
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/
|
235
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/start.py,sha256=NHvC5A1A--bM0hQ53Zu1rJMtFUm5UVBwhD4-SJ67L0Y,2216
|
233
|
+
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/start.py,sha256=h-a72rEk0ZwSVwZ_xXBAqe0Y280ieLUKfxS9yZHXumw,2459
|
236
234
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/__init__.py,sha256=1ELaHwNeMmFO9Hy9foqsM-EHgesKYlnQsbUI_i_KYiA,230
|
237
235
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/_group.py,sha256=u-vUVCZ8Q8LIVlw4lpduZYImIpSsNmO5FfUqsGrVFLc,277
|
238
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/
|
239
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/
|
240
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/
|
241
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/stop.py,sha256=SAOiJdc2wSOnpzsx5pBtX1qwP2BYbZCT2peqD-8YT4s,994
|
236
|
+
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/start.py,sha256=9QTneFfh5lxwaiIJrUM6fAhbj38sgevj6ZVjDKzhaKo,2433
|
237
|
+
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/remove.py,sha256=A87V06Du_V4kG1EK9aWlrFAwvazu8ucv9Rak6_Nu1kQ,1016
|
238
|
+
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/stop.py,sha256=rxtG4P4MFVYGhTq2Al6WooGghaQ2xmplXWo_mZXuxHU,1054
|
242
239
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/__init__.py,sha256=TKNXysArhYcwaeLWCTrim3U599JXs_IkgKF0y7urYVI,226
|
243
240
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/_group.py,sha256=NbgCdPT5lGEd9ce4bid_HuFVp9loDKDA7qA7KfPsowA,274
|
244
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/
|
245
|
-
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/start.py,sha256=Q_j94fC3moUi_xxbna6JbCdsUYmlUEg77y58B_FSh1w,1773
|
241
|
+
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/start.py,sha256=DK-gEEsxAafI0Ai9viaLABaumJ8QtKctmEdkC2r6pmI,2198
|
246
242
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/destroy.py,sha256=hMwW7c-kRfDAc_ndLJ--1yu4KbPzdhM5bcOq1wpml1A,1161
|
247
243
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/destroy.sh,sha256=Yc-jb01oostiRMtrsTNWJXn_Fee5iDfv16L4DaoklEA,29
|
248
244
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/frontend/__init__.py,sha256=oUAubQE0KGRd04wSURGC87ZRoCl58yPGccRiey7tJBQ,299
|
@@ -278,7 +274,6 @@ zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/monoli
|
|
278
274
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/monolith/start.sh,sha256=KI-PqiOes-xWA2thSW2icD3VEgxRJUxjRmc_3y9mS14,57
|
279
275
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/test.py,sha256=RuZGmP2OTPZcDOuBX5p-j5TizakkDxEClWhB2Fg64M4,1826
|
280
276
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/test.sh,sha256=ibnoS4kV1p-3JREJKlX2UsziP009zHzP9miPxID1tpk,308
|
281
|
-
zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/.generator-version,sha256=7kobEqGURA6fqyUvQGmQgHfJ7qsL3tXgh_8IUo4M7PY,10
|
282
277
|
zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/.gitignore,sha256=YFrq8n_0yn9FT0XqcPVftHmKj31DSh4ftIY8EvQm0ik,53
|
283
278
|
zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/README.md,sha256=mIE-CBlKzx_wEQdGIuiJbzDX_bCC13ckMnOYU8erHpI,15200
|
284
279
|
zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/all-module-disabled.env,sha256=eIbYiufwRJ-artnA7Cw2y4YzGrPw2XtEb-ih_f4tCuw,56
|
@@ -1327,7 +1322,7 @@ zrb/builtin/update.py,sha256=89i_fPUlL27IXczLI7Lr7k4STMpnxyw2je8daCKUTQo,225
|
|
1327
1322
|
zrb/builtin/version.py,sha256=i0pnnLQFLdTwcVqZs6xsGkbAY-IPbmelip7HuZVjgv0,384
|
1328
1323
|
zrb/builtin/watch_changes.py,sha256=Vr__e_T31nnbefcPftvyn78dT3-UXqNRpH0KO-COeKQ,1220
|
1329
1324
|
zrb/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1330
|
-
zrb/config/config.py,sha256=
|
1325
|
+
zrb/config/config.py,sha256=CBzfexBmP5cFPYuOM0SruCT4jWha73qe8YqwV9T8fdM,1625
|
1331
1326
|
zrb/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1332
1327
|
zrb/helper/accessories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1333
1328
|
zrb/helper/accessories/color.py,sha256=7bj2-K_sn1leXN_C9eeOWXZBfnsBAFOzfirSiM8vCMw,964
|
@@ -1335,7 +1330,7 @@ zrb/helper/accessories/icon.py,sha256=uKm3w5G1fV454MUhz_CZMy48AD99kBV9j2zRlJWzB1
|
|
1335
1330
|
zrb/helper/accessories/name.py,sha256=e1uvU3MzuvDb5j6YIWBA048y4qeM-LfrxRKWlMehliE,1638
|
1336
1331
|
zrb/helper/accessories/untyped_color.py,sha256=4wRbHSClbCzPRWtW-Cy2agOMozANVi7u4p8lMXMSuJg,194
|
1337
1332
|
zrb/helper/advertisement.py,sha256=GOaCtWYL9Oj_tAg4jqsCuFsdinHaOSH_6d57y8BbsVU,912
|
1338
|
-
zrb/helper/asyncio_task.py,sha256=
|
1333
|
+
zrb/helper/asyncio_task.py,sha256=UcE2axvWDh8GCFYtPUZCrSZ8VfRS-lsffyDEupjK1-8,1021
|
1339
1334
|
zrb/helper/callable.py,sha256=usatPKPkK_67G9dWreaGXskOaGHd_hE8MiTWAUhfojE,563
|
1340
1335
|
zrb/helper/cli.py,sha256=cb82aZCX5NoOHQNTx3wtdKOAQJP79ky4HA6w0VjVBh0,2603
|
1341
1336
|
zrb/helper/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -1360,7 +1355,7 @@ zrb/helper/file/copy_tree.py,sha256=Tm1ImZWJ9tKB3sQd-4M0Kk1NSuBMLDlkYQfSKV_Grsc,
|
|
1360
1355
|
zrb/helper/file/match.py,sha256=wUan0dYRhzSW0_vU247SH3hEeZ_MWyDacoJdmnlS3cY,713
|
1361
1356
|
zrb/helper/file/text.py,sha256=7JqNbk8hC7Y4UopEmhiGYkxDAauepvI1tEkbfpzcI84,963
|
1362
1357
|
zrb/helper/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1363
|
-
zrb/helper/git/detect_changes.py,sha256=
|
1358
|
+
zrb/helper/git/detect_changes.py,sha256=jrfSe8po4f9ynTl05PBHAThaESw9ZeqfalR_rNR_VhQ,1420
|
1364
1359
|
zrb/helper/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1365
1360
|
zrb/helper/loader/load_module.py,sha256=OfF7rtiXjNqAjIycLveXcmrWz8bZ0R9uqKeae_xYc2c,570
|
1366
1361
|
zrb/helper/loader/load_script.py,sha256=LvIRB4-f3ft-wEp1amhws-L-mCKDQ1rFUzrdc16AwGE,1998
|
@@ -1384,7 +1379,6 @@ zrb/helper/util.py,sha256=s3Wdg-hYbhkttW7o2-C8erQqMuxStSpR8f2psgZzP68,3836
|
|
1384
1379
|
zrb/runner.py,sha256=9huyeIi8gqbMQV3u6CRBeB8s9WVynECR0jECuCAYm9c,261
|
1385
1380
|
zrb/shell-scripts/_common-util.sh,sha256=8zvSAbDp8z4JWxMT6s6bSnNBCfCB88gLLpK5LOhyPBg,229
|
1386
1381
|
zrb/shell-scripts/ensure-docker-is-installed.sh,sha256=8CL5gYs428LPWcF43X-1O1i2YyWAOGzXTKZttiS9J1Q,2999
|
1387
|
-
zrb/shell-scripts/ensure-podman-is-installed.sh,sha256=RvLLQIBN5cfLEsFkTpomgl_PxJZ6z0Wl0VGGtjIA5JM,1529
|
1388
1382
|
zrb/shell-scripts/ensure-rsync-is-installed.sh,sha256=ffr8avoCUSoDQkEBWmeelgn-EtF9reQTaM0wfW6B0hc,1146
|
1389
1383
|
zrb/shell-scripts/ensure-ssh-is-installed.sh,sha256=w5pCzsbEa3bnxT07q6gX0nWn-7HXsMiwBRrg7dMD57w,2414
|
1390
1384
|
zrb/shell-scripts/notify.ps1,sha256=6_xPoIwuxARpYljcjVV-iRJS3gJqGfx-B6kj719cJ9o,843
|
@@ -1392,7 +1386,7 @@ zrb/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1392
1386
|
zrb/task/any_task.py,sha256=SlAp6LY-8TGopaQm3eZD3ZEx3wxvCff8UfcnYyu-aiY,39344
|
1393
1387
|
zrb/task/any_task_event_handler.py,sha256=ay4v7eXatF4sCiXpUYaHVJZljpnKlvBbFIwvZqXW8Mo,541
|
1394
1388
|
zrb/task/base_task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1395
|
-
zrb/task/base_task/base_task.py,sha256=
|
1389
|
+
zrb/task/base_task/base_task.py,sha256=iieOSoDvKVJpDpTH1LdO-uA1yBPRHxMDPyEgS0wKwmc,21434
|
1396
1390
|
zrb/task/base_task/component/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1397
1391
|
zrb/task/base_task/component/base_task_model.py,sha256=EuTWvY54mD_ATy4-VFZw4uCOu3Mfe8hgZikwTnIjmkY,10381
|
1398
1392
|
zrb/task/base_task/component/common_task_model.py,sha256=X_Ubu5kNycQJ-dFiLMARvC6GWQ9pIjBCdxh3MVelc-A,13544
|
@@ -1400,13 +1394,13 @@ zrb/task/base_task/component/pid_model.py,sha256=RjJIqOpavucDssnd3q3gT4q8QnP8I9S
|
|
1400
1394
|
zrb/task/base_task/component/renderer.py,sha256=xxcMbHhWPMUgAO3DWec_E-OeqlCKtwCBGFzLoc5g8BE,4484
|
1401
1395
|
zrb/task/base_task/component/trackers.py,sha256=3G4dMhh1kVaJrmRwiGzWQSbr1fB-w9xXjBKz_vRifYc,2063
|
1402
1396
|
zrb/task/checker.py,sha256=mh_2ajZqpNdJQ8AFVQ6ZArYtBUOXST3aZSisINuEivk,3400
|
1403
|
-
zrb/task/cmd_task.py,sha256=
|
1397
|
+
zrb/task/cmd_task.py,sha256=BcWXiikCQqFHIYs-PPSnvFTM10HKntj76h3wCE6sqKs,14701
|
1404
1398
|
zrb/task/decorator.py,sha256=SuajollezbwiSOs29bv8A6PmFcFs_RH4pr4TPcQPDHM,3081
|
1405
|
-
zrb/task/docker_compose_start_task.py,sha256=
|
1406
|
-
zrb/task/docker_compose_task.py,sha256=
|
1399
|
+
zrb/task/docker_compose_start_task.py,sha256=XjE2bV9bnqaMhgtElR-gC1as1uM9_-ozX7qzubyteQY,5453
|
1400
|
+
zrb/task/docker_compose_task.py,sha256=6nywyIMrOuQMJ5bsDaWEyUm91NkIP6HL0nnmKI_IEf8,17081
|
1407
1401
|
zrb/task/flow_task.py,sha256=wkvvUCrt6n1ul-o3STCPMdrlBuGBrNCRgtRzGyXir9o,5079
|
1408
1402
|
zrb/task/http_checker.py,sha256=gXqBlEStMnIhzmQ7FX9Zo-nG3-wsiVEML8IOJiSG5JI,5705
|
1409
|
-
zrb/task/looper.py,sha256=
|
1403
|
+
zrb/task/looper.py,sha256=tYMG9rTMEd5-FP0CIBfbcWfahsg6W-ED66AV5C-kCrk,1441
|
1410
1404
|
zrb/task/notifier.py,sha256=xjqT5Vydr_0cc1m4jA-odhHMZg6CSGciFCs0rhVkvPM,6265
|
1411
1405
|
zrb/task/parallel.py,sha256=Xz9az51hHfkeEmOEo3Xb-B7GPoOT_DxuakpAfCbzzV0,1176
|
1412
1406
|
zrb/task/path_checker.py,sha256=xkOpxlLUaEXlsiWh1o-ghqQNWYadXvTl3QV4yeIC2Rc,4677
|
@@ -1438,8 +1432,8 @@ zrb/task_input/multiline_input.py,sha256=KNto5k5X1C6KE_A-vX0OjpQyjgCRJ6BR2PwHXNQ
|
|
1438
1432
|
zrb/task_input/password_input.py,sha256=95NlJ9xIq7z_evpAyR2XsBpeuWpBXd2Ezn3P7oDOttk,4360
|
1439
1433
|
zrb/task_input/str_input.py,sha256=0nje7vI9fs_xqQBbmKB8Yn7wevlWp9Qebv7f8-GmiXs,4350
|
1440
1434
|
zrb/task_input/task_input.py,sha256=WTj_qIQyRs-04-VotjNTcVyIuf6b2afInVoCQHoRmr0,2327
|
1441
|
-
zrb-0.
|
1442
|
-
zrb-0.
|
1443
|
-
zrb-0.
|
1444
|
-
zrb-0.
|
1445
|
-
zrb-0.
|
1435
|
+
zrb-0.28.1.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
|
1436
|
+
zrb-0.28.1.dist-info/METADATA,sha256=G0gdU5pa1asXppGDzHH6NFIdDc7gXAstIsznDYCd53E,17094
|
1437
|
+
zrb-0.28.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
1438
|
+
zrb-0.28.1.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
|
1439
|
+
zrb-0.28.1.dist-info/RECORD,,
|
zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_helper.py
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
|
4
|
-
def activate_all_compose_profile(*args: Any, **kwargs: Any) -> str:
|
5
|
-
compose_profile_str = ",".join(
|
6
|
-
["monitoring", "monolith", "microservices", "kafka", "postgres", "rabbitmq"]
|
7
|
-
)
|
8
|
-
return f"export COMPOSE_PROFILES={compose_profile_str}"
|
@@ -1,24 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from ..support._helper import get_support_container_compose_profiles
|
4
|
-
|
5
|
-
|
6
|
-
def activate_microservices_compose_profile(*args: Any, **kwargs: Any) -> str:
|
7
|
-
compose_profiles = _get_microservices_container_compose_profiles(*args, **kwargs)
|
8
|
-
compose_profile_str = ",".join(compose_profiles)
|
9
|
-
return f"export COMPOSE_PROFILES={compose_profile_str}"
|
10
|
-
|
11
|
-
|
12
|
-
def should_start_microservices_container(*args: Any, **kwargs: Any) -> bool:
|
13
|
-
if not kwargs.get("local_snake_zrb_app_name", True):
|
14
|
-
return False
|
15
|
-
compose_profiles = _get_microservices_container_compose_profiles(*args, **kwargs)
|
16
|
-
return len(compose_profiles) > 0
|
17
|
-
|
18
|
-
|
19
|
-
def _get_microservices_container_compose_profiles(
|
20
|
-
*args: Any, **kwargs: Any
|
21
|
-
) -> list[str]:
|
22
|
-
compose_profiles = get_support_container_compose_profiles(*args, **kwargs)
|
23
|
-
compose_profiles.append("microservices")
|
24
|
-
return compose_profiles
|
@@ -1,22 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from ..support._helper import get_support_container_compose_profiles
|
4
|
-
|
5
|
-
|
6
|
-
def activate_monolith_compose_profile(*args: Any, **kwargs: Any) -> str:
|
7
|
-
compose_profiles = _get_monolith_container_compose_profiles(*args, **kwargs)
|
8
|
-
compose_profile_str = ",".join(compose_profiles)
|
9
|
-
return f"export COMPOSE_PROFILES={compose_profile_str}"
|
10
|
-
|
11
|
-
|
12
|
-
def should_start_monolith_container(*args: Any, **kwargs: Any) -> bool:
|
13
|
-
if not kwargs.get("local_snake_zrb_app_name", True):
|
14
|
-
return False
|
15
|
-
compose_profiles = _get_monolith_container_compose_profiles(*args, **kwargs)
|
16
|
-
return len(compose_profiles) > 0
|
17
|
-
|
18
|
-
|
19
|
-
def _get_monolith_container_compose_profiles(*args: Any, **kwargs: Any) -> list[str]:
|
20
|
-
compose_profiles = get_support_container_compose_profiles(*args, **kwargs)
|
21
|
-
compose_profiles.append("monolith")
|
22
|
-
return compose_profiles
|
@@ -1,30 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from zrb import Task
|
4
|
-
|
5
|
-
|
6
|
-
def activate_support_compose_profile(*args: Any, **kwargs: Any) -> str:
|
7
|
-
compose_profiles = get_support_container_compose_profiles(*args, **kwargs)
|
8
|
-
compose_profile_str = ",".join(compose_profiles)
|
9
|
-
return f"export COMPOSE_PROFILES={compose_profile_str}"
|
10
|
-
|
11
|
-
|
12
|
-
def should_start_support_container(*args: Any, **kwargs: Any) -> bool:
|
13
|
-
if not kwargs.get("local_snake_zrb_app_name", True):
|
14
|
-
return False
|
15
|
-
compose_profiles = get_support_container_compose_profiles(*args, **kwargs)
|
16
|
-
return len(compose_profiles) > 0
|
17
|
-
|
18
|
-
|
19
|
-
def get_support_container_compose_profiles(*args: Any, **kwargs: Any) -> list[str]:
|
20
|
-
task: Task = kwargs.get("_task")
|
21
|
-
env_map = task.get_env_map()
|
22
|
-
compose_profiles: list[str] = []
|
23
|
-
if env_map.get("APP_DB_CONNECTION", "").startswith("postgresql"):
|
24
|
-
compose_profiles.append("postgres")
|
25
|
-
broker_type = env_map.get("APP_BROKER_TYPE", "rabbitmq")
|
26
|
-
if broker_type in ["rabbitmq", "kafka"]:
|
27
|
-
compose_profiles.append(broker_type)
|
28
|
-
if kwargs.get("enable_snake_zrb_app_name_monitoring", False):
|
29
|
-
compose_profiles.append("monitoring")
|
30
|
-
return compose_profiles
|
@@ -1 +0,0 @@
|
|
1
|
-
zrbVersion
|
@@ -1,55 +0,0 @@
|
|
1
|
-
set -e
|
2
|
-
if command_exists podman
|
3
|
-
then
|
4
|
-
log_info "Podman is already installed."
|
5
|
-
else
|
6
|
-
log_info "Installing Podman..."
|
7
|
-
if [ "$OS_TYPE" = "Darwin" ]
|
8
|
-
then
|
9
|
-
if command_exists brew
|
10
|
-
then
|
11
|
-
brew install --cask podman
|
12
|
-
log_info "Please start Podman before proceeding."
|
13
|
-
else
|
14
|
-
log_info "Homebrew not found. Please install Homebrew and try again."
|
15
|
-
exit 1
|
16
|
-
fi
|
17
|
-
elif [ "$OS_TYPE" = "Linux" ]
|
18
|
-
then
|
19
|
-
if command_exists apt
|
20
|
-
then
|
21
|
-
try_sudo apt update
|
22
|
-
try_sudo apt install -y podman
|
23
|
-
elif command_exists yum
|
24
|
-
then
|
25
|
-
try_sudo yum install -y podman
|
26
|
-
elif command_exists dnf
|
27
|
-
then
|
28
|
-
try_sudo dnf install -y podman
|
29
|
-
elif command_exists pacman
|
30
|
-
then
|
31
|
-
try_sudo pacman -Syu --noconfirm podman
|
32
|
-
else
|
33
|
-
log_info "No known package manager found. Please install Podman manually."
|
34
|
-
exit 1
|
35
|
-
fi
|
36
|
-
else
|
37
|
-
log_info "Unsupported OS type. Please install Podman manually."
|
38
|
-
exit 1
|
39
|
-
fi
|
40
|
-
fi
|
41
|
-
|
42
|
-
if ! command_exists podman-compose
|
43
|
-
then
|
44
|
-
log_info "Installing Podman Compose plugin..."
|
45
|
-
pip install podman-compose
|
46
|
-
fi
|
47
|
-
|
48
|
-
# Check Podman Compose plugin installation
|
49
|
-
if command_exists podman && command_exists podman-compose
|
50
|
-
then
|
51
|
-
log_info "Podman Compose plugin is already installed."
|
52
|
-
else
|
53
|
-
log_info "Podman Compose plugin is not installed or podman is not running. Please check your installation."
|
54
|
-
exit 1
|
55
|
-
fi
|
File without changes
|
File without changes
|
File without changes
|