testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify-faucet
nabarun d92a1febed Add stack for shopify faucet (#33)
Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #33
2024-10-28 07:21:59 +00:00
..
README.md Add stack for shopify faucet (#33) 2024-10-28 07:21:59 +00:00
stack.yml Add stack for shopify faucet (#33) 2024-10-28 07:21:59 +00:00

laconic-shopify-faucet

Instructions for running the laconic faucet

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
    
  • Clone the laconic-faucet respository:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify-faucet setup-repositories
    
  • Build the container image:

    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:

    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:

    network:
      ports:
        faucet:
          - '3000:3000'
    
  • Create a deployment from the spec file:

    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:

    # 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

laconic-so deployment --dir laconic-shopify-faucet-deployment start

Check status

  • To list down and monitor the running container:

    # With status
    docker ps
    
    # Check logs for a container
    docker logs -f <CONTAINER_ID>
    

Run

  • Request tokens from the faucet for an account:

    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:

    # Stop the docker container
    laconic-so deployment --dir laconic-shopify-faucet-deployment stop
    
  • To stop the service and also delete data:

    # 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