Skip to content

Commit fb9da4d

Browse files
authored
Merge branch 'main' into errors
2 parents 4854982 + 2904cb8 commit fb9da4d

File tree

2 files changed

+250
-8
lines changed

2 files changed

+250
-8
lines changed

.github/workflows/flux.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
id-token: write
1011

1112
jobs:
1213
build-and-push-docker-image:
@@ -19,12 +20,14 @@ jobs:
1920
- name: Checkout code
2021
uses: actions/checkout@v2
2122

22-
- name: Configure AWS Credentials
23+
- name: Configure AWS Credentials via OIDC
2324
uses: aws-actions/configure-aws-credentials@v1
2425
with:
25-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
26-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27-
aws-region: us-east-1
26+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME || '' }}
27+
aws-region: ${{ secrets.AWS_REGION || 'us-east-1' }}
28+
role-session-name: GHActions-${{ github.run_id }}
29+
role-duration-seconds: 1200
30+
mask-aws-account-id: false
2831

2932
- name: Login to ECR
3033
id: login-ecr

pages/devs/validators/run-full-node.mdx

Lines changed: 243 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,260 @@ import { Callout } from 'nextra/components'
44

55
> How to become a Validator on Allora
66
7-
This guide provides instructions on how to run a full node for the Allora network. There are two primary methods for running an Allora node: using `docker compose` (preferred) or using a [script](https://github.com/allora-network/allora-chain/blob/main/scripts/l1_node.sh). It's important to choose the method that best suits your environment and needs.
7+
This guide provides instructions on how to run a full node for the Allora network. There are two primary methods for running an Allora node: using systemd with cosmosvisor for easier upgrade management (recommended) or using docker compose. It's important to choose the method that best suits your environment and needs.
88

99
***
1010

1111
## Prerequisites
1212

1313
- Git
14-
- Docker with `docker compose`
14+
- Go (version 1.21 or later)
1515
- Basic command-line knowledge
16+
- Linux/Unix environment with systemd
17+
- curl and jq utilities
1618

1719
***
1820

19-
## Method 1: Using `docker compose` (Recommended)
21+
## Method 1: Using systemd with cosmosvisor (Recommended)
2022

21-
Running the Allora node with `docker compose` simplifies the setup and ensures consistency across different environments.
23+
Running the Allora node with systemd and cosmosvisor provides production-grade reliability and easier binary upgrade management. This is the recommended approach for validators and production environments.
24+
25+
### Step 1: Install cosmosvisor
26+
27+
First, install cosmosvisor, which will manage binary upgrades:
28+
29+
```shell
30+
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
31+
```
32+
33+
Verify the installation:
34+
35+
```shell
36+
cosmovisor version
37+
```
38+
39+
### Step 2: Install allorad Binary
40+
41+
Download the latest `allorad` binary from the releases page:
42+
43+
1. Navigate to the [Allora Chain Releases page](https://github.com/allora-network/allora-chain/releases/latest).
44+
2. Download the `allorad` binary appropriate for your operating system (e.g., `allorad-linux-amd64`, `allorad-darwin-amd64`).
45+
3. Rename and move the binary to a standard location:
46+
47+
```shell
48+
# Rename the downloaded binary
49+
mv ./allorad-linux-amd64 ./allorad # Adjust filename as needed
50+
51+
# Move to system path
52+
sudo mv ./allorad /usr/local/bin/allorad
53+
54+
# Make executable
55+
sudo chmod +x /usr/local/bin/allorad
56+
```
57+
58+
### Step 3: Initialize the Node
59+
60+
Initialize your node (replace `<your-moniker>` with your desired node name):
61+
62+
```shell
63+
allorad init <your-moniker> --chain-id allora-testnet-1
64+
```
65+
66+
### Step 4: Download Network Configuration
67+
68+
Download the testnet configuration files:
69+
70+
```shell
71+
# Download genesis.json
72+
curl -s https://raw.githubusercontent.com/allora-network/networks/main/allora-testnet-1/genesis.json > $HOME/.allorad/config/genesis.json
73+
74+
# Download config.toml
75+
curl -s https://raw.githubusercontent.com/allora-network/networks/main/allora-testnet-1/config.toml > $HOME/.allorad/config/config.toml
76+
77+
# Download app.toml
78+
curl -s https://raw.githubusercontent.com/allora-network/networks/main/allora-testnet-1/app.toml > $HOME/.allorad/config/app.toml
79+
```
80+
81+
### Step 5: Configure Seeds and Peers
82+
83+
Configure seeds and persistent peers for network connectivity:
84+
85+
```shell
86+
# Fetch and set seeds
87+
SEEDS=$(curl -s https://raw.githubusercontent.com/allora-network/networks/main/allora-testnet-1/seeds.txt)
88+
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $HOME/.allorad/config/config.toml
89+
90+
# Optionally set persistent peers
91+
PEERS=$(curl -s https://raw.githubusercontent.com/allora-network/networks/main/allora-testnet-1/peers.txt)
92+
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.allorad/config/config.toml
93+
```
94+
95+
### Step 6: Configure cosmosvisor
96+
97+
Set up the cosmosvisor directory structure and environment:
98+
99+
```shell
100+
# Set environment variables
101+
export DAEMON_NAME=allorad
102+
export DAEMON_HOME=$HOME/.allorad
103+
export DAEMON_RESTART_AFTER_UPGRADE=true
104+
105+
# Create cosmosvisor directories
106+
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
107+
mkdir -p $DAEMON_HOME/cosmovisor/upgrades
108+
109+
# Copy the current binary to genesis
110+
cp /usr/local/bin/allorad $DAEMON_HOME/cosmovisor/genesis/bin/
111+
```
112+
113+
### Step 7: Configure State Sync (Optional but Recommended)
114+
115+
State sync allows your node to quickly catch up with the network. Create and run this state sync script:
116+
117+
```shell
118+
cat > state_sync.sh << 'EOF'
119+
#!/bin/bash
120+
121+
set -e
122+
123+
# Choose your preferred RPC endpoint
124+
SNAP_RPC="https://allora-rpc.testnet.allora.network"
125+
CONFIG_TOML_PATH="$HOME/.allorad/config/config.toml"
126+
127+
echo "Using RPC Endpoint: $SNAP_RPC"
128+
echo "Fetching latest block height..."
129+
130+
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
131+
if [ -z "$LATEST_HEIGHT" ] || [ "$LATEST_HEIGHT" == "null" ]; then
132+
echo "Error: Could not fetch latest height"
133+
exit 1
134+
fi
135+
136+
BLOCK_HEIGHT_OFFSET=2000
137+
BLOCK_HEIGHT=$((LATEST_HEIGHT - BLOCK_HEIGHT_OFFSET))
138+
139+
echo "Fetching trust hash for block $BLOCK_HEIGHT..."
140+
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
141+
if [ -z "$TRUST_HASH" ] || [ "$TRUST_HASH" == "null" ]; then
142+
echo "Error: Could not fetch trust hash"
143+
exit 1
144+
fi
145+
146+
echo "Updating config for state sync..."
147+
RPC_SERVERS="$SNAP_RPC,$SNAP_RPC"
148+
149+
sed -i.bak -E \
150+
-e "s|^(enable[[:space:]]*=[[:space:]]*).*$|\\1true|" \
151+
-e "s|^(rpc_servers[[:space:]]*=[[:space:]]*).*$|\\1\"$RPC_SERVERS\"|" \
152+
-e "s|^(trust_height[[:space:]]*=[[:space:]]*).*$|\\1$BLOCK_HEIGHT|" \
153+
-e "s|^(trust_hash[[:space:]]*=[[:space:]]*).*$|\\1\"$TRUST_HASH\"|" \
154+
"$CONFIG_TOML_PATH"
155+
156+
echo "State sync configuration updated successfully"
157+
EOF
158+
159+
chmod +x state_sync.sh
160+
./state_sync.sh
161+
```
162+
163+
### Step 8: Reset Node Data
164+
165+
Reset existing data while keeping the address book:
166+
167+
```shell
168+
allorad tendermint unsafe-reset-all --home $HOME/.allorad --keep-addr-book
169+
```
170+
171+
<Callout type="warning">
172+
**Warning**: This command deletes blockchain data. Only run this on a fresh node or when you intend to resync from scratch.
173+
</Callout>
174+
175+
### Step 9: Create systemd Service
176+
177+
Create a systemd service file for cosmosvisor:
178+
179+
```shell
180+
sudo tee /etc/systemd/system/allorad.service > /dev/null <<EOF
181+
[Unit]
182+
Description=Allora Node (allorad via Cosmovisor)
183+
After=network-online.target
184+
185+
[Service]
186+
User=$USER
187+
ExecStart=$(which cosmovisor) run start
188+
Restart=always
189+
RestartSec=3
190+
LimitNOFILE=65535
191+
Environment="DAEMON_HOME=$HOME/.allorad"
192+
Environment="DAEMON_NAME=allorad"
193+
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
194+
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
195+
Environment="DAEMON_POLL_INTERVAL=300ms"
196+
Environment="UNSAFE_SKIP_BACKUP=true"
197+
198+
[Install]
199+
WantedBy=multi-user.target
200+
EOF
201+
```
202+
203+
<Callout type="info">
204+
**Security Note**: `DAEMON_ALLOW_DOWNLOAD_BINARIES` is set to `false` for security. Validators should manually place upgrade binaries in the appropriate directories.
205+
</Callout>
206+
207+
### Step 10: Start the Service
208+
209+
Enable and start the systemd service:
210+
211+
```shell
212+
sudo systemctl daemon-reload
213+
sudo systemctl enable allorad
214+
sudo systemctl start allorad
215+
```
216+
217+
### Monitoring and Management
218+
219+
Monitor your node logs:
220+
221+
```shell
222+
sudo journalctl -u allorad -f
223+
```
224+
225+
Check service status:
226+
227+
```shell
228+
sudo systemctl status allorad
229+
```
230+
231+
Check sync status:
232+
233+
```shell
234+
curl -s http://localhost:26657/status | jq .result.sync_info.catching_up
235+
```
236+
237+
Once this returns `false`, your node is fully synced.
238+
239+
### Managing Upgrades with cosmosvisor
240+
241+
When a governance upgrade is approved, prepare for it by placing the new binary:
242+
243+
```shell
244+
# For an upgrade named "v1.0.0", create the upgrade directory
245+
mkdir -p $DAEMON_HOME/cosmovisor/upgrades/v1.0.0/bin
246+
247+
# Download and place the new binary (replace with actual URL)
248+
# wget NEW_BINARY_URL -O $DAEMON_HOME/cosmovisor/upgrades/v1.0.0/bin/allorad
249+
# chmod +x $DAEMON_HOME/cosmovisor/upgrades/v1.0.0/bin/allorad
250+
```
251+
252+
<Callout type="info">
253+
**Info**: cosmosvisor will automatically switch to the new binary at the upgrade height specified in the governance proposal. Monitor governance proposals and prepare upgrade binaries in advance.
254+
</Callout>
255+
256+
***
257+
258+
## Method 2: Using `docker compose`
259+
260+
Running the Allora node with `docker compose` simplifies the setup and ensures consistency across different environments, but requires manual upgrade management.
22261

23262
### Step 1: Clone the Allora Chain Repository
24263

0 commit comments

Comments
 (0)