From 8ee7040298528bb14c77daea6a2c3e66da40249e Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 10:52:38 +0530 Subject: [PATCH] Update docker build and compose file for console --- .../docker-compose-laconic-console.yml | 10 ++++--- .../cerc-laconic-console-host/Dockerfile | 4 +++ .../cerc-laconic-console-host/build.sh | 5 ++-- .../stacks/laconic-console/README.md | 26 +++++++++++++++++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index 6dcebb9..1fe36f1 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -2,6 +2,7 @@ services: cli: image: cerc/laconic2-registry-cli:local 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} @@ -14,12 +15,13 @@ services: laconic-console: restart: unless-stopped - image: cerc/laconic-console-host:local + image: cerc/laconic2-console-host:local environment: - - CERC_WEBAPP_FILES_DIR=${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production} - - LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost:9473} + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_WEBAPP_FILES_DIR: ${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production} + LACONIC_HOSTED_ENDPOINT: ${LACONIC_HOSTED_ENDPOINT:-http://localhost:9473} volumes: - - ../config/laconic-console/console/config.yml:/config.yml + - ../config/laconic-console/console/config.yml:/config/config.yml ports: - "80" diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile index 2a7f015..c7be4b9 100644 --- a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile @@ -2,6 +2,9 @@ FROM cerc/webapp-base:local # Configure the cerc-io npm registry RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ +RUN npm config set @lirewine:registry https://git.vdb.to/api/packages/cerc-io/npm/ + +WORKDIR /app COPY . . @@ -9,4 +12,5 @@ RUN echo "Installing dependencies" && yarn RUN LACONIC_HOSTED_CONFIG_FILE=config-hosted.yml yarn dist RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ + RUN yarn global add file:$PWD diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh index ee349e1..ef43944 100755 --- a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -# Build cerc/laconic-registry-cli + +# Build cerc/laconic2-console-host source ${CERC_CONTAINER_BASE_DIR}/build-base.sh # See: https://stackoverflow.com/a/246128/1701505 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build -t cerc/laconic-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-console +docker build -t cerc/laconic2-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-console diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 0e42463..8219312 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -35,7 +35,17 @@ Instructions for running laconic registry CLI and console * Create a spec file for the deployment: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + laconic-so --stack /home/prathamesh/deepstack/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + ``` + +* Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + ... + network: + ports: + laconic-console: + - '8080:80' ``` * Create a deployment from the spec file: @@ -49,6 +59,18 @@ Instructions for running laconic registry CLI and console * Inside the deployment directory, open `config.env` file and set following env variables: ```bash - # TODO + # All optional + + CERC_LACONICD_RPC_ENDPOINT= + CERC_LACONICD_GQL_ENDPOINT= + CERC_CHAIN_ID= + CERC_LOGLEVEL= + + LACONIC_HOSTED_ENDPOINT= ``` +## Start the deployment + +```bash +laconic-so deployment --dir laconic-console-deployment start +```