bisq-bot/bot/setup.sh
shakespeare.diy baf3a22c44 Phase 1: Core Bisq bot with multi-relay support
Implements the foundation for a Nostr-based Bisq marketplace bot:

Core Components:
- NostrHandler: Multi-relay connection management with simultaneous subscribe/publish
- BisqClient: Async wrapper around bisq-cli for marketplace queries
- MessageParser: Flexible command parsing with multiple input formats
- Formatter: Response formatting for Nostr publication
- BisqBot: Main orchestration class coordinating all components

Features:
- Multiple relay support (parallel connections)
- Event deduplication across relays
- Async/await architecture for non-blocking operations
- Comprehensive error handling and recovery
- Flexible command syntax (e.g., "USD BUY", "stats", "help")

Configuration:
- Environment-based configuration with sensible defaults
- Support for N relays via comma-separated config
- Bisq daemon connection configuration

Documentation:
- README.md: Complete user guide with installation and usage
- QUICKSTART.md: 10-minute setup guide
- ARCHITECTURE.md: Detailed technical architecture and design
- RELAY_STRATEGY.md: Multi-relay configuration and optimization

Deployment:
- systemd service file for production deployment on Debian
- setup.sh automated installation script
- .env.example configuration template

Phase 1 Status:  COMPLETE
- Core bot skeleton
- Multi-relay support (no relay dependency needed)
- Nostr subscription and publishing
- Bisq query integration
- Basic command parsing and response
2025-11-01 07:53:03 +00:00

77 lines
2.1 KiB
Bash

#!/bin/bash
# Setup script for Bisq Bot on Debian
set -e # Exit on error
echo "=== Bisq Bot Setup ==="
# Check if running on Debian/Ubuntu
if ! command -v apt-get &> /dev/null; then
echo "Error: This script requires apt-get (Debian/Ubuntu)"
exit 1
fi
# Install system dependencies
echo "Installing system dependencies..."
sudo apt-get update
sudo apt-get install -y \
python3.11 \
python3.11-venv \
python3.11-dev \
python3-pip \
git
# Create bisq user if it doesn't exist
if ! id -u bisq > /dev/null 2>&1; then
echo "Creating bisq user..."
sudo useradd -r -s /bin/bash -d /opt/bisq-bot bisq || true
fi
# Create bot directory if needed
if [ ! -d "/opt/bisq-bot" ]; then
echo "Creating /opt/bisq-bot directory..."
sudo mkdir -p /opt/bisq-bot
fi
# Set permissions
sudo chown -R bisq:bisq /opt/bisq-bot
# Copy bot files (assuming we're in the bot directory)
echo "Copying bot files..."
sudo -u bisq cp -r . /opt/bisq-bot/
# Create virtual environment
echo "Creating Python virtual environment..."
sudo -u bisq python3.11 -m venv /opt/bisq-bot/venv
# Activate venv and install dependencies
echo "Installing Python dependencies..."
sudo -u bisq /opt/bisq-bot/venv/bin/pip install --upgrade pip
sudo -u bisq /opt/bisq-bot/venv/bin/pip install -r /opt/bisq-bot/requirements.txt
# Copy configuration
if [ ! -f "/opt/bisq-bot/.env" ]; then
echo "Creating .env file from template..."
sudo -u bisq cp /opt/bisq-bot/config/.env.example /opt/bisq-bot/.env
echo "⚠️ Please edit /opt/bisq-bot/.env and add your Nostr private key"
fi
# Install systemd service
echo "Installing systemd service..."
sudo cp /opt/bisq-bot/config/bisq-bot.service /etc/systemd/system/
sudo systemctl daemon-reload
echo ""
echo "=== Setup Complete ==="
echo ""
echo "Next steps:"
echo "1. Edit /opt/bisq-bot/.env and set your BOT_PRIVATE_KEY"
echo "2. Verify Bisq daemon is running on localhost:4848"
echo "3. Enable and start the service:"
echo " sudo systemctl enable bisq-bot"
echo " sudo systemctl start bisq-bot"
echo ""
echo "Monitor the bot:"
echo " sudo systemctl status bisq-bot"
echo " journalctl -u bisq-bot -f"