Update deployment from scratch document about shopify stack

This commit is contained in:
Neeraj 2024-10-29 10:47:31 +05:30
parent c9658fe34e
commit 7ac1f1178d
3 changed files with 119 additions and 5 deletions

View File

@ -714,6 +714,123 @@
</details>
<details open>
<summary>Shopify</summary>
## Shopify
* Stack: <https://git.vdb.to/cerc-io/testnet-laconicd-stack/src/branch/main/stack-orchestrator/stacks/laconic-shopify>
* Source repo: <https://git.vdb.to/cerc-io/shopify>
* 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
```
</details>
<details open>
<summary>testnet-onboarding-app</summary>

View File

@ -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"

View File

@ -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=