From b1d8dfa04182165f23f4038027004ad910777235 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Fri, 25 Oct 2024 15:02:20 +0530 Subject: [PATCH] Update README for shopify stack --- .../cerc-laconic-shopify/build.sh | 5 +- .../stacks/laconic-shopify/README.md | 93 +++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-laconic-shopify/build.sh b/stack-orchestrator/container-build/cerc-laconic-shopify/build.sh index c383f4b..a7156f7 100755 --- a/stack-orchestrator/container-build/cerc-laconic-shopify/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic-shopify/build.sh @@ -2,4 +2,7 @@ # Build cerc/laconic-faucet source ${CERC_CONTAINER_BASE_DIR}/build-base.sh -docker build -t cerc/laconic-shopify:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic-shopify + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build -t cerc/laconic-shopify:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-shopify diff --git a/stack-orchestrator/stacks/laconic-shopify/README.md b/stack-orchestrator/stacks/laconic-shopify/README.md index 7727887..6bf8554 100644 --- a/stack-orchestrator/stacks/laconic-shopify/README.md +++ b/stack-orchestrator/stacks/laconic-shopify/README.md @@ -1 +1,94 @@ # laconic-shopify + +Instructions for running the laconic shopify + +## Setup + +* Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack + ``` + +* Clone the laconic-shopify respository: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories + ``` + +* Build the container image: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers + ``` + + This should create the `cerc/laconic-shopify-faucet` image locally + +## Create a deployment + +* Create a spec file for the deployment: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify deploy init --output laconic-shopify-spec.yml + ``` + +* Create a deployment from the spec file: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify deploy create --spec-file laconic-shopify-spec.yml --deployment-dir laconic-shopify-deployment + ``` + +## Configuration + +* Inside the `laconic-shopify-deployment` deployment directory, open `config.env` file and set following env variables: + + ```bash + # Shopify shop name + CERC_SHOPIFY_SHOP_NAME= + + # Access token for Shopify API + CERC_SHOPIFY_ACCESS_TOKEN= + + # Delay for fetching orders in milliseconds + CERC_FETCH_ORDER_DELAY=10000 + + # URL for the laconic faucet + CERC_FAUCET_URL='http://host.docker.internal:3000/' + ``` + +## Start the deployment + + ```bash + laconic-so deployment --dir laconic-shopify-deployment start + ``` + +## Check status + +* To list down and monitor the running container: + + ```bash + # With status + docker ps + + # Check logs for a container + docker logs -f + ``` + +## Clean up + +* Stop the `laconic-shopify-faucet` service running in the background: + + ```bash + # Stop the docker container + laconic-so deployment --dir laconic-shopify-deployment stop + ``` + +* To stop the service and also delete data: + + ```bash + # Stop the docker containers + laconic-so deployment --dir laconic-shopify-deployment stop --delete-volumes + + # Remove deployment directory (deployment will have to be recreated for a re-run) + rm -r laconic-shopify-deployment + ```