diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index 1fe36f1..ec97b53 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -1,19 +1,22 @@ services: cli: image: cerc/laconic2-registry-cli:local + command: ["bash", "-c", "/app/create-config.sh && tail -f /dev/null"] environment: - CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_LACONICD_RPC_ENDPOINT: ${CERC_LACONICD_RPC_ENDPOINT:-http://laconicd:26657} CERC_LACONICD_GQL_ENDPOINT: ${CERC_LACONICD_GQL_ENDPOINT:-http://laconicd:9473/api} - CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1} - CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} + CERC_LACONICD_CHAIN_ID: ${CERC_LACONICD_CHAIN_ID:-laconic_9000-1} + CERC_LACONICD_USER_KEY: ${CERC_LACONICD_USER_KEY} + CERC_LACONICD_BOND_ID: ${CERC_LACONICD_BOND_ID} + CERC_LACONICD_GAS: ${CERC_LACONICD_GAS:-200000} + CERC_LACONICD_FEES: ${CERC_LACONICD_FEES:-200000photon} volumes: - - ../config/laconic-console/create-config.sh:/app/create-config.sh + - ../config/laconic-console/cli/create-config.sh:/app/create-config.sh - laconic-registry-data:/laconic-registry-data extra_hosts: - "host.docker.internal:host-gateway" - laconic-console: + console: restart: unless-stopped image: cerc/laconic2-console-host:local environment: diff --git a/stack-orchestrator/config/laconic-console/cli/create-config.sh b/stack-orchestrator/config/laconic-console/cli/create-config.sh index c80be8a..a57ef0d 100755 --- a/stack-orchestrator/config/laconic-console/cli/create-config.sh +++ b/stack-orchestrator/config/laconic-console/cli/create-config.sh @@ -13,9 +13,11 @@ services: registry: rpcEndpoint: ${CERC_LACONICD_RPC_ENDPOINT} gqlEndpoint: ${CERC_LACONICD_GQL_ENDPOINT} - userKey: ${CERC_USER_KEY} - bondId: ${CERC_BOND_ID} - chainId: ${CERC_CHAIN_ID} - gas: 200000 - fees: 200000photon + userKey: ${CERC_LACONICD_USER_KEY} + bondId: ${CERC_LACONICD_BOND_ID} + chainId: ${CERC_LACONICD_CHAIN_ID} + gas: ${CERC_LACONICD_GAS} + fees: ${CERC_LACONICD_FEES} EOF + +echo "Exported config to $config_file" diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile index 2449066..e3ad75d 100644 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -16,4 +16,5 @@ RUN echo "Installing dependencies and building laconic-registry-cli" && \ RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ RUN yarn global add file:$PWD -CMD ["bash", "-c", "tail -f /dev/null"] +# Default command sleeps forever so docker doesn't kill it +CMD ["bash", "-c", "while :; do sleep 600; done"] diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 8219312..12db5ec 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -61,16 +61,79 @@ Instructions for running laconic registry CLI and console ```bash # All optional - CERC_LACONICD_RPC_ENDPOINT= - CERC_LACONICD_GQL_ENDPOINT= - CERC_CHAIN_ID= - CERC_LOGLEVEL= + # CLI configuration + # laconicd RPC endpoint (default: http://laconicd:26657) + CERC_LACONICD_RPC_ENDPOINT= + + # laconicd GQL endpoint (default: http://laconicd:9473/api) + CERC_LACONICD_GQL_ENDPOINT= + + # laconicd chain id (default: laconic_9000-1) + CERC_LACONICD_CHAIN_ID= + + # laconicd user private key for txs + CERC_LACONICD_USER_KEY= + + # laconicd bond id for txs + CERC_LACONICD_BOND_ID= + + # Gas limit for txs (default: 200000) + CERC_LACONICD_GAS= + + # Max fees for txs (default: 200000photon) + CERC_LACONICD_FEES= + + # Console configuration + + # Laconicd (hosted) GQL endpoint (default: http://localhost:9473) LACONIC_HOSTED_ENDPOINT= ``` -## Start the deployment +## Run -```bash -laconic-so deployment --dir laconic-console-deployment start -``` +* Start the deployment: + + ```bash + laconic-so deployment --dir laconic-console-deployment start + ``` + +* View the laconic console at + +* Use the `cli` service for registry CLI operations: + + ```bash + # Example + laconic-so --dir laconic-console-deployment deploy exec cli "laconic registry status" + ``` + +## Check status + +* To list down and monitor the running containers: + + ```bash + # With status + docker ps -a + + # Follow logs for console container + laconic-so deployment --dir laconic-console-deployment logs console -f + ``` + +## Clean up + +* Stop all services running in the background: + + ```bash + # Stop the docker containers + laconic-so deployment --dir laconic-console-deployment stop + ``` + +* To stop all services and also delete data: + + ```bash + # Stop the docker containers + laconic-so deployment --dir laconic-console-deployment stop --delete-volumes + + # Remove deployment directory (deployment will have to be recreated for a re-run) + rm -r laconic-console-deployment + ```