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