Files
aitbc/scripts/workflow/01_preflight_setup.sh
aitbc 27312dcf2a
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
CLI Tests / test-cli (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 11s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Standardize config files: use blockchain.env and node.env instead of .env
- Update CLI config to load from /etc/aitbc/blockchain.env
- Update operational-features.md documentation
- Update setup.sh to create/use blockchain.env
- Update utility scripts (setup-credentials, migrate_secrets, generate_unique_node_ids, chain_regen_node, load-keystore-secrets)
- Update workflow scripts (01_preflight_setup, hermes preflight setups)
- Maintain backward compatibility for existing deployments
2026-05-26 15:53:04 +02:00

55 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Pre-Flight Setup Script for AITBC Multi-Node Blockchain
# This script prepares the system for multi-node blockchain deployment
set -e # Exit on any error
echo "=== AITBC Multi-Node Blockchain Pre-Flight Setup ==="
# 1. Stop existing services
echo "1. Stopping existing services..."
systemctl stop aitbc-blockchain-* 2>/dev/null || true
# 2. Update ALL systemd configurations (main files + drop-ins + overrides)
echo "2. Updating systemd configurations..."
# Update main service files
sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/blockchain.env|g' /opt/aitbc/systemd/aitbc-blockchain-*.service
# Update drop-in configs
find /etc/systemd/system/aitbc-blockchain-*.service.d/ -name "10-central-env.conf" -exec sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/blockchain.env|g' {} \; 2>/dev/null || true
# Fix override configs (wrong venv paths)
find /etc/systemd/system/aitbc-blockchain-*.service.d/ -name "override.conf" -exec sed -i 's|/opt/aitbc/apps/blockchain-node/.venv/bin/python3|/opt/aitbc/venv/bin/python3|g' {} \; 2>/dev/null || true
systemctl daemon-reload
# 3. Create central configuration file
echo "3. Setting up central configuration file..."
cp /opt/aitbc/.env /etc/aitbc/blockchain.env.backup 2>/dev/null || true
# Ensure blockchain.env is in the correct location
mv /opt/aitbc/.env /etc/aitbc/blockchain.env 2>/dev/null || true
# 4. Setup AITBC CLI tool
echo "4. Setting up AITBC CLI tool..."
# Use central virtual environment (dependencies already installed)
source /opt/aitbc/venv/bin/activate
pip install -e /opt/aitbc/cli/ 2>/dev/null || true
echo 'alias aitbc="source /opt/aitbc/venv/bin/activate && aitbc"' >> ~/.bashrc
source ~/.bashrc
# 5. Clean old data (optional but recommended)
echo "5. Cleaning old data..."
rm -rf /var/lib/aitbc/data/ait-mainnet/*
rm -rf /var/lib/aitbc/keystore/*
# 6. Create keystore password file
echo "6. Creating keystore password file..."
mkdir -p /var/lib/aitbc/keystore
echo 'aitbc123' > /var/lib/aitbc/keystore/.password
chmod 600 /var/lib/aitbc/keystore/.password
# 7. Verify setup
echo "7. Verifying setup..."
aitbc --help 2>/dev/null || echo "CLI available but limited commands"
ls -la /etc/aitbc/blockchain.env
echo "✅ Pre-flight setup completed successfully!"
echo "System is ready for multi-node blockchain deployment."