Skip to content

Commit 7f65cc7

Browse files
committed
infra(aggregation_mode): add setup files
1 parent 37be9e4 commit 7f65cc7

5 files changed

Lines changed: 166 additions & 0 deletions

File tree

infra/aggregation_mode/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Aggregation Mode Setup
2+
3+
## Setup on Server with GPU
4+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=AggregationMode
3+
After=network.target
4+
5+
[Service]
6+
Type=oneshot
7+
WorkingDirectory=/home/user
8+
ExecStartPre=sleep 60
9+
ExecStart=/home/user/.cargo/bin/proof_aggregator /home/user/config/config-proof-aggregator.yaml
10+
RemainAfterExit=yes
11+
Environment="SP1_PROVER=cuda"
12+
13+
[Install]
14+
WantedBy=multi-user.target
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
3+
# Set new server name
4+
while :; do
5+
echo -e "\nEnter new server name:"
6+
read -p "> " new_server_name
7+
8+
if [[ ! "$new_server_name" =~ ^[a-zA-Z0-9-]+$ ]]; then
9+
echo "Invalid characters used in the server name. Please use only alphanumeric characters and hyphens (-)."
10+
else
11+
echo -e "\nSetting new server name to '$new_server_name'..."
12+
echo "Old server name: $old_server_name"
13+
sudo hostnamectl set-hostname "$new_server_name"
14+
sudo sed -i "s/$old_server_name/$new_server_name/g" /etc/hosts
15+
echo "Please reconnect to the server to see the name change."
16+
break
17+
fi
18+
done
19+
20+
# Install other dependencies
21+
sudo apt install -y gcc pkg-config libssl-dev build-essential apt-transport-https ca-certificates curl software-properties-common nvtop
22+
23+
# Install tailscale
24+
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
25+
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
26+
sudo apt-get update
27+
sudo apt-get install tailscale
28+
sudo tailscale up --ssh --advertise-tags=tag:server && sudo tailscale set --auto-update
29+
30+
# Install CUDA
31+
sudo add-apt-repository ppa:graphics-drivers/ppa
32+
sudo apt update
33+
sudo apt install nvidia-driver-570
34+
35+
# Setup Docker and CUDA
36+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
37+
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
38+
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
39+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
40+
sudo apt-get update
41+
sudo apt-get install -y nvidia-container-toolkit
42+
sudo nvidia-ctk runtime configure --runtime=docker
43+
sudo systemctl restart docker
44+
45+
# Install Rust
46+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
47+
. "$HOME/.cargo/env"
48+
49+
# Install SP1
50+
curl -L https://sp1.succinct.xyz | bash
51+
source $HOME/.bashrc
52+
sp1up
53+
54+
# Install cast
55+
curl -L https://foundry.paradigm.xyz | bash
56+
source $HOME/.bashrc
57+
foundryup
58+
59+
# Create directories
60+
mkdir -p repos/proof_aggregation
61+
mkdir -p config
62+
#mkdir -p .config/systemd/user
63+
mkdir -p .keystores
64+
65+
# Clone Repo
66+
cd repos/proof_aggregation
67+
git clone https://github.com/yetanotherco/aligned_layer.git
68+
cd aligned_layer
69+
git checkout staging
70+
cd ../..
71+
72+
# Create keystore
73+
cast wallet import proof_aggregation.keystore -k $HOME/.keystores -i
74+
75+
# Copy config file
76+
#cp repos/proof_aggregation/aligned_layer/config-files/config-proof-aggregator.yaml config/config-proof-aggregator.yaml
77+
.$HOME/repos/proof_aggregation/aligned_layer/infra/aggregation_mode/config_file.sh $HOME/repos/proof_aggregation/aligned_layer/infra/aggregation_mode/config-proof-aggregator.template.yaml
78+
79+
# Build the proof_aggregator
80+
cd repos/proof_aggregation/aligned_layer
81+
cargo install --path aggregation_mode --features prove
82+
83+
# Setup systemd service
84+
sudo cp $HOME/repos/proof_aggregation/aligned_layer/infra/aggregation_mode/aggregation_mode.service /etc/systemd/system/aggregation_mode.service
85+
sudo systemctl enable aggregation_mode.service
86+
87+
# Run the proof_aggregator
88+
sudo systemctl start aggregation_mode.service
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
aligned_service_manager_address: <aligned_service_manager_address>
2+
proof_aggregation_service_address: <proof_aggregation_service_address>
3+
eth_rpc_url: <eth_rpc_url>
4+
eth_ws_url: <eth_ws_url>
5+
max_proofs_in_queue: 1000
6+
# How far in the past should the service go to fetch batch logs
7+
fetch_logs_from_secs_ago: 8500 # 24hs
8+
# Anvil start with block time is 7 seconds
9+
block_time_secs: 12
10+
11+
ecdsa:
12+
private_key_store_path: <private_key_store_path>
13+
private_key_store_password: <private_key_store_password>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Check if template file path is provided as argument
4+
if [ $# -ne 1 ]; then
5+
echo "Usage: $0 <template_file_path>"
6+
exit 1
7+
fi
8+
9+
TEMPLATE_FILE="$1"
10+
11+
# Verify template file exists
12+
if [ ! -f "$TEMPLATE_FILE" ]; then
13+
echo "Error: Template file '$TEMPLATE_FILE' not found"
14+
exit 1
15+
fi
16+
17+
# Create temporary file by copying the template
18+
TEMP_FILE=$(mktemp)
19+
cp "$TEMPLATE_FILE" "$TEMP_FILE"
20+
21+
# Function to prompt for input and replace placeholder
22+
prompt_and_replace() {
23+
local placeholder=$1
24+
local description=$2
25+
26+
read -p "Enter $description: " value
27+
sed -i "s|$placeholder|$value|g" "$TEMP_FILE"
28+
}
29+
30+
# Prompt for each placeholder found in the template
31+
prompt_and_replace "<aligned_service_manager_address>" "Aligned Service Manager Address"
32+
prompt_and_replace "<proof_aggregation_service_address>" "Proof Aggregation Service Address"
33+
prompt_and_replace "<eth_rpc_url>" "Ethereum RPC URL"
34+
prompt_and_replace "<eth_ws_url>" "Ethereum WebSocket URL"
35+
prompt_and_replace "<private_key_store_path>" "ECDSA Private Key Store Path"
36+
prompt_and_replace "<private_key_store_password>" "ECDSA Private Key Store Password"
37+
38+
# Create destination directory if it doesn't exist
39+
mkdir -p /home/user/config
40+
41+
# Copy the completed file to destination
42+
cp "$TEMP_FILE" $HOME/config/config_file
43+
44+
# Clean up temporary file
45+
rm "$TEMP_FILE"
46+
47+
echo "Configuration file has been created and copied to $HOME/config/config_file"

0 commit comments

Comments
 (0)