|
| 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 |
0 commit comments