Deploy Mainnet #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Mainnet | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy_public_bootnode: | |
environment: mainnet | |
strategy: | |
matrix: | |
include: | |
- node_index: 1 | |
host_key: BOOT_NODE_1_HOST | |
user_key: BOOT_NODE_1_USER | |
priv_node_key: BOOT_NODE_1_KEY_PRIV | |
- node_index: 2 | |
host_key: BOOT_NODE_2_HOST | |
user_key: BOOT_NODE_2_USER | |
priv_node_key: BOOT_NODE_2_KEY_PRIV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system deps | |
run: sudo apt-get install jq wget | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
eval $(ssh-agent) | |
# - name: Authenticate GitHub CLI and download latest release of chainspec | |
# run: | | |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}" | |
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet-chainspec")) | .tagName' | sort -r | head -n 1) | |
# echo "${LATEST_RELEASE}" | |
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs | |
- name: Download chainspec | |
run: | | |
mkdir chainspecs | |
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json | |
- name: Prepare variables | |
run: | | |
echo "BOOT_NODE_KEY_PRIV=${{ secrets[matrix.priv_node_key] }}" >> mainnet/deploy/bootnode-keys.env | |
echo "container_atleta=bootnode" >> mainnet/deploy/bootnode.env | |
- name: Substitute environment variables | |
env: | |
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }} | |
run: | | |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml | |
- name: Copy files to the server | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta" | |
scp mainnet/deploy/deploy-bootnode.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/deploy-bootnode.sh | |
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json | |
scp mainnet/deploy/bootnode-keys.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/bootnode-keys.env | |
scp mainnet/deploy/bootnode.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}" | |
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml | |
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml | |
- name: Run bootnode | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets[matrix.host_key] }} | |
username: ${{ secrets[matrix.user_key] }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /mnt/sportchain/atleta | |
./deploy-bootnode.sh atletanetwork/atleta-node:stagenet-latest | |
deploy_validators: | |
needs: | |
- deploy_public_bootnode | |
runs-on: ubuntu-latest | |
environment: mainnet | |
strategy: | |
matrix: | |
include: | |
- node_index: 1 | |
host_key: VALIDATOR_1_HOST | |
user_key: VALIDATOR_1_USER | |
priv_node_key: VALIDATOR_1_NODE_KEY_PRIV | |
- node_index: 2 | |
host_key: VALIDATOR_2_HOST | |
user_key: VALIDATOR_2_USER | |
priv_node_key: VALIDATOR_2_NODE_KEY_PRIV | |
- node_index: 3 | |
host_key: VALIDATOR_3_HOST | |
user_key: VALIDATOR_3_USER | |
priv_node_key: VALIDATOR_3_NODE_KEY_PRIV | |
- node_index: 4 | |
host_key: VALIDATOR_4_HOST | |
user_key: VALIDATOR_4_USER | |
priv_node_key: VALIDATOR_4_NODE_KEY_PRIV | |
- node_index: 5 | |
host_key: VALIDATOR_5_HOST | |
user_key: VALIDATOR_5_USER | |
priv_node_key: VALIDATOR_5_NODE_KEY_PRIV | |
- node_index: 6 | |
host_key: VALIDATOR_6_HOST | |
user_key: VALIDATOR_6_USER | |
priv_node_key: VALIDATOR_6_NODE_KEY_PRIV | |
- node_index: 7 | |
host_key: VALIDATOR_7_HOST | |
user_key: VALIDATOR_7_USER | |
priv_node_key: VALIDATOR_7_NODE_KEY_PRIV | |
- node_index: 8 | |
host_key: VALIDATOR_8_HOST | |
user_key: VALIDATOR_8_USER | |
priv_node_key: VALIDATOR_8_NODE_KEY_PRIV | |
- node_index: 9 | |
host_key: VALIDATOR_9_HOST | |
user_key: VALIDATOR_9_USER | |
priv_node_key: VALIDATOR_9_NODE_KEY_PRIV | |
- node_index: 10 | |
host_key: VALIDATOR_10_HOST | |
user_key: VALIDATOR_10_USER | |
priv_node_key: VALIDATOR_10_NODE_KEY_PRIV | |
- node_index: 11 | |
host_key: VALIDATOR_11_HOST | |
user_key: VALIDATOR_11_USER | |
priv_node_key: VALIDATOR_11_NODE_KEY_PRIV | |
- node_index: 12 | |
host_key: VALIDATOR_12_HOST | |
user_key: VALIDATOR_12_USER | |
priv_node_key: VALIDATOR_12_NODE_KEY_PRIV | |
#- node_index: 13 | |
# host_key: VALIDATOR_13_HOST | |
# user_key: VALIDATOR_13_USER | |
# priv_node_key: VALIDATOR_13_NODE_KEY_PRIV | |
- node_index: 14 | |
host_key: VALIDATOR_14_HOST | |
user_key: VALIDATOR_14_USER | |
priv_node_key: VALIDATOR_14_NODE_KEY_PRIV | |
- node_index: 15 | |
host_key: VALIDATOR_15_HOST | |
user_key: VALIDATOR_15_USER | |
priv_node_key: VALIDATOR_15_NODE_KEY_PRIV | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system deps | |
run: sudo apt-get install jq wget | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
eval $(ssh-agent) | |
# - name: Authenticate GitHub CLI and download latest release of chainspec | |
# run: | | |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}" | |
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet")) | .tagName' | sort -r | head -n 1) | |
# echo "${LATEST_RELEASE}" | |
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs | |
- name: Download chainspec | |
run: | | |
mkdir chainspecs | |
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json | |
- name: Make Keys File | |
run: | | |
echo "${{ secrets.DEV_ACCOUNTS_KEYS }}" > mainnet/deploy/mainnet.keys.env | |
- name: Substitute environment variables | |
env: | |
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }} | |
run: | | |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml | |
- name: Prepare .env files | |
run: | | |
echo "VALIDATOR_KEY=${{ secrets[matrix.priv_node_key] }}" >> mainnet/deploy/validator.env | |
echo "INDEX=${{ matrix.node_index }}" >> mainnet/deploy/validator.env | |
echo "container_atleta=validator" >> mainnet/deploy/validator.env | |
- name: Copy Files to Server | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta" | |
scp mainnet/deploy/add-session-keys.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/add-session-keys.sh | |
scp mainnet/deploy/deploy-validator.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/deploy-validator.sh | |
scp mainnet/deploy/mainnet.keys.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/mainnet.keys.env | |
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json | |
scp mainnet/deploy/validator.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}" | |
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml | |
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml | |
- name: SSH into Server and Deploy | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets[matrix.host_key] }} | |
username: ${{ secrets[matrix.user_key] }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /mnt/sportchain/atleta | |
./deploy-validator.sh mainnet.keys.env atletanetwork/atleta-node:stagenet-latest | |
deploy_archive_nodes: | |
needs: | |
- deploy_validators | |
runs-on: ubuntu-latest | |
environment: mainnet | |
strategy: | |
matrix: | |
include: | |
- node_index: 1 | |
host_key: ARCH_1_HOST | |
user_key: ARCH_1_USER | |
priv_node_key: ARCH_1_NODE_KEY_PRIV | |
- node_index: 2 | |
host_key: ARCH_2_HOST | |
user_key: ARCH_2_USER | |
priv_node_key: ARCH_2_NODE_KEY_PRIV | |
- node_index: 3 | |
host_key: ARCH_3_HOST | |
user_key: ARCH_3_USER | |
priv_node_key: ARCH_3_NODE_KEY_PRIV | |
- node_index: 4 | |
host_key: ARCH_4_HOST | |
user_key: ARCH_4_USER | |
priv_node_key: aARCH_4_NODE_KEY_PRIV | |
- node_index: 5 | |
host_key: ARCH_5_HOST | |
user_key: ARCH_5_USER | |
priv_node_key: ARCH_5_NODE_KEY_PRIV | |
- node_index: 6 | |
host_key: ARCH_6_HOST | |
user_key: ARCH_6_USER | |
priv_node_key: ARCH_6_NODE_KEY_PRIV | |
- node_index: 7 | |
host_key: ARCH_7_HOST | |
user_key: ARCH_7_USER | |
priv_node_key: ARCH_7_NODE_KEY_PRIV | |
- node_index: 8 | |
host_key: ARCH_8_HOST | |
user_key: ARCH_8_USER | |
priv_node_key: ARCH_8_NODE_KEY_PRIV | |
- node_index: 9 | |
host_key: ARCH_9_HOST | |
user_key: ARCH_9_USER | |
priv_node_key: ARCH_9_NODE_KEY_PRIV | |
- node_index: 10 | |
host_key: ARCH_10_HOST | |
user_key: ARCH_10_USER | |
priv_node_key: ARCH_10_NODE_KEY_PRIV | |
- node_index: 11 | |
host_key: ARCH_11_HOST | |
user_key: ARCH_11_USER | |
priv_node_key: ARCH_11_NODE_KEY_PRIV | |
- node_index: 12 | |
host_key: ARCH_12_HOST | |
user_key: ARCH_12_USER | |
priv_node_key: ARCH_12_NODE_KEY_PRIV | |
- node_index: 13 | |
host_key: ARCH_13_HOST | |
user_key: ARCH_13_USER | |
priv_node_key: ARCH_13_NODE_KEY_PRIV | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system deps | |
run: sudo apt-get install jq wget | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
eval $(ssh-agent) | |
# - name: Authenticate GitHub CLI and download latest release of chainspec | |
# run: | | |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}" | |
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet")) | .tagName' | sort -r | head -n 1) | |
# echo "${LATEST_RELEASE}" | |
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs | |
- name: Download chainspec | |
run: | | |
mkdir chainspecs | |
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json | |
- name: Substitute environment variables | |
env: | |
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }} | |
run: | | |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml | |
- name: Prepare .env files | |
run: | | |
echo "INDEX=${{ matrix.node_index }}" >> mainnet/deploy/archive-node.env | |
echo "container_atleta=archive" >> mainnet/deploy/archive-node.env | |
- name: Copy Files to Server | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta" | |
scp mainnet/deploy/run-archive-node.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/run-archive-node.sh | |
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json | |
scp mainnet/deploy/archive-node.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env | |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}" | |
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml | |
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml | |
- name: SSH into Server and Deploy | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets[matrix.host_key] }} | |
username: ${{ secrets[matrix.user_key] }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /mnt/sportchain/atleta | |
./run-archive-node.sh atletanetwork/atleta-node:stagenet-latest |