From 7ac1f1178d560eded8bd75a5f673a18c510d7e5a Mon Sep 17 00:00:00 2001 From: Neeraj Date: Tue, 29 Oct 2024 10:47:31 +0530 Subject: [PATCH] Update deployment from scratch document about shopify stack --- ops/deployments-from-scratch.md | 117 ++++++++++++++++++ .../docker-compose-laconic-shopify.yml | 4 +- .../stacks/laconic-shopify/README.md | 3 - 3 files changed, 119 insertions(+), 5 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 2833ba9..de39327 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -714,6 +714,123 @@ +
+ Shopify + +## Shopify + +* Stack: + +* Source repo: + +* Target dir: `/srv/shopify/laconic-shopify-deployment` + +* Cleanup an existing deployment if required: + + ```bash + cd /srv/shopify + + # Stop the deployment + laconic-so deployment --dir laconic-shopify-deployment stop + + # Remove the deployment dir + sudo rm -rf laconic-shopify-deployment + + # Remove the existing spec file + rm laconic-shopify-spec.yml + ``` + +### Setup + +* Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull + + # This should clone the testnet-laconicd-stack repo at `/home/dev/cerc/testnet-laconicd-stack` + ``` + +* Clone required repositories: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories --pull + + # This should clone the laconicd repos at `/home/dev/cerc/shopify` and `/home/dev/cerc/laconic-faucet` + ``` + +* Build the container images: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers --force-rebuild + + # This should create the "cerc/laconic-shopify" and "cerc/laconic-shopify-faucet" Docker images + ``` + +### Deployment + +* Create a spec file for the deployment: + + ```bash + cd /srv/shopify + + 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 + ``` + +* Inside the `laconic-shopify-deployment` deployment directory, open `config.env` file and set following env variables: + + ```bash + # Shopify GraphQL URL + CERC_SHOPIFY_GRAPHQL_URL='https://6h071x-zw.myshopify.com/admin/api/2024-10/graphql.json' + + # Access token for Shopify API + CERC_SHOPIFY_ACCESS_TOKEN= + + # Delay for fetching orders in milliseconds + CERC_FETCH_ORDER_DELAY=10000 + + # Number of line items per order in Get Orders GraphQL query + CERC_ITEMS_PER_ORDER=10 + + # Private key of a funded faucet account + CERC_FAUCET_KEY= + + # laconicd RPC endpoint + CERC_LACONICD_RPC_ENDPOINT='http://laconicd:26657' + + # laconicd chain id + CERC_LACONICD_CHAIN_ID=laconic-testnet-2 + + # laconicd address prefix + CERC_LACONICD_PREFIX=laconic + + # laconicd gas price + CERC_LACONICD_GAS_PRICE=0.001 + ``` + +### Start + +* Start the deployment: + + ```bash + laconic-so deployment --dir laconic-shopify-deployment start + ``` + +* Check status: + + ```bash + # Check logs for faucet and shopify containers + laconic-so deployment --dir laconic-shopify-deployment logs shopify -f + laconic-so deployment --dir laconic-shopify-deployment logs faucet -f + ``` + +
+
testnet-onboarding-app diff --git a/stack-orchestrator/compose/docker-compose-laconic-shopify.yml b/stack-orchestrator/compose/docker-compose-laconic-shopify.yml index 8b0a45a..9df68cf 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-shopify.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-shopify.yml @@ -8,11 +8,11 @@ services: CERC_SHOPIFY_GRAPHQL_URL: ${CERC_SHOPIFY_GRAPHQL_URL} CERC_SHOPIFY_ACCESS_TOKEN: ${CERC_SHOPIFY_ACCESS_TOKEN} CERC_FETCH_ORDER_DELAY: ${CERC_FETCH_ORDER_DELAY:-10000} - CERC_FAUCET_URL: ${CERC_FAUCET_URL:-'http://faucet:3000/'} + CERC_FAUCET_URL: http://faucet:3000/ CERC_ITEMS_PER_ORDER: ${CERC_ITEMS_PER_ORDER:-10} volumes: - shopify-data:/app/data - - ../config/laconic-shopify/start-shopify.sh:/app/start-faucet.sh + - ../config/laconic-shopify/start-shopify.sh:/app/start-shopify.sh - ../config/laconic-shopify/product_pricings.json:/app/config/product_pricings.json extra_hosts: - "host.docker.internal:host-gateway" diff --git a/stack-orchestrator/stacks/laconic-shopify/README.md b/stack-orchestrator/stacks/laconic-shopify/README.md index 54d3d74..93ff1a6 100644 --- a/stack-orchestrator/stacks/laconic-shopify/README.md +++ b/stack-orchestrator/stacks/laconic-shopify/README.md @@ -52,9 +52,6 @@ Instructions for running the laconic shopify # Delay for fetching orders in milliseconds (default: 10000) CERC_FETCH_ORDER_DELAY= - # URL for the laconic faucet (default: 'http://faucet:3000/') - CERC_FAUCET_URL= - # Number of line items per order in Get Orders GraphQL query (default: 10) CERC_ITEMS_PER_ORDER=