forked from cerc-io/stack-orchestrator
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a7622ffa9 | ||
|
|
d35bbbab98 | ||
|
|
407571e18d | ||
|
|
d39e2e959e |
@@ -6,7 +6,7 @@ Stack Orchestrator allows building and deployment of a Laconic Stack on a single
|
||||
|
||||
## Install
|
||||
|
||||
**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-ubuntu.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine.
|
||||
**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-linux.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine.
|
||||
|
||||
For any other installation, follow along below and **adapt these instructions based on the specifics of your system.**
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ services:
|
||||
- ../config/contract-sushiswap/deployment-params.env
|
||||
environment:
|
||||
# Overrides
|
||||
ETH_RPC_ENDPOINT: ${ETH_RPC_ENDPOINT}
|
||||
CHAIN_ID: ${CHAIN_ID}
|
||||
ACCOUNT_PRIVATE_KEY: ${ACCOUNT_PRIVATE_KEY}
|
||||
DEPLOY: ${DEPLOY}
|
||||
CERC_ETH_RPC_ENDPOINT: ${ETH_RPC_ENDPOINT}
|
||||
CERC_CHAIN_ID: ${CHAIN_ID}
|
||||
CERC_ACCOUNT_PRIVATE_KEY: ${ACCOUNT_PRIVATE_KEY}
|
||||
CERC_DEPLOY: ${DEPLOY}
|
||||
volumes:
|
||||
- ../config/network/wait-for-it.sh:/app/wait-for-it.sh
|
||||
- ../config/contract-sushiswap/deploy-core-contracts.sh:/app/deploy-core-contracts.sh
|
||||
@@ -31,10 +31,10 @@ services:
|
||||
- ../config/contract-sushiswap/deployment-params.env
|
||||
environment:
|
||||
# Overrides
|
||||
ETH_RPC_ENDPOINT: ${ETH_RPC_ENDPOINT}
|
||||
CHAIN_ID: ${CHAIN_ID}
|
||||
ACCOUNT_PRIVATE_KEY: ${ACCOUNT_PRIVATE_KEY}
|
||||
DEPLOY: ${DEPLOY}
|
||||
CERC_ETH_RPC_ENDPOINT: ${ETH_RPC_ENDPOINT}
|
||||
CERC_CHAIN_ID: ${CHAIN_ID}
|
||||
CERC_ACCOUNT_PRIVATE_KEY: ${ACCOUNT_PRIVATE_KEY}
|
||||
CERC_DEPLOY: ${DEPLOY}
|
||||
volumes:
|
||||
- ../config/network/wait-for-it.sh:/app/wait-for-it.sh
|
||||
- ../config/contract-sushiswap/deploy-periphery-contracts.sh:/app/deploy-periphery-contracts.sh
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
set -e
|
||||
|
||||
# Chain config
|
||||
ETH_RPC_ENDPOINT="${ETH_RPC_ENDPOINT:-${DEFAULT_ETH_RPC_ENDPOINT}}"
|
||||
CHAIN_ID="${CHAIN_ID:-${DEFAULT_CHAIN_ID}}"
|
||||
ACCOUNT_PRIVATE_KEY="${ACCOUNT_PRIVATE_KEY:-${DEFAULT_ACCOUNT_PRIVATE_KEY}}"
|
||||
export ETH_RPC_ENDPOINT="${CERC_ETH_RPC_ENDPOINT:-${CERC_DEFAULT_ETH_RPC_ENDPOINT}}"
|
||||
export CHAIN_ID="${CERC_CHAIN_ID:-${CERC_DEFAULT_CHAIN_ID}}"
|
||||
export ACCOUNT_PRIVATE_KEY="${CERC_ACCOUNT_PRIVATE_KEY:-${CERC_DEFAULT_ACCOUNT_PRIVATE_KEY}}"
|
||||
|
||||
# Option
|
||||
DEPLOY="${DEPLOY:-${DEFAULT_DEPLOY}}"
|
||||
DEPLOY="${CERC_DEPLOY:-${CERC_DEFAULT_DEPLOY}}"
|
||||
|
||||
# Create a .env file
|
||||
echo "ETH_RPC_ENDPOINT=$ETH_RPC_ENDPOINT" > .env
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
set -e
|
||||
|
||||
# Chain config
|
||||
ETH_RPC_ENDPOINT="${ETH_RPC_ENDPOINT:-${DEFAULT_ETH_RPC_ENDPOINT}}"
|
||||
CHAIN_ID="${CHAIN_ID:-${DEFAULT_CHAIN_ID}}"
|
||||
ACCOUNT_PRIVATE_KEY="${ACCOUNT_PRIVATE_KEY:-${DEFAULT_ACCOUNT_PRIVATE_KEY}}"
|
||||
ETH_RPC_ENDPOINT="${CERC_ETH_RPC_ENDPOINT:-${CERC_DEFAULT_ETH_RPC_ENDPOINT}}"
|
||||
CHAIN_ID="${CERC_CHAIN_ID:-${CERC_DEFAULT_CHAIN_ID}}"
|
||||
ACCOUNT_PRIVATE_KEY="${CERC_ACCOUNT_PRIVATE_KEY:-${CERC_DEFAULT_ACCOUNT_PRIVATE_KEY}}"
|
||||
|
||||
# Option
|
||||
DEPLOY="${DEPLOY:-${DEFAULT_DEPLOY}}"
|
||||
DEPLOY="${CERC_DEPLOY:-${CERC_DEFAULT_DEPLOY}}"
|
||||
|
||||
# Create a .env file
|
||||
echo "ETH_RPC_ENDPOINT=$ETH_RPC_ENDPOINT" > .env
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Chain config
|
||||
|
||||
DEFAULT_ETH_RPC_ENDPOINT="http://lotus-node-1:1234/rpc/v1"
|
||||
DEFAULT_CHAIN_ID=31415926
|
||||
CERC_DEFAULT_ETH_RPC_ENDPOINT="http://lotus-node-1:1234/rpc/v1"
|
||||
CERC_DEFAULT_CHAIN_ID=31415926
|
||||
|
||||
# From app/data/config/fixturenet-lotus/fund-account.sh
|
||||
DEFAULT_ACCOUNT_PRIVATE_KEY="0xc05fd3613bcd62a4f25e5eba1f464d0b76d74c3f771a7c2f13e26ad6439444b3"
|
||||
CERC_DEFAULT_ACCOUNT_PRIVATE_KEY="0xc05fd3613bcd62a4f25e5eba1f464d0b76d74c3f771a7c2f13e26ad6439444b3"
|
||||
|
||||
# Options
|
||||
|
||||
DEFAULT_DEPLOY=true
|
||||
CERC_DEFAULT_DEPLOY=true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
version: "1.0"
|
||||
name: azimuth
|
||||
repos:
|
||||
- github.com/cerc-io/azimuth-watcher-ts
|
||||
- github.com/cerc-io/azimuth-watcher-ts@v0.1.1
|
||||
containers:
|
||||
- cerc/watcher-azimuth
|
||||
pods:
|
||||
|
||||
@@ -38,6 +38,54 @@ laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f sushis
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Done
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
To check graph-node logs:
|
||||
```bash
|
||||
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f graph-node
|
||||
```
|
||||
|
||||
To deploy tokens run:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
```
|
||||
This can be run multiple times to deploy ERC20 tokens
|
||||
|
||||
Take note of the deployed token addresses to use later
|
||||
|
||||
Get contract address of factory deployed:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 jq -r '.address' /app/deployments/docker/UniswapV3Factory.json
|
||||
```
|
||||
Set it to environment variable `FACTORY_ADDRESS` to use later
|
||||
|
||||
To create a pool:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:create:docker --factory $FACTORY_ADDRESS --token0 $TOKEN1_ADDRESS --token1 $TOKEN2_ADDRESS --fee 500
|
||||
```
|
||||
|
||||
Set the created pool address to environment variable `POOL_ADDRESS` to use later
|
||||
|
||||
To initialize pool:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:initialize:docker --sqrt-price 4295128939 --pool $POOL_ADDRESS
|
||||
```
|
||||
|
||||
Set the recipient address to the contract deployer:
|
||||
```bash
|
||||
export RECIPIENT=0xD375B03bd3A2434A9f675bEC4Ccd68aC5e67C743
|
||||
```
|
||||
|
||||
Trigger pool mint event:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:mint:docker --pool $POOL_ADDRESS --recipient $RECIPIENT --amount 10
|
||||
```
|
||||
|
||||
Trigger pool burn event:
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:burn:docker --pool $POOL_ADDRESS --amount 10
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background run:
|
||||
|
||||
@@ -23,7 +23,7 @@ ssh root@IP
|
||||
2. Get the install script, give it executable permissions, and run it:
|
||||
|
||||
```
|
||||
curl -o install.sh https://raw.githubusercontent.com/cerc-io/stack-orchestrator/main/scripts/quick-install-ubuntu.sh
|
||||
curl -o install.sh https://raw.githubusercontent.com/cerc-io/stack-orchestrator/main/scripts/quick-install-linux.sh
|
||||
```
|
||||
```
|
||||
chmod +x install.sh
|
||||
|
||||
@@ -28,12 +28,43 @@ fi
|
||||
# Check python3 is available
|
||||
# Check machine resources are sufficient
|
||||
|
||||
# Determine if we are on Debian or Ubuntu
|
||||
linux_distro=$(lsb_release -a 2>/dev/null | grep "^Distributor ID:" | cut -f 2)
|
||||
# Some systems don't have lsb_release installed (e.g. ChromeOS) and so we try to
|
||||
# use /etc/os-release instead
|
||||
if [[ -z "$linux_distro" ]]; then
|
||||
if [[ -f "/etc/os-release" ]]; then
|
||||
distro_name_string=$(grep "^NAME=" /etc/os-release | cut -d '=' -f 2)
|
||||
if [[ $distro_name_string =~ Debian ]]; then
|
||||
linux_distro="Debian"
|
||||
elif [[ $distro_name_string =~ Ubuntu ]]; then
|
||||
linux_distro="Ubuntu"
|
||||
fi
|
||||
else
|
||||
echo "Failed to identify distro: /etc/os-release doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
case $linux_distro in
|
||||
Debian)
|
||||
echo "Installing docker for Debian"
|
||||
;;
|
||||
Ubuntu)
|
||||
echo "Installing docker for Ubuntu"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Detected unknown distribution $linux_distro, can't install docker"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dismiss the popups
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
## https://docs.docker.com/engine/install/ubuntu/
|
||||
## https://docs.docker.com/engine/install/debian/
|
||||
## https://superuser.com/questions/518859/ignore-packages-that-are-not-currently-installed-when-using-apt-get-remove1
|
||||
packages_to_remove="docker docker-engine docker.io containerd runc"
|
||||
packages_to_remove="docker docker-engine docker.io containerd runc docker-compose docker-doc podman-docker"
|
||||
installed_packages_to_remove=""
|
||||
for package_to_remove in $(echo $packages_to_remove); do
|
||||
$(dpkg --info $package_to_remove &> /dev/null)
|
||||
@@ -65,10 +96,25 @@ sudo apt -y install curl
|
||||
sudo apt -y install ca-certificates gnupg
|
||||
|
||||
# Add dockerco package repository
|
||||
sudo mkdir -m 0755 -p /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
# For reasons not obvious, the dockerco instructions for installation on
|
||||
# Debian and Ubuntu are slightly different here
|
||||
case $linux_distro in
|
||||
Debian)
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
;;
|
||||
Ubuntu)
|
||||
sudo mkdir -m 0755 -p /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Detected unknown distribution $linux_distro, can't install docker"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${linux_distro,,} \
|
||||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
Reference in New Issue
Block a user