Create a stack for shopify service (#34)

Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)
- Create a Shopify service that integrates Shopify ecommerce app with the Laconic wallet

Co-authored-by: Neeraj <neeraj.rtly@gmail.com>
Reviewed-on: cerc-io/testnet-laconicd-stack#34
This commit is contained in:
nabarunandNeeraj committed 2024-10-28 07:32:31 +00:00
1 parent d92a1febed
commit be08bdd7bc
7 files changed
+171

No files matched your search

@@ -0,0 +1,97 @@
# 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 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
# URL for the laconic faucet
CERC_FAUCET_URL='http://host.docker.internal:3000/'
# Number of line items per order in Get Orders GraphQL query
CERC_ITEMS_PER_ORDER=10
```
## 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 <CONTAINER_ID>
```
## 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
```
@@ -0,0 +1,9 @@
version: "1.0"
name: laconic-shopify
description: "Service that integrates a Shopify app with the Laconic wallet."
repos:
- git.vdb.to/cerc-io/laconic-shopify
containers:
- cerc/laconic-shopify
pods:
- laconic-shopify