Compare commits

..

No commits in common. "f5af37b4b234e8ae20ed665d129d73f518dd8bb9" and "be08bdd7bc8483f82fe3672b71c84b2f66548a50" have entirely different histories.

13 changed files with 175 additions and 260 deletions

View File

@ -714,123 +714,6 @@
</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='https://laconicd-sapo.laconic.com'
# 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

@ -254,88 +254,3 @@ Instructions to reset / update the deployments
```
* The laconic console can now be viewed at <https://loro-console.laconic.com>
## Fixturenet Eth
* Stack: <https://git.vdb.to/cerc-io/fixturenet-eth-stacks>
* Target dir: `/srv/fixturenet-eth/fixturenet-eth-deployment`
* If code has changed, fetch and build with updated source code:
```bash
cd ~/cerc/fixturenet-eth-stacks
# Pull latest changes, or checkout to the required branch
git pull
# Confirm the latest commit hash
git log
# Rebuild the containers
cd /srv/fixturenet-eth
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild
```
* Update the configuration, if required in `fixturenet-eth-deployment/config.env`
```bash
CERC_ALLOW_UNPROTECTED_TXS=true
```
* Restart the deployment:
```bash
laconic-so deployment --dir fixturenet-eth-deployment stop
laconic-so deployment --dir fixturenet-eth-deployment start
```
## Nitro Bridge
* Stack: <https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/stack-orchestrator/stacks/bridge>
* Target dir: `/srv/bridge/bridge-deployment`
* Rebuild containers:
```bash
# Rebuild the containers
cd /srv/bridge
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers --force-rebuild
```
* Restart the bridge deployment
```bash
laconic-so deployment --dir bridge-deployment stop
laconic-so deployment --dir bridge-deployment start
```
## Laconic Shopify
* Stack: <https://git.vdb.to/cerc-io/shopify>
* Target dir: `/srv/shopify/laconic-shopify-deployment`
* If code has changed, fetch and build with updated source code:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories --pull --git-ssh --pull
# rebuild containers
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers --force-rebuild
```
* Restart the deployment
```bash
cd /srv/shopify
laconic-so deployment --dir laconic-shopify-deployment stop
laconic-so deployment --dir laconic-shopify-deployment start
```

View File

@ -0,0 +1,29 @@
services:
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
ports:
- 3000
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:
faucet-data:

View File

@ -2,48 +2,20 @@ services:
shopify:
restart: unless-stopped
image: cerc/laconic-shopify:local
depends_on:
faucet:
condition: service_healthy
command: ["bash", "-c", "./start-faucet.sh"]
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
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: http://faucet:3000/
CERC_FAUCET_URL: ${CERC_FAUCET_URL}
CERC_ITEMS_PER_ORDER: ${CERC_ITEMS_PER_ORDER:-10}
volumes:
- shopify-data:/app/data
- ../config/laconic-shopify/start-shopify.sh:/app/start-shopify.sh
- ../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"
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:-https://laconicd-sapo.laconic.com}
CERC_FAUCET_KEY: ${CERC_FAUCET_KEY}
CERC_LACONICD_CHAIN_ID: ${CERC_LACONICD_CHAIN_ID:-laconic-testnet-2}
CERC_LACONICD_PREFIX: ${CERC_LACONICD_PREFIX:-laconic}
CERC_LACONICD_GAS_PRICE: ${CERC_LACONICD_GAS_PRICE:-0.001}
volumes:
- faucet-data:/app/db
- ../config/laconic-shopify/start-faucet.sh:/app/start-faucet.sh
- ../config/laconic-shopify/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:
faucet-data:

View File

@ -1,5 +1,5 @@
{
"10 webapp deployments": "100000",
"10 pre-paid webapp deployments": "100000",
"100 webapp deployments": "1000000",
"500 webapp deployments": "5000000",
"1000 webapp deployments": "10000000"

View File

@ -5,4 +5,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
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}/shopify
docker build -t cerc/laconic-shopify:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-shopify

View File

@ -0,0 +1,121 @@
# laconic-shopify-faucet
Instructions for running the laconic faucet
## Setup
* Clone the stack repo:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
```
* Clone the laconic-faucet respository:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify-faucet setup-repositories
```
* Build the container image:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify-faucet 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-faucet deploy init --output laconic-shopify-faucet-spec.yml
```
* Edit `network` in the spec file to map container ports to host ports as required:
```bash
network:
ports:
faucet:
- '3000:3000'
```
* Create a deployment from the spec file:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify-faucet deploy create --spec-file laconic-shopify-faucet-spec.yml --deployment-dir laconic-shopify-faucet-deployment
```
## Configuration
* Inside the `laconic-shopify-faucet-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# Private key of a funded faucet account
CERC_FAUCET_KEY=
# Optional
# 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
```bash
laconic-so deployment --dir laconic-shopify-faucet-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 <CONTAINER_ID>
```
## Run
* Request tokens from the faucet for an account:
```bash
curl -X POST http://localhost:3000/faucet \
-H "Content-Type: application/json" \
-d '{"address": "<laconicd_address>"}'
# Expected output:
# {"success":true,"txHash":"<tx_hash>"}
```
## Clean up
* Stop the `laconic-shopify-faucet` service running in the background:
```bash
# Stop the docker container
laconic-so deployment --dir laconic-shopify-faucet-deployment stop
```
* To stop the service and also delete data:
```bash
# Stop the docker containers
laconic-so deployment --dir laconic-shopify-faucet-deployment stop --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r laconic-shopify-faucet-deployment
```

View File

@ -0,0 +1,9 @@
version: "1.0"
name: laconic-shopify-faucet
description: "Faucet for shopify app"
repos:
- git.vdb.to/cerc-io/laconic-faucet@shopify
containers:
- cerc/laconic-shopify-faucet
pods:
- laconic-shopify-faucet

View File

@ -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` and `cerc/laconic-shopify-faucet` images locally
This should create the `cerc/laconic-shopify-faucet` image locally
## Create a deployment
@ -43,32 +43,20 @@ 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 (default: 'https://6h071x-zw.myshopify.com/admin/api/2024-10/graphql.json')
CERC_SHOPIFY_GRAPHQL_URL=
# 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 (default: 10000)
CERC_FETCH_ORDER_DELAY=
# Delay for fetching orders in milliseconds
CERC_FETCH_ORDER_DELAY=10000
# Number of line items per order in Get Orders GraphQL query (default: 10)
CERC_ITEMS_PER_ORDER=
# URL for the laconic faucet
CERC_FAUCET_URL='http://host.docker.internal:3000/'
# Private key of a funded faucet account
CERC_FAUCET_KEY=
# laconicd RPC endpoint (default: https://laconicd-sapo.laconic.com/)
CERC_LACONICD_RPC_ENDPOINT=
# laconicd chain id (default: laconic-testnet-2)
CERC_LACONICD_CHAIN_ID=
# laconicd address prefix (default: laconic)
CERC_LACONICD_PREFIX=
# laconicd gas price (default: 0.001)
CERC_LACONICD_GAS_PRICE=
# Number of line items per order in Get Orders GraphQL query
CERC_ITEMS_PER_ORDER=10
```
## Start the deployment

View File

@ -2,10 +2,8 @@ version: "1.0"
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
- git.vdb.to/cerc-io/laconic-shopify
containers:
- cerc/laconic-shopify
- cerc/laconic-shopify-faucet
pods:
- laconic-shopify