Create a stack for shopify service #34
@ -0,0 +1,21 @@
|
||||
services:
|
||||
shopify:
|
||||
restart: unless-stopped
|
||||
image: cerc/laconic-shopify:local
|
||||
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: ${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-faucet.sh
|
||||
- ../config/laconic-shopify/product_pricings.json:/app/config/product_pricings.json
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
shopify-data:
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"10 pre-paid webapp deployments": "100000",
|
||||
"100 webapp deployments": "1000000",
|
||||
"500 webapp deployments": "5000000",
|
||||
"1000 webapp deployments": "10000000"
|
||||
}
|
21
stack-orchestrator/config/laconic-shopify/start-shopify.sh
Executable file
21
stack-orchestrator/config/laconic-shopify/start-shopify.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
echo "Shopify GraphQL URL: $CERC_SHOPIFY_GRAPHQL_URL"
|
||||
echo "Shopify access token: $CERC_SHOPIFY_ACCESS_TOKEN"
|
||||
echo "Fetch order delay: $CERC_FETCH_ORDER_DELAY"
|
||||
echo "Faucet URL: $CERC_FAUCET_URL"
|
||||
echo "Number of line items per order: $CERC_ITEMS_PER_ORDER"
|
||||
|
||||
export SHOPIFY_GRAPHQL_URL=$CERC_SHOPIFY_GRAPHQL_URL
|
||||
export SHOPIFY_ACCESS_TOKEN=$CERC_SHOPIFY_ACCESS_TOKEN
|
||||
export FETCH_ORDER_DELAY=$CERC_FETCH_ORDER_DELAY
|
||||
export FAUCET_URL=$CERC_FAUCET_URL
|
||||
export ITEMS_PER_ORDER=$CERC_ITEMS_PER_ORDER
|
||||
|
||||
yarn start
|
@ -0,0 +1,9 @@
|
||||
FROM node:20-bullseye
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN yarn install
|
||||
|
||||
CMD ["yarn", "start"]
|
8
stack-orchestrator/container-build/cerc-laconic-shopify/build.sh
Executable file
8
stack-orchestrator/container-build/cerc-laconic-shopify/build.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/laconic-faucet
|
||||
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}/laconic-shopify
|
97
stack-orchestrator/stacks/laconic-shopify/README.md
Normal file
97
stack-orchestrator/stacks/laconic-shopify/README.md
Normal file
@ -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
|
||||
```
|
9
stack-orchestrator/stacks/laconic-shopify/stack.yml
Normal file
9
stack-orchestrator/stacks/laconic-shopify/stack.yml
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user