1
0

Merge pull request #207 from cerc-io/dboreham/run-cli-in-cluster

Run laconic registry cli in cluster

Former-commit-id: d80fb5dd16e08444d20b067370160d569baa5b09
This commit is contained in:
David Boreham 2023-03-07 10:10:26 -07:00 committed by GitHub
commit 2937a07cd8
6 changed files with 25 additions and 4 deletions

View File

@ -5,8 +5,9 @@ services:
image: cerc/laconicd:local
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
volumes:
# TODO: look at folding this script into the container
# TODO: look at folding these scripts into the container
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
- ../config/fixturenet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
# TODO: determine which of the ports below is really needed
ports:
- "6060"
@ -18,4 +19,7 @@ services:
- "9090"
- "9091"
- "1317"
cli:
image: cerc/laconic-registry-cli:local
volumes:
- ../config/fixturenet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml

View File

@ -0,0 +1,2 @@
#!/bin/sh
echo y | laconicd keys export mykey --unarmored-hex --unsafe

View File

@ -0,0 +1,7 @@
services:
cns:
restEndpoint: 'http://laconicd:1317'
gqlEndpoint: 'http://laconicd:9473/api'
userKey: REPLACE_WITH_MYKEY
bondId:
chainId: laconic_9000-1

View File

@ -51,4 +51,10 @@ RUN npm config set @lirewine:registry ${CERC_NPM_URL} \
# Globally install the cli package
RUN yarn global add @cerc-io/laconic-registry-cli
ENTRYPOINT ["laconic"]
# Add scripts
RUN mkdir /scripts
ENV PATH="${PATH}:/scripts"
COPY ./import-key.sh /scripts
# Default command sleeps forever so docker doesn't kill it
CMD ["sh", "-c", "while :; do sleep 600; done"]

View File

@ -0,0 +1,2 @@
#!/bin/sh
sed 's/REPLACE_WITH_MYKEY/'${1}'/' registry-cli-config-template.yml > config.yml

View File

@ -75,7 +75,7 @@ def command(ctx, include, exclude, cluster, command, extra_args):
print("Usage: exec <service> <cmd>")
sys.exit(1)
service_name = extra_args_list[0]
command_to_exec = extra_args_list[1:]
command_to_exec = ["sh", "-c"] + extra_args_list[1:]
container_exec_env = _make_runtime_env(ctx.obj)
if verbose:
print(f"Running compose exec {service_name} {command_to_exec}")