From bc6e8004073507a0b1ccc7b741b34bbcd7a515a9 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Mon, 28 Oct 2024 17:42:03 +0530 Subject: [PATCH] Update shopify stack to run faucet together --- .../docker-compose-laconic-shopify.yml | 36 ++++++++++++++++--- .../laconic-shopify/product_pricings.json | 2 +- .../stacks/laconic-shopify/README.md | 33 ++++++++++++----- .../stacks/laconic-shopify/stack.yml | 3 ++ 4 files changed, 60 insertions(+), 14 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-laconic-shopify.yml b/stack-orchestrator/compose/docker-compose-laconic-shopify.yml index ea2fb05..4a18469 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-shopify.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-shopify.yml @@ -8,14 +8,42 @@ 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} + CERC_FAUCET_URL: ${CERC_FAUCET_URL:-'http://faucet:3000/'} CERC_ITEMS_PER_ORDER: ${CERC_ITEMS_PER_ORDER:-10} volumes: - shopify-data:/app/data - - ../config/shopify/start-shopify.sh:/app/start-faucet.sh - - ../config/shopify/product_pricings.json:/app/config/product_pricings.json + - ../config/laconic-shopify/start-shopify.sh:/app/start-faucet.sh + - ../config/laconic-shopify/product_pricings.json:/app/config/product_pricings.json + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + faucet: + condition: service_healthy + + faucet: + restart: unless-stopped + image: cerc/laconic-shopify-faucet:local + command: ["bash", "-c", "./start-faucet.sh"] + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_LACONICD_RPC_ENDPOINT: ${CERC_LACONICD_RPC_ENDPOINT:-http://laconicd:26657} + CERC_FAUCET_KEY: ${CERC_FAUCET_KEY} + CERC_LACONICD_CHAIN_ID: ${CERC_LACONICD_CHAIN_ID:-laconic_9000-1} + CERC_LACONICD_PREFIX: ${CERC_LACONICD_PREFIX:-laconic} + CERC_LACONICD_GAS_PRICE: ${CERC_LACONICD_GAS_PRICE:-1} + volumes: + - faucet-data:/app/db + - ../config/laconic-shopify-faucet/start-faucet.sh:/app/start-faucet.sh + - ../config/laconic-shopify-faucet/config-template.toml:/app/environments/config-template.toml + healthcheck: + test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"] + interval: 10s + timeout: 5s + retries: 10 + start_period: 5s extra_hosts: - "host.docker.internal:host-gateway" volumes: - shopify-data: \ No newline at end of file + shopify-data: + faucet-data: \ No newline at end of file diff --git a/stack-orchestrator/config/laconic-shopify/product_pricings.json b/stack-orchestrator/config/laconic-shopify/product_pricings.json index 91e1b5e..75c4073 100644 --- a/stack-orchestrator/config/laconic-shopify/product_pricings.json +++ b/stack-orchestrator/config/laconic-shopify/product_pricings.json @@ -1,5 +1,5 @@ { - "10 pre-paid webapp deployments": "100000", + "10 webapp deployments": "100000", "100 webapp deployments": "1000000", "500 webapp deployments": "5000000", "1000 webapp deployments": "10000000" diff --git a/stack-orchestrator/stacks/laconic-shopify/README.md b/stack-orchestrator/stacks/laconic-shopify/README.md index ef1c16b..54d3d74 100644 --- a/stack-orchestrator/stacks/laconic-shopify/README.md +++ b/stack-orchestrator/stacks/laconic-shopify/README.md @@ -22,7 +22,7 @@ Instructions for running the laconic shopify laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers ``` - This should create the `cerc/laconic-shopify` image locally + This should create the `cerc/laconic-shopify` and `cerc/laconic-shopify-faucet` images locally ## Create a deployment @@ -43,20 +43,35 @@ Instructions for running the laconic shopify * 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' + # Shopify GraphQL URL (default: 'https://6h071x-zw.myshopify.com/admin/api/2024-10/graphql.json') + CERC_SHOPIFY_GRAPHQL_URL= # Access token for Shopify API CERC_SHOPIFY_ACCESS_TOKEN= - # Delay for fetching orders in milliseconds - CERC_FETCH_ORDER_DELAY=10000 + # Delay for fetching orders in milliseconds (default: 10000) + CERC_FETCH_ORDER_DELAY= - # URL for the laconic faucet - CERC_FAUCET_URL='http://host.docker.internal:3000/' + # URL for the laconic faucet (default: 'http://faucet:3000/') + CERC_FAUCET_URL= - # Number of line items per order in Get Orders GraphQL query - CERC_ITEMS_PER_ORDER=10 + # Number of line items per order in Get Orders GraphQL query (default: 10) + CERC_ITEMS_PER_ORDER= + + # Private key of a funded faucet account + CERC_FAUCET_KEY= + + # laconicd RPC endpoint (default: http://laconicd:26657) + CERC_LACONICD_RPC_ENDPOINT= + + # laconicd chain id (default: laconic_9000-1) + CERC_LACONICD_CHAIN_ID= + + # laconicd address prefix (default: laconic) + CERC_LACONICD_PREFIX= + + # laconicd gas price (default: 1) + CERC_LACONICD_GAS_PRICE= ``` ## Start the deployment diff --git a/stack-orchestrator/stacks/laconic-shopify/stack.yml b/stack-orchestrator/stacks/laconic-shopify/stack.yml index 22131cf..0df9771 100644 --- a/stack-orchestrator/stacks/laconic-shopify/stack.yml +++ b/stack-orchestrator/stacks/laconic-shopify/stack.yml @@ -3,7 +3,10 @@ name: laconic-shopify description: "Service that integrates a Shopify app with the Laconic wallet." repos: - git.vdb.to/cerc-io/shopify + - git.vdb.to/cerc-io/laconic-faucet@shopify containers: - cerc/laconic-shopify + - cerc/laconic-shopify-faucet pods: - laconic-shopify + - laconic-shopify-faucet