Deployments feature #433
@ -7,9 +7,9 @@ services:
|
||||
# The cosmos-sdk node's database directory:
|
||||
- laconicd-data:/root/.laconicd/data
|
||||
# TODO: look at folding these scripts into the container
|
||||
- ./config/mainnet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
- ./config/mainnet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
|
||||
- ./config/mainnet-laconicd/export-myaddress.sh:/docker-entrypoint-scripts.d/export-myaddress.sh
|
||||
- ../config/mainnet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
- ../config/mainnet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
|
||||
- ../config/mainnet-laconicd/export-myaddress.sh:/docker-entrypoint-scripts.d/export-myaddress.sh
|
||||
# TODO: determine which of the ports below is really needed
|
||||
ports:
|
||||
- "6060"
|
||||
@ -24,7 +24,7 @@ services:
|
||||
cli:
|
||||
image: cerc/laconic-registry-cli:local
|
||||
volumes:
|
||||
- ./config/mainnet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml
|
||||
- ../config/mainnet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml
|
||||
|
||||
volumes:
|
||||
laconicd-data:
|
||||
|
@ -245,7 +245,7 @@ def _make_cluster_context(ctx, stack, include, exclude, cluster, env_file):
|
||||
# If the caller passed a path for the stack file, then we know that we can get the compose files
|
||||
# from the same directory
|
||||
if isinstance(stack, os.PathLike):
|
||||
compose_dir = stack.parent
|
||||
compose_dir = stack.parent.joinpath("compose")
|
||||
else:
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose")
|
||||
|
@ -44,14 +44,17 @@ def command(ctx, dir):
|
||||
ctx.obj = DeploymentContext(dir_path)
|
||||
|
||||
|
||||
def make_deploy_context(ctx):
|
||||
# Get the stack config file name
|
||||
stack_file_path = ctx.obj.dir.joinpath("stack.yml")
|
||||
# TODO: add cluster name and env file here
|
||||
return create_deploy_context(ctx.parent.parent.obj, stack_file_path, None, None, None, None)
|
||||
|
||||
@command.command()
|
||||
@click.argument('extra_args', nargs=-1) # help: command: up <service1> <service2>
|
||||
@click.pass_context
|
||||
def up(ctx, extra_args):
|
||||
# Get the stack config file name
|
||||
stack_file_path = ctx.obj.dir.joinpath("stack.yml")
|
||||
# TODO: add cluster name and env file here
|
||||
ctx.obj = create_deploy_context(ctx.parent.parent.obj, stack_file_path, None, None, None, None)
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
services_list = list(extra_args) or None
|
||||
up_operation(ctx, services_list)
|
||||
|
||||
@ -63,19 +66,21 @@ def down(ctx, extra_args):
|
||||
# Get the stack config file name
|
||||
stack_file_path = ctx.obj.dir.joinpath("stack.yml")
|
||||
# TODO: add cluster name and env file here
|
||||
ctx.obj = create_deploy_context(ctx.parent.parent.obj, stack_file_path, None, None, None, None)
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
down_operation(ctx, extra_args, None)
|
||||
|
||||
|
||||
@command.command()
|
||||
@click.pass_context
|
||||
def ps(ctx):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
ps_operation(ctx)
|
||||
|
||||
|
||||
@command.command()
|
||||
@click.pass_context
|
||||
def logs(ctx):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
print(f"Context: {ctx.parent.obj}")
|
||||
|
||||
|
||||
@ -90,6 +95,7 @@ def port(ctx, extra_args):
|
||||
@click.argument('extra_args', nargs=-1) # help: command: exec <service> <command>
|
||||
@click.pass_context
|
||||
def exec(ctx, extra_args):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
exec_operation(ctx, extra_args)
|
||||
|
||||
|
||||
@ -97,6 +103,7 @@ def exec(ctx, extra_args):
|
||||
@click.argument('extra_args', nargs=-1) # help: command: logs <service1> <service2>
|
||||
@click.pass_context
|
||||
def logs(ctx, extra_args):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
logs_operation(ctx, extra_args)
|
||||
|
||||
|
||||
|
@ -63,10 +63,12 @@ def create(ctx, spec_file, deployment_dir):
|
||||
# TODO: refactor to use common code with deploy command
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
data_dir = Path(__file__).absolute().parent.joinpath("data")
|
||||
compose_dir = data_dir.joinpath("compose")
|
||||
source_compose_dir = data_dir.joinpath("compose")
|
||||
destination_compose_dir = os.path.join(deployment_dir, "compose")
|
||||
os.mkdir(destination_compose_dir)
|
||||
for pod in pods:
|
||||
pod_file_path = os.path.join(compose_dir, f"docker-compose-{pod}.yml")
|
||||
copyfile(pod_file_path, os.path.join(deployment_dir, os.path.basename(pod_file_path)))
|
||||
pod_file_path = os.path.join(source_compose_dir, f"docker-compose-{pod}.yml")
|
||||
copyfile(pod_file_path, os.path.join(destination_compose_dir, os.path.basename(pod_file_path)))
|
||||
# Copy the config files for the pod, if any
|
||||
source_config_dir = data_dir.joinpath("config", pod)
|
||||
if os.path.exists(source_config_dir):
|
||||
|
Loading…
Reference in New Issue
Block a user