Last active
June 30, 2025 16:46
-
-
Save slickroot/13d1aa225c36c00d92557d72fcce9ba4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# setup_iota_pm2.sh — one-shot setup & forever-run via pm2 | |
set -euo pipefail | |
# ──────────────────────────── configurable ──────────────────────────── | |
BRANCH="${1:-${BRANCH:-slickroot/gpu-memory-aware-miner}}" | |
REPO_SSH="[email protected]:Datura-ai/iota.git" | |
WORKDIR="IOTA" # where we clone the repo | |
PY_ARGS="launch_miner.py --env docker" | |
# ────────────────────────────────────────────────────────────────────── | |
echo "=== 1. Dependencies =================================================" | |
if ! command -v git &>/dev/null; then | |
echo "[+] Installing git…" | |
apt-get update && apt-get install -y git | |
fi | |
if ! command -v uv &>/dev/null; then | |
echo "[+] Installing uv…" | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
export PATH="$HOME/.local/bin:$PATH" | |
fi | |
if ! command -v pm2 &>/dev/null; then | |
echo "[+] Installing Node.js + pm2…" | |
apt-get install -y nodejs npm # use nvm if you prefer | |
npm install -g pm2 | |
fi | |
echo "=== 2. Clone & checkout branch ======================================" | |
rm -rf "$WORKDIR" | |
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' \ | |
git clone "$REPO_SSH" "$WORKDIR" | |
cd "$WORKDIR" | |
git switch "$BRANCH" | |
echo "=== 3. Python environment & deps ====================================" | |
uv venv # creates .venv | |
source .venv/bin/activate | |
uv pip install --upgrade pip | |
uv pip install bittensor bittensor-cli | |
uv sync # project requirements from pyproject.lock | |
echo "=== 4. Bootstrap .env (if absent) ===================================" | |
if [[ ! -f .env ]]; then | |
cat > .env <<'EOL' | |
SIGNING_API_KEY=secret-bittensor | |
SIGNING_API_URL="http://3.144.48.81" | |
MINER_HOTKEY_SS58="${HOTKEY}" | |
netuid=9 | |
network="finney" | |
MOCK=False | |
BITTENSOR=True | |
HF_TOKEN="${HF}" | |
ORCHESTRATOR_HOST="iota.api.macrocosmos.ai" | |
ORCHESTRATOR_PORT=443 | |
ORCHESTRATOR_SCHEME=https | |
EOL | |
fi | |
# export vars for pm2 (it inherits current env) | |
set -o allexport && source .env && set +o allexport |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment