No lint
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 37s
Smoke Test / Run basic test suite (pull_request) Successful in 5m4s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m8s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m53s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 8m27s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 10m28s

This commit is contained in:
Thomas E Lackey 2024-08-26 22:33:00 -05:00
parent 1f5549a8bb
commit f0020f3b18

View File

@ -36,7 +36,7 @@ WEBAPP_PORT = 80
@click.option("--port", help="port to use (default random)") @click.option("--port", help="port to use (default random)")
@click.pass_context @click.pass_context
def command(ctx, image, env_file, port): def command(ctx, image, env_file, port):
"""run the specified webapp container""" '''run the specified webapp container'''
env = {} env = {}
if env_file: if env_file:
@ -46,33 +46,20 @@ def command(ctx, image, env_file, port):
hash = hashlib.md5(unique_cluster_descriptor.encode()).hexdigest() hash = hashlib.md5(unique_cluster_descriptor.encode()).hexdigest()
cluster = f"laconic-webapp-{hash}" cluster = f"laconic-webapp-{hash}"
deployer = getDeployer( deployer = getDeployer(type=constants.compose_deploy_type,
type=constants.compose_deploy_type,
deployment_context=None, deployment_context=None,
compose_files=None, compose_files=None,
compose_project_name=cluster, compose_project_name=cluster,
compose_env_file=None, compose_env_file=None)
)
ports = [] ports = []
if port: if port:
ports = [(port, WEBAPP_PORT)] ports = [(port, WEBAPP_PORT)]
container = deployer.run( container = deployer.run(image, command=[], user=None, volumes=[], entrypoint=None, env=env, ports=ports, detach=True)
image,
command=[],
user=None,
volumes=[],
entrypoint=None,
env=env,
ports=ports,
detach=True,
)
# Make configurable? # Make configurable?
webappPort = f"{WEBAPP_PORT}/tcp" webappPort = f"{WEBAPP_PORT}/tcp"
# TODO: This assumes a Docker container object... # TODO: This assumes a Docker container object...
if webappPort in container.network_settings.ports: if webappPort in container.network_settings.ports:
mapping = container.network_settings.ports[webappPort][0] mapping = container.network_settings.ports[webappPort][0]
print( print(f"""Image: {image}\nID: {container.id}\nURL: http://localhost:{mapping['HostPort']}""")
f"""Image: {image}\nID: {container.id}\nURL: http://localhost:{mapping['HostPort']}"""
)