A publicly accessible Lilypad network.
- A blockchain node
- A solver service
- A job creator service
As is, the network cannot execute jobs, it needs resource providers to connect to the network and these in turn will be the ones running the jobs. Follow these instructions to run a node in the Lilypad network.
The three components have been isolated into docker containers and these components expose their services to the public via Cloudflare tunnels from inside the containers. This means there is no need to configure networking at the cloud service provider, just deploy the components using the appropriate build and run arguments to expose the services to the configured subdomains.
The deployment processes for each component have the same three steps:
- Build the docker image
- Push the image to the container registry
- Pull the image from the registry and execute the image in a container
There is a GitHub workflow to deploy the blockchain node, but it does not execute on code changes as there is no need to constantly deploy the blockchain node. There is ongoing work to implement a GitHub workflow that will compile and deploy the smart contracts.
If, for whatever reason, the blockchain node needs to be reset, this can be done in the following manner:
sshinto the instance/pod running the blockchain node- Connect into the
chaincontainer's shell (docker exec -it chain /bin/bash) - In the container shell execute the reset script (
./reset). This will stop the node, clear the blockchain data, restart the node and fund the admin account. - Execute
./stack chain-bootto compile, deploy and fund the smart contracts, token and accounts respectively. Change the configuration in the Hardhat scripts (/hardhat.config.tsand/scripts/print-contract-env.ts) to make sure the URLs point to the node's exposed subdomains (at the time of this write-up8545->https://devnet-chain-http.lilypad.techand8546->wss://devnet-chain-ws.lilypad.tech).
Checkout the Lilypad faucet repository.
When code changes reach the main branch, a GitHub workflow will trigger the flow that will first deploy and run the solver and then deploy and run the job creator. (reminder) The solver has to be up and running (and have registered its public URL to the blockchain) before the job-creator starts (the job creator will fail if it can't find the solver's websocket server).
These steps have been used for AWS so maybe some changes have to be put in place for other providers but the overall flow should be similar.
The VM should have a running Docker daemon and should be able to pull an image from the chosen container registry. These instructions assume an Ubuntu image.
Create a virtual machine to execute the component. When creating the VM, attach an instance profile that gives it access to pull from an ECR registry. In our ops setup, we have a role named LilypadService that has the necessary permissions.
Update the VM and install the AWS CLI:
sudo apt update && sudo apt upgrade
sudo snap install aws-cli --classicInstall Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.shAdd your user to the docker group if you want to run without sudo:
sudo usermod -aG docker ubuntu
newgrp dockerThe ubuntu user assumes the default user on Ubuntu images. The newgrrp command adds your user to the group without logging out and back in.
Check that Docker is running:
docker run hello-worldMake sure the repo has been created.
Make sure the Cloudflare tunnel has been created and linked to the desired subdomain, and pass the token to the container in the build step.