From 5407961613d210f0188566df01c9f4172bf8c8ea Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 15 Nov 2023 01:39:56 -0600 Subject: [PATCH] Add run-webapp command. --- stack_orchestrator/deploy/compose/deploy_docker.py | 5 +++-- stack_orchestrator/deploy/deployer.py | 2 +- stack_orchestrator/deploy/k8s/deploy_k8s.py | 2 +- stack_orchestrator/main.py | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stack_orchestrator/deploy/compose/deploy_docker.py b/stack_orchestrator/deploy/compose/deploy_docker.py index 79ab1482..b37f3cf0 100644 --- a/stack_orchestrator/deploy/compose/deploy_docker.py +++ b/stack_orchestrator/deploy/compose/deploy_docker.py @@ -61,9 +61,10 @@ class DockerDeployer(Deployer): except DockerException as e: raise DeployerException(e) - def run(self, image, command, user, volumes, entrypoint=None): + def run(self, image: str, command=None, user=None, volumes=None, entrypoint=None, env={}, detach=False): try: - return self.docker.run(image=image, command=command, user=user, volumes=volumes, entrypoint=entrypoint) + return self.docker.run(image=image, command=command, user=user, volumes=volumes, + entrypoint=entrypoint, envs=env, detach=detach, publish_all=True) except DockerException as e: raise DeployerException(e) diff --git a/stack_orchestrator/deploy/deployer.py b/stack_orchestrator/deploy/deployer.py index 68b0088a..79379c3d 100644 --- a/stack_orchestrator/deploy/deployer.py +++ b/stack_orchestrator/deploy/deployer.py @@ -44,7 +44,7 @@ class Deployer(ABC): pass @abstractmethod - def run(self, image, command, user, volumes, entrypoint): + def run(self, image: str, command=None, user=None, volumes=None, entrypoint=None, env={}, detach=False): pass diff --git a/stack_orchestrator/deploy/k8s/deploy_k8s.py b/stack_orchestrator/deploy/k8s/deploy_k8s.py index bc256b6b..627d6e0b 100644 --- a/stack_orchestrator/deploy/k8s/deploy_k8s.py +++ b/stack_orchestrator/deploy/k8s/deploy_k8s.py @@ -120,7 +120,7 @@ class K8sDeployer(Deployer): log_data = self.core_api.read_namespaced_pod_log(k8s_pod_name, namespace="default", container="test") return log_stream_from_string(log_data) - def run(self, image, command, user, volumes, entrypoint=None): + def run(self, image: str, command=None, user=None, volumes=None, entrypoint=None, env={}, detach=False): # We need to figure out how to do this -- check why we're being called first pass diff --git a/stack_orchestrator/main.py b/stack_orchestrator/main.py index 0b0585e0..8ee8ae61 100644 --- a/stack_orchestrator/main.py +++ b/stack_orchestrator/main.py @@ -20,6 +20,7 @@ from stack_orchestrator.repos import setup_repositories from stack_orchestrator.build import build_containers from stack_orchestrator.build import build_npms from stack_orchestrator.build import build_webapp +from stack_orchestrator.deploy import run_webapp from stack_orchestrator.deploy import deploy from stack_orchestrator import version from stack_orchestrator.deploy import deployment @@ -50,6 +51,7 @@ cli.add_command(setup_repositories.command, "setup-repositories") cli.add_command(build_containers.command, "build-containers") cli.add_command(build_npms.command, "build-npms") cli.add_command(build_webapp.command, "build-webapp") +cli.add_command(run_webapp.command, "run-webapp") cli.add_command(deploy.command, "deploy") # deploy is an alias for deploy-system cli.add_command(deploy.command, "deploy-system") cli.add_command(deployment.command, "deployment")