-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathaggregation_mode.sh
More file actions
executable file
·128 lines (106 loc) · 4.78 KB
/
aggregation_mode.sh
File metadata and controls
executable file
·128 lines (106 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# Set new server name
while :; do
echo -e "\nEnter new server name:"
read -p "> " new_server_name
if [[ ! "$new_server_name" =~ ^[a-zA-Z0-9-]+$ ]]; then
echo "Invalid characters used in the server name. Please use only alphanumeric characters and hyphens (-)."
else
echo -e "\nSetting new server name to '$new_server_name'..."
echo "Old server name: $old_server_name"
sudo hostnamectl set-hostname "$new_server_name"
sudo sed -i "s/$old_server_name/$new_server_name/g" /etc/hosts
echo "Please reconnect to the server to see the name change."
break
fi
done
# Enable linger
sudo loginctl enable-linger user
# Install other dependencies
sudo apt install -y gcc pkg-config libssl-dev build-essential apt-transport-https ca-certificates curl software-properties-common nvtop
# Install docker
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# Install tailscale
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale
sudo tailscale up --ssh --advertise-tags=tag:server && sudo tailscale set --auto-update
# Install CUDA
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-570
# If see errors
sudo apt-mark unhold cuda-drivers cuda-toolkit-12-6 nvidia-dkms-565-server nvidia-fabricmanager-565 nvidia-headless-565-server nvidia-utils-565-server
sudo apt update
sudo apt install nvidia-driver-570
sudo apt autoremove
sudo apt autoclean
sudo reboot
nvidia-smi # To check if the driver is installed correctly
# Setup Docker and CUDA
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. "$HOME/.cargo/env"
# Install SP1
curl -L https://sp1.succinct.xyz | bash
source $HOME/.bashrc
sp1up
# Install cast
curl -L https://foundry.paradigm.xyz | bash
source $HOME/.bashrc
foundryup
# Create directories
mkdir -p repos/proof_aggregation
mkdir -p config
mkdir -p .config/systemd/user
mkdir -p .keystores
# Clone Repo
cd repos/proof_aggregation
git clone https://github.com/yetanotherco/aligned_layer.git
cd aligned_layer
git checkout staging
cd
# Create keystore
cast wallet import proof_aggregation.keystore -k $HOME/.keystores -i
# Create config file interactively
$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
read -p "Enter a number (last_aggregated_block): " num && echo "{\"last_aggregated_block\":$num}" > $HOME/config/proof-aggregator.last_aggregated_block.json.test
# Build the proof_aggregator
cd repos/proof_aggregation/aligned_layer
make install_aggregation_mode
# Setup systemd service
cp $HOME/repos/proof_aggregation/aligned_layer/infra/aggregation_mode/aggregation_mode.service $HOME/.config/systemd/user/aggregation_mode.service
cp $HOME/repos/proof_aggregation/aligned_layer/infra/aggregation_mode/aggregation_mode.timer $HOME/.config/systemd/user/aggregation_mode.timer
#sudo systemctl enable aggregation_mode.service
systemctl --user enable aggregation_mode.timer
systemctl --user start aggregation_mode.timer
# Run the proof_aggregator manually if you want
systemctl --user start aggregation_mode.service
systemctl --user start aggregation_mode_stage.service
# Check timer status
systemctl --user status aggregation_mode.timer
# Check logs
journalctl -xfeu aggregation_mode.service --user -n10
journalctl -xfeu aggregation_mode_stage.service --user -n10