Update .gitignore and remove obsolete documentation files
- Added new entries to .gitignore for build artifacts and macOS output directories to streamline the build process. - Deleted outdated documentation files: AUTH_LOGIN_FIX.md, AUTBOOT_CONFIGURATION.md, BACKEND_FIXES.md, BACKEND_STARTUP_FIX.md, BITCOIN_CORE_HEADLESS_FIX.md, BITCOIN_CORE_UI_COMPLETE.md, BITCOIN_STANDALONE_UI_COMPLETE.md, BITCOIN_UI_COMPLETE.md, BOOT_SEQUENCE_DIAGRAM.txt, and BUILD_COMMANDS_REFERENCE.txt to declutter the repository and remove unnecessary content.
This commit is contained in:
+311
@@ -0,0 +1,311 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Archipelago Main Menu
|
||||
# Interactive setup wizard for Archipelago Bitcoin Node OS
|
||||
#
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Install required tools on first run (for live mode)
|
||||
install_required_tools() {
|
||||
if [ -f /tmp/.archipelago-tools-installed ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if we need to install tools
|
||||
local NEED_TOOLS=0
|
||||
for tool in parted debootstrap mkfs.ext4 mkfs.vfat; do
|
||||
if ! command -v $tool >/dev/null 2>&1; then
|
||||
NEED_TOOLS=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $NEED_TOOLS -eq 1 ]; then
|
||||
echo ""
|
||||
echo " 📦 Installing required tools (first run)..."
|
||||
echo ""
|
||||
sudo apt-get update -qq 2>/dev/null
|
||||
sudo apt-get install -y parted debootstrap dosfstools e2fsprogs 2>/dev/null
|
||||
echo " ✅ Tools installed"
|
||||
echo ""
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
touch /tmp/.archipelago-tools-installed
|
||||
}
|
||||
|
||||
# Run tool installation at startup
|
||||
install_required_tools
|
||||
|
||||
show_banner() {
|
||||
clear
|
||||
echo ""
|
||||
echo " ╔═══════════════════════════════════════════════════════════╗"
|
||||
echo " ║ ║"
|
||||
echo " ║ 🏝️ ARCHIPELAGO BITCOIN NODE OS ║"
|
||||
echo " ║ ║"
|
||||
echo " ║ Your sovereign Bitcoin infrastructure ║"
|
||||
echo " ║ ║"
|
||||
echo " ╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
}
|
||||
|
||||
show_status() {
|
||||
echo " System Status:"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
|
||||
# Check if we're in live mode
|
||||
if [ -d /run/live ]; then
|
||||
echo " Mode: 🔴 Live (changes won't persist)"
|
||||
else
|
||||
echo " Mode: 🟢 Installed"
|
||||
fi
|
||||
|
||||
# Check Podman
|
||||
if command -v podman >/dev/null 2>&1; then
|
||||
echo " Podman: 🟢 Installed"
|
||||
else
|
||||
echo " Podman: 🔴 Not installed"
|
||||
fi
|
||||
|
||||
# Check Bitcoin Core
|
||||
if podman ps 2>/dev/null | grep -q bitcoind; then
|
||||
BLOCKS=$(podman exec bitcoind bitcoin-cli getblockcount 2>/dev/null || echo "syncing")
|
||||
echo " Bitcoin: 🟢 Running (blocks: $BLOCKS)"
|
||||
elif podman ps -a 2>/dev/null | grep -q bitcoind; then
|
||||
echo " Bitcoin: 🟡 Stopped"
|
||||
else
|
||||
echo " Bitcoin: ⚪ Not configured"
|
||||
fi
|
||||
|
||||
# Check LND
|
||||
if podman ps 2>/dev/null | grep -q lnd; then
|
||||
echo " Lightning: 🟢 Running"
|
||||
elif podman ps -a 2>/dev/null | grep -q lnd; then
|
||||
echo " Lightning: 🟡 Stopped"
|
||||
else
|
||||
echo " Lightning: ⚪ Not configured"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
main_menu() {
|
||||
while true; do
|
||||
show_banner
|
||||
show_status
|
||||
|
||||
# Show Web UI URL
|
||||
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
if [ -n "$IP" ]; then
|
||||
echo " 🌐 Web UI: http://$IP"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo " Main Menu:"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
echo ""
|
||||
echo " w) Open Web UI - Launch graphical interface"
|
||||
echo ""
|
||||
echo " 1) Install to Disk - Permanently install Archipelago"
|
||||
echo " 2) Setup Bitcoin Core - Configure Bitcoin full node"
|
||||
echo " 3) Setup Lightning (LND) - Configure Lightning Network"
|
||||
echo " 4) Setup BTCPay Server - Bitcoin payment processor"
|
||||
echo " 5) View Logs - Monitor running services"
|
||||
echo " 6) Network Settings - Configure networking"
|
||||
echo " 7) System Info - View system information"
|
||||
echo ""
|
||||
echo " q) Quit"
|
||||
echo ""
|
||||
read -p " Select option: " choice
|
||||
|
||||
case $choice in
|
||||
w|W)
|
||||
if [ -f "$SCRIPT_DIR/start-web-ui.sh" ]; then
|
||||
sudo bash "$SCRIPT_DIR/start-web-ui.sh" 80
|
||||
else
|
||||
# Try to find and start web UI
|
||||
for path in /opt/archipelago/scripts /run/live/medium/archipelago/scripts; do
|
||||
if [ -f "$path/start-web-ui.sh" ]; then
|
||||
sudo bash "$path/start-web-ui.sh" 80
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
1)
|
||||
if [ -f "$SCRIPT_DIR/install-to-disk.sh" ]; then
|
||||
sudo bash "$SCRIPT_DIR/install-to-disk.sh"
|
||||
else
|
||||
echo "Installer not found. Running from: $SCRIPT_DIR"
|
||||
fi
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
2)
|
||||
if [ -f "$SCRIPT_DIR/setup-bitcoin.sh" ]; then
|
||||
bash "$SCRIPT_DIR/setup-bitcoin.sh"
|
||||
else
|
||||
echo "Bitcoin setup script not found."
|
||||
fi
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
3)
|
||||
if [ -f "$SCRIPT_DIR/setup-lnd.sh" ]; then
|
||||
bash "$SCRIPT_DIR/setup-lnd.sh"
|
||||
else
|
||||
echo "LND setup script not found."
|
||||
fi
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
4)
|
||||
setup_btcpay
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
5)
|
||||
view_logs
|
||||
;;
|
||||
6)
|
||||
network_settings
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
7)
|
||||
system_info
|
||||
read -p "Press Enter to continue..."
|
||||
;;
|
||||
q|Q)
|
||||
echo ""
|
||||
echo " Goodbye! 🏝️"
|
||||
echo ""
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option"
|
||||
sleep 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
setup_btcpay() {
|
||||
show_banner
|
||||
echo " BTCPay Server Setup"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
echo ""
|
||||
echo " BTCPay Server is a self-hosted Bitcoin payment processor."
|
||||
echo ""
|
||||
|
||||
if ! podman ps | grep -q bitcoind; then
|
||||
echo " ⚠️ Bitcoin Core must be running first."
|
||||
return
|
||||
fi
|
||||
|
||||
read -p " Setup BTCPay Server? [y/N]: " SETUP
|
||||
if [[ ! "$SETUP" =~ ^[Yy]$ ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo " 🐳 Pulling BTCPay Server image..."
|
||||
podman pull docker.io/btcpayserver/btcpayserver:latest
|
||||
|
||||
# Create data directory
|
||||
mkdir -p ~/.btcpay
|
||||
|
||||
echo ""
|
||||
echo " BTCPay Server setup is more complex and typically uses docker-compose."
|
||||
echo " For a full setup, visit: https://docs.btcpayserver.org"
|
||||
echo ""
|
||||
}
|
||||
|
||||
view_logs() {
|
||||
show_banner
|
||||
echo " View Logs"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
echo ""
|
||||
echo " 1) Bitcoin Core logs"
|
||||
echo " 2) LND logs"
|
||||
echo " 3) System logs"
|
||||
echo " b) Back"
|
||||
echo ""
|
||||
read -p " Select: " choice
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
if podman ps -a | grep -q bitcoind; then
|
||||
podman logs -f --tail 50 bitcoind
|
||||
else
|
||||
echo "Bitcoin Core not running"
|
||||
read -p "Press Enter..."
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
if podman ps -a | grep -q lnd; then
|
||||
podman logs -f --tail 50 lnd
|
||||
else
|
||||
echo "LND not running"
|
||||
read -p "Press Enter..."
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
journalctl -f
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
network_settings() {
|
||||
show_banner
|
||||
echo " Network Settings"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
echo ""
|
||||
|
||||
# Show current IP
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
echo " Current IP: $IP"
|
||||
echo ""
|
||||
|
||||
# Show network interfaces
|
||||
echo " Network Interfaces:"
|
||||
ip -br addr | grep -v "^lo" | while read line; do
|
||||
echo " $line"
|
||||
done
|
||||
echo ""
|
||||
|
||||
echo " Ports in use:"
|
||||
echo " 8332 - Bitcoin RPC"
|
||||
echo " 8333 - Bitcoin P2P"
|
||||
echo " 9735 - Lightning P2P"
|
||||
echo " 10009 - Lightning gRPC"
|
||||
echo " 8080 - Lightning REST"
|
||||
echo ""
|
||||
}
|
||||
|
||||
system_info() {
|
||||
show_banner
|
||||
echo " System Information"
|
||||
echo " ─────────────────────────────────────────────────────────────"
|
||||
echo ""
|
||||
echo " Hostname: $(hostname)"
|
||||
echo " Kernel: $(uname -r)"
|
||||
echo " Uptime: $(uptime -p)"
|
||||
echo ""
|
||||
echo " CPU: $(grep "model name" /proc/cpuinfo | head -1 | cut -d: -f2 | xargs)"
|
||||
echo " Memory: $(free -h | grep Mem | awk '{print $2}') total, $(free -h | grep Mem | awk '{print $3}') used"
|
||||
echo ""
|
||||
echo " Disk Usage:"
|
||||
df -h / | tail -1 | awk '{print " Root: " $3 " / " $2 " (" $5 " used)"}'
|
||||
if [ -d ~/.bitcoin ]; then
|
||||
echo " Bitcoin: $(du -sh ~/.bitcoin 2>/dev/null | cut -f1)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Container status
|
||||
echo " Containers:"
|
||||
if command -v podman >/dev/null 2>&1; then
|
||||
podman ps --format " {{.Names}}: {{.Status}}" 2>/dev/null || echo " No containers running"
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Run main menu
|
||||
main_menu
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Archipelago Disk Installer
|
||||
# Installs Archipelago Bitcoin Node OS to a disk
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ 🏝️ ARCHIPELAGO DISK INSTALLER ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "❌ Please run as root: sudo $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install required tools if missing
|
||||
echo "📦 Checking required tools..."
|
||||
NEED_INSTALL=""
|
||||
for tool in parted debootstrap; do
|
||||
if ! command -v $tool >/dev/null 2>&1; then
|
||||
NEED_INSTALL="$NEED_INSTALL $tool"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$NEED_INSTALL" ]; then
|
||||
echo "📥 Installing required tools:$NEED_INSTALL"
|
||||
apt-get update
|
||||
apt-get install -y $NEED_INSTALL dosfstools e2fsprogs
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# List available disks
|
||||
echo "📋 Available disks:"
|
||||
echo ""
|
||||
lsblk -d -o NAME,SIZE,MODEL | grep -v loop | grep -v sr
|
||||
echo ""
|
||||
|
||||
# Get target disk
|
||||
read -p "Enter target disk (e.g., sda, nvme0n1): " TARGET_DISK
|
||||
TARGET_DEVICE="/dev/$TARGET_DISK"
|
||||
|
||||
if [ ! -b "$TARGET_DEVICE" ]; then
|
||||
echo "❌ Device $TARGET_DEVICE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Confirm
|
||||
echo ""
|
||||
echo "⚠️ WARNING: This will ERASE ALL DATA on $TARGET_DEVICE"
|
||||
echo ""
|
||||
read -p "Type 'yes' to continue: " CONFIRM
|
||||
|
||||
if [ "$CONFIRM" != "yes" ]; then
|
||||
echo "Aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🔧 Partitioning $TARGET_DEVICE..."
|
||||
|
||||
# Unmount any existing partitions
|
||||
umount ${TARGET_DEVICE}* 2>/dev/null || true
|
||||
|
||||
# Create GPT partition table
|
||||
parted -s "$TARGET_DEVICE" mklabel gpt
|
||||
|
||||
# Create partitions:
|
||||
# 1. EFI System Partition (512MB)
|
||||
# 2. Root partition (remaining space)
|
||||
parted -s "$TARGET_DEVICE" mkpart primary fat32 1MiB 513MiB
|
||||
parted -s "$TARGET_DEVICE" set 1 esp on
|
||||
parted -s "$TARGET_DEVICE" mkpart primary ext4 513MiB 100%
|
||||
|
||||
# Wait for partitions to appear
|
||||
sleep 2
|
||||
|
||||
# Determine partition names (handle both /dev/sdX and /dev/nvmeXnYpZ naming)
|
||||
if [[ "$TARGET_DISK" == nvme* ]]; then
|
||||
EFI_PART="${TARGET_DEVICE}p1"
|
||||
ROOT_PART="${TARGET_DEVICE}p2"
|
||||
else
|
||||
EFI_PART="${TARGET_DEVICE}1"
|
||||
ROOT_PART="${TARGET_DEVICE}2"
|
||||
fi
|
||||
|
||||
echo "🗂️ Formatting partitions..."
|
||||
|
||||
# Format EFI partition
|
||||
mkfs.vfat -F32 -n ARCHIPELAGO "$EFI_PART"
|
||||
|
||||
# Format root partition
|
||||
mkfs.ext4 -L archipelago-root "$ROOT_PART"
|
||||
|
||||
echo "📦 Mounting partitions..."
|
||||
|
||||
# Create mount points
|
||||
mkdir -p /mnt/archipelago
|
||||
mount "$ROOT_PART" /mnt/archipelago
|
||||
mkdir -p /mnt/archipelago/boot/efi
|
||||
mount "$EFI_PART" /mnt/archipelago/boot/efi
|
||||
|
||||
echo "📋 Installing base system..."
|
||||
|
||||
# Install base system using debootstrap
|
||||
if command -v debootstrap >/dev/null 2>&1; then
|
||||
debootstrap --arch=amd64 bookworm /mnt/archipelago http://deb.debian.org/debian
|
||||
else
|
||||
echo "❌ debootstrap not found. Installing..."
|
||||
apt-get update && apt-get install -y debootstrap
|
||||
debootstrap --arch=amd64 bookworm /mnt/archipelago http://deb.debian.org/debian
|
||||
fi
|
||||
|
||||
echo "⚙️ Configuring system..."
|
||||
|
||||
# Mount virtual filesystems
|
||||
mount --bind /dev /mnt/archipelago/dev
|
||||
mount --bind /proc /mnt/archipelago/proc
|
||||
mount --bind /sys /mnt/archipelago/sys
|
||||
|
||||
# Create fstab
|
||||
cat > /mnt/archipelago/etc/fstab <<EOF
|
||||
# Archipelago Bitcoin Node OS
|
||||
UUID=$(blkid -s UUID -o value "$ROOT_PART") / ext4 errors=remount-ro 0 1
|
||||
UUID=$(blkid -s UUID -o value "$EFI_PART") /boot/efi vfat umask=0077 0 1
|
||||
EOF
|
||||
|
||||
# Set hostname
|
||||
echo "archipelago" > /mnt/archipelago/etc/hostname
|
||||
|
||||
# Configure hosts
|
||||
cat > /mnt/archipelago/etc/hosts <<EOF
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 archipelago
|
||||
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
EOF
|
||||
|
||||
# Install bootloader and essential packages
|
||||
chroot /mnt/archipelago /bin/bash <<'CHROOT_EOF'
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Add sources
|
||||
cat > /etc/apt/sources.list <<EOF
|
||||
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
|
||||
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
|
||||
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
|
||||
EOF
|
||||
|
||||
apt-get update
|
||||
|
||||
# Install kernel, bootloader, and essentials
|
||||
apt-get install -y \
|
||||
linux-image-amd64 \
|
||||
grub-efi-amd64 \
|
||||
sudo \
|
||||
networkmanager \
|
||||
openssh-server \
|
||||
curl \
|
||||
wget \
|
||||
htop \
|
||||
vim \
|
||||
git \
|
||||
podman \
|
||||
podman-compose \
|
||||
buildah \
|
||||
skopeo
|
||||
|
||||
# Install GRUB
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=archipelago
|
||||
update-grub
|
||||
|
||||
# Create archipelago user
|
||||
useradd -m -s /bin/bash -G sudo,podman archipelago
|
||||
echo "archipelago:archipelago" | chpasswd
|
||||
|
||||
# Enable services
|
||||
systemctl enable NetworkManager
|
||||
systemctl enable ssh
|
||||
systemctl enable podman
|
||||
|
||||
# Create Archipelago directories
|
||||
mkdir -p /var/lib/archipelago/{data,config,containers}
|
||||
mkdir -p /etc/archipelago
|
||||
chown -R archipelago:archipelago /var/lib/archipelago
|
||||
|
||||
echo "✅ Base system installed"
|
||||
CHROOT_EOF
|
||||
|
||||
# Copy Archipelago files
|
||||
echo "📋 Installing Archipelago components..."
|
||||
|
||||
BOOT_MEDIA=""
|
||||
for dev in /run/live/medium /lib/live/mount/medium /cdrom; do
|
||||
if [ -d "$dev/archipelago" ]; then
|
||||
BOOT_MEDIA="$dev"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$BOOT_MEDIA" ]; then
|
||||
echo " Copying from: $BOOT_MEDIA/archipelago"
|
||||
|
||||
# Copy entire archipelago directory
|
||||
mkdir -p /mnt/archipelago/opt/archipelago
|
||||
cp -r "$BOOT_MEDIA/archipelago/"* /mnt/archipelago/opt/archipelago/ 2>/dev/null || true
|
||||
|
||||
# Install binaries
|
||||
if [ -d "$BOOT_MEDIA/archipelago/bin" ]; then
|
||||
cp "$BOOT_MEDIA/archipelago/bin/"* /mnt/archipelago/usr/local/bin/ 2>/dev/null || true
|
||||
chmod +x /mnt/archipelago/usr/local/bin/* 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Install scripts
|
||||
if [ -d "$BOOT_MEDIA/archipelago/scripts" ]; then
|
||||
mkdir -p /mnt/archipelago/opt/archipelago/scripts
|
||||
cp "$BOOT_MEDIA/archipelago/scripts/"* /mnt/archipelago/opt/archipelago/scripts/ 2>/dev/null || true
|
||||
chmod +x /mnt/archipelago/opt/archipelago/scripts/*.sh 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Install app manifests
|
||||
if [ -d "$BOOT_MEDIA/archipelago/apps" ]; then
|
||||
mkdir -p /mnt/archipelago/etc/archipelago
|
||||
cp -r "$BOOT_MEDIA/archipelago/apps" /mnt/archipelago/etc/archipelago/
|
||||
fi
|
||||
|
||||
# Create profile.d script for auto-menu on login
|
||||
mkdir -p /mnt/archipelago/etc/profile.d
|
||||
cat > /mnt/archipelago/etc/profile.d/archipelago.sh <<'PROFILE_EOF'
|
||||
#!/bin/bash
|
||||
# Archipelago welcome message
|
||||
if [ -t 0 ] && [ -z "$ARCHIPELAGO_WELCOMED" ]; then
|
||||
export ARCHIPELAGO_WELCOMED=1
|
||||
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
echo ""
|
||||
echo " 🏝️ Welcome to Archipelago Bitcoin Node OS"
|
||||
echo ""
|
||||
if [ -n "$IP" ]; then
|
||||
echo " Web UI: http://$IP"
|
||||
fi
|
||||
echo " Menu: Type 'archipelago' to open setup menu"
|
||||
echo ""
|
||||
fi
|
||||
PROFILE_EOF
|
||||
chmod +x /mnt/archipelago/etc/profile.d/archipelago.sh
|
||||
fi
|
||||
|
||||
echo "🧹 Cleaning up..."
|
||||
|
||||
# Unmount
|
||||
umount /mnt/archipelago/dev
|
||||
umount /mnt/archipelago/proc
|
||||
umount /mnt/archipelago/sys
|
||||
umount /mnt/archipelago/boot/efi
|
||||
umount /mnt/archipelago
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ ✅ INSTALLATION COMPLETE! ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "Remove the USB drive and reboot to start Archipelago."
|
||||
echo ""
|
||||
echo "Default login:"
|
||||
echo " Username: archipelago"
|
||||
echo " Password: archipelago"
|
||||
echo ""
|
||||
echo "⚠️ Please change the password after first login!"
|
||||
echo ""
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Bitcoin Core Setup Script for Archipelago
|
||||
# Sets up Bitcoin Core in a Podman container
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ ₿ BITCOIN CORE SETUP ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -eq 0 ]; then
|
||||
echo "⚠️ Running as root. For rootless Podman, run as regular user."
|
||||
fi
|
||||
|
||||
# Check for Podman
|
||||
if ! command -v podman >/dev/null 2>&1; then
|
||||
echo "📦 Installing Podman..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y podman podman-compose
|
||||
fi
|
||||
|
||||
# Create data directory
|
||||
BITCOIN_DATA="${HOME}/.bitcoin"
|
||||
mkdir -p "$BITCOIN_DATA"
|
||||
|
||||
echo "📍 Bitcoin data directory: $BITCOIN_DATA"
|
||||
echo ""
|
||||
|
||||
# Ask for configuration
|
||||
echo "Bitcoin Core Configuration:"
|
||||
echo ""
|
||||
read -p "Enable pruning? (saves disk space) [y/N]: " PRUNE
|
||||
read -p "Enable txindex? (required for some apps) [y/N]: " TXINDEX
|
||||
read -p "RPC username [bitcoin]: " RPC_USER
|
||||
RPC_USER=${RPC_USER:-bitcoin}
|
||||
read -p "RPC password [randomly generated]: " RPC_PASS
|
||||
|
||||
if [ -z "$RPC_PASS" ]; then
|
||||
RPC_PASS=$(openssl rand -hex 16)
|
||||
echo " Generated RPC password: $RPC_PASS"
|
||||
fi
|
||||
|
||||
# Create bitcoin.conf
|
||||
cat > "$BITCOIN_DATA/bitcoin.conf" <<EOF
|
||||
# Archipelago Bitcoin Core Configuration
|
||||
|
||||
# Network
|
||||
server=1
|
||||
listen=1
|
||||
|
||||
# RPC
|
||||
rpcuser=$RPC_USER
|
||||
rpcpassword=$RPC_PASS
|
||||
rpcbind=0.0.0.0
|
||||
rpcallowip=10.0.0.0/8
|
||||
rpcallowip=172.16.0.0/12
|
||||
rpcallowip=192.168.0.0/16
|
||||
|
||||
# Performance
|
||||
dbcache=450
|
||||
maxmempool=300
|
||||
|
||||
EOF
|
||||
|
||||
if [[ "$PRUNE" =~ ^[Yy]$ ]]; then
|
||||
echo "prune=550" >> "$BITCOIN_DATA/bitcoin.conf"
|
||||
echo " Pruning enabled (550MB)"
|
||||
fi
|
||||
|
||||
if [[ "$TXINDEX" =~ ^[Yy]$ ]]; then
|
||||
echo "txindex=1" >> "$BITCOIN_DATA/bitcoin.conf"
|
||||
echo " Transaction index enabled"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📋 Created bitcoin.conf"
|
||||
echo ""
|
||||
|
||||
# Pull Bitcoin Core image
|
||||
echo "🐳 Pulling Bitcoin Core container image..."
|
||||
podman pull docker.io/lncm/bitcoind:v27.0
|
||||
|
||||
# Create systemd user service for Bitcoin Core
|
||||
mkdir -p ~/.config/systemd/user
|
||||
|
||||
cat > ~/.config/systemd/user/bitcoind.service <<EOF
|
||||
[Unit]
|
||||
Description=Bitcoin Core (Podman)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/podman stop bitcoind
|
||||
ExecStartPre=-/usr/bin/podman rm bitcoind
|
||||
ExecStart=/usr/bin/podman run --name bitcoind \\
|
||||
--rm \\
|
||||
-v ${BITCOIN_DATA}:/data/.bitcoin:Z \\
|
||||
-p 8332:8332 \\
|
||||
-p 8333:8333 \\
|
||||
docker.io/lncm/bitcoind:v27.0
|
||||
ExecStop=/usr/bin/podman stop bitcoind
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
echo "📋 Created systemd service"
|
||||
echo ""
|
||||
|
||||
# Enable and start service
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable bitcoind.service
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ ✅ BITCOIN CORE SETUP COMPLETE! ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " Start: systemctl --user start bitcoind"
|
||||
echo " Stop: systemctl --user stop bitcoind"
|
||||
echo " Status: systemctl --user status bitcoind"
|
||||
echo " Logs: podman logs -f bitcoind"
|
||||
echo ""
|
||||
echo "Bitcoin CLI:"
|
||||
echo " podman exec bitcoind bitcoin-cli -getinfo"
|
||||
echo ""
|
||||
echo "RPC Credentials (save these!):"
|
||||
echo " User: $RPC_USER"
|
||||
echo " Pass: $RPC_PASS"
|
||||
echo ""
|
||||
|
||||
read -p "Start Bitcoin Core now? [Y/n]: " START_NOW
|
||||
if [[ ! "$START_NOW" =~ ^[Nn]$ ]]; then
|
||||
echo ""
|
||||
echo "🚀 Starting Bitcoin Core..."
|
||||
systemctl --user start bitcoind
|
||||
echo ""
|
||||
echo "Bitcoin Core is syncing. This will take several hours/days."
|
||||
echo "Monitor with: podman logs -f bitcoind"
|
||||
fi
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# LND (Lightning Network Daemon) Setup Script for Archipelago
|
||||
# Sets up LND in a Podman container
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ ⚡ LND (LIGHTNING) SETUP ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check for Podman
|
||||
if ! command -v podman >/dev/null 2>&1; then
|
||||
echo "❌ Podman not found. Please run setup-bitcoin.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Bitcoin Core is running
|
||||
if ! podman ps | grep -q bitcoind; then
|
||||
echo "⚠️ Bitcoin Core is not running."
|
||||
echo " LND requires a synced Bitcoin Core node."
|
||||
read -p "Continue anyway? [y/N]: " CONTINUE
|
||||
if [[ ! "$CONTINUE" =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create data directory
|
||||
LND_DATA="${HOME}/.lnd"
|
||||
mkdir -p "$LND_DATA"
|
||||
|
||||
echo "📍 LND data directory: $LND_DATA"
|
||||
echo ""
|
||||
|
||||
# Get Bitcoin RPC credentials
|
||||
BITCOIN_CONF="${HOME}/.bitcoin/bitcoin.conf"
|
||||
if [ -f "$BITCOIN_CONF" ]; then
|
||||
RPC_USER=$(grep "^rpcuser=" "$BITCOIN_CONF" | cut -d= -f2)
|
||||
RPC_PASS=$(grep "^rpcpassword=" "$BITCOIN_CONF" | cut -d= -f2)
|
||||
else
|
||||
read -p "Bitcoin RPC username: " RPC_USER
|
||||
read -p "Bitcoin RPC password: " RPC_PASS
|
||||
fi
|
||||
|
||||
# Ask for LND configuration
|
||||
echo "LND Configuration:"
|
||||
echo ""
|
||||
read -p "Node alias (public name): " LND_ALIAS
|
||||
LND_ALIAS=${LND_ALIAS:-archipelago-node}
|
||||
|
||||
# Create lnd.conf
|
||||
cat > "$LND_DATA/lnd.conf" <<EOF
|
||||
# Archipelago LND Configuration
|
||||
|
||||
[Application Options]
|
||||
alias=$LND_ALIAS
|
||||
color=#FF9900
|
||||
listen=0.0.0.0:9735
|
||||
rpclisten=0.0.0.0:10009
|
||||
restlisten=0.0.0.0:8080
|
||||
|
||||
# Automatically unlock wallet (create password file after first run)
|
||||
# wallet-unlock-password-file=/data/.lnd/password.txt
|
||||
|
||||
[Bitcoin]
|
||||
bitcoin.active=true
|
||||
bitcoin.mainnet=true
|
||||
bitcoin.node=bitcoind
|
||||
|
||||
[Bitcoind]
|
||||
bitcoind.rpchost=host.containers.internal:8332
|
||||
bitcoind.rpcuser=$RPC_USER
|
||||
bitcoind.rpcpass=$RPC_PASS
|
||||
bitcoind.zmqpubrawblock=tcp://host.containers.internal:28332
|
||||
bitcoind.zmqpubrawtx=tcp://host.containers.internal:28333
|
||||
|
||||
[tor]
|
||||
tor.active=false
|
||||
|
||||
[wtclient]
|
||||
wtclient.active=true
|
||||
EOF
|
||||
|
||||
echo "📋 Created lnd.conf"
|
||||
echo ""
|
||||
|
||||
# Pull LND image
|
||||
echo "🐳 Pulling LND container image..."
|
||||
podman pull docker.io/lightninglabs/lnd:v0.18.0-beta
|
||||
|
||||
# Create systemd user service for LND
|
||||
mkdir -p ~/.config/systemd/user
|
||||
|
||||
cat > ~/.config/systemd/user/lnd.service <<EOF
|
||||
[Unit]
|
||||
Description=LND Lightning Network Daemon (Podman)
|
||||
After=bitcoind.service
|
||||
Requires=bitcoind.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/podman stop lnd
|
||||
ExecStartPre=-/usr/bin/podman rm lnd
|
||||
ExecStart=/usr/bin/podman run --name lnd \\
|
||||
--rm \\
|
||||
--add-host=host.containers.internal:host-gateway \\
|
||||
-v ${LND_DATA}:/data/.lnd:Z \\
|
||||
-p 9735:9735 \\
|
||||
-p 10009:10009 \\
|
||||
-p 8080:8080 \\
|
||||
docker.io/lightninglabs/lnd:v0.18.0-beta \\
|
||||
--configfile=/data/.lnd/lnd.conf
|
||||
ExecStop=/usr/bin/podman stop lnd
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
echo "📋 Created systemd service"
|
||||
echo ""
|
||||
|
||||
# Enable service
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable lnd.service
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ ✅ LND SETUP COMPLETE! ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " Start: systemctl --user start lnd"
|
||||
echo " Stop: systemctl --user stop lnd"
|
||||
echo " Status: systemctl --user status lnd"
|
||||
echo " Logs: podman logs -f lnd"
|
||||
echo ""
|
||||
echo "LND CLI:"
|
||||
echo " podman exec lnd lncli --network=mainnet getinfo"
|
||||
echo ""
|
||||
echo "⚠️ IMPORTANT: On first start, you need to create a wallet:"
|
||||
echo " 1. Start LND: systemctl --user start lnd"
|
||||
echo " 2. Create wallet: podman exec -it lnd lncli create"
|
||||
echo " 3. Save your seed phrase securely!"
|
||||
echo ""
|
||||
|
||||
read -p "Start LND now? [Y/n]: " START_NOW
|
||||
if [[ ! "$START_NOW" =~ ^[Nn]$ ]]; then
|
||||
echo ""
|
||||
echo "🚀 Starting LND..."
|
||||
systemctl --user start lnd
|
||||
sleep 3
|
||||
echo ""
|
||||
echo "LND is starting. Create your wallet with:"
|
||||
echo " podman exec -it lnd lncli create"
|
||||
fi
|
||||
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simple API server for Archipelago Web UI
|
||||
Serves static files and handles basic API endpoints
|
||||
"""
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
import json
|
||||
import os
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
||||
PORT = 80
|
||||
WEB_DIR = None
|
||||
|
||||
# Find web UI directory
|
||||
for path in ['/opt/archipelago/web-ui', '/run/live/medium/archipelago/web-ui', '/lib/live/mount/medium/archipelago/web-ui']:
|
||||
if os.path.isdir(path):
|
||||
WEB_DIR = path
|
||||
break
|
||||
|
||||
if not WEB_DIR:
|
||||
print("Web UI directory not found!")
|
||||
exit(1)
|
||||
|
||||
os.chdir(WEB_DIR)
|
||||
|
||||
class ArchipelagoHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
"""Handle POST requests with mock responses"""
|
||||
content_length = int(self.headers.get('Content-Length', 0))
|
||||
post_data = self.rfile.read(content_length) if content_length > 0 else b''
|
||||
|
||||
path = urlparse(self.path).path
|
||||
|
||||
# Mock API responses
|
||||
response = {"success": True}
|
||||
|
||||
if '/api/auth' in path or '/auth' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"token": "mock-token-12345",
|
||||
"user": "archipelago"
|
||||
}
|
||||
elif '/api/setup' in path or '/setup' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"status": "complete"
|
||||
}
|
||||
elif '/api/status' in path or '/status' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"status": "running",
|
||||
"version": "0.1.0",
|
||||
"hostname": "archipelago"
|
||||
}
|
||||
elif '/api/apps' in path or '/apps' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"apps": []
|
||||
}
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', 'application/json')
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(response).encode())
|
||||
|
||||
def do_OPTIONS(self):
|
||||
"""Handle CORS preflight"""
|
||||
self.send_response(200)
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
|
||||
self.send_header('Access-Control-Allow-Headers', 'Content-Type, Authorization')
|
||||
self.end_headers()
|
||||
|
||||
def do_GET(self):
|
||||
"""Handle GET requests - serve files or API"""
|
||||
path = urlparse(self.path).path
|
||||
|
||||
if path.startswith('/api/'):
|
||||
# Mock API GET endpoints
|
||||
response = {"success": True}
|
||||
|
||||
if '/status' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"status": "running",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
elif '/apps' in path:
|
||||
response = {
|
||||
"success": True,
|
||||
"apps": [
|
||||
{"id": "bitcoin", "name": "Bitcoin Core", "status": "available"},
|
||||
{"id": "lnd", "name": "Lightning (LND)", "status": "available"}
|
||||
]
|
||||
}
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', 'application/json')
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(response).encode())
|
||||
else:
|
||||
# Serve static files, default to index.html for SPA routing
|
||||
if not os.path.exists(self.translate_path(self.path)) or path == '/':
|
||||
self.path = '/index.html'
|
||||
super().do_GET()
|
||||
|
||||
def log_message(self, format, *args):
|
||||
"""Quieter logging"""
|
||||
if '404' in str(args) or 'error' in str(args).lower():
|
||||
print(f" {args[0]}")
|
||||
|
||||
print(f"""
|
||||
╔═══════════════════════════════════════════════════════════╗
|
||||
║ 🏝️ ARCHIPELAGO WEB UI ║
|
||||
╚═══════════════════════════════════════════════════════════╝
|
||||
|
||||
Serving from: {WEB_DIR}
|
||||
|
||||
🌐 Open in your browser: http://localhost:{PORT}
|
||||
|
||||
Press Ctrl+C to stop
|
||||
""")
|
||||
|
||||
with socketserver.TCPServer(("0.0.0.0", PORT), ArchipelagoHandler) as httpd:
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\nShutting down...")
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Start Archipelago Backend Server
|
||||
# Serves the Vue.js UI and handles all API calls
|
||||
#
|
||||
|
||||
# Find archipelago binary
|
||||
ARCHIPELAGO_BIN=""
|
||||
for path in /usr/local/bin/archipelago /opt/archipelago/bin/archipelago /run/live/medium/archipelago/bin/archipelago; do
|
||||
if [ -x "$path" ]; then
|
||||
ARCHIPELAGO_BIN="$path"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get IP address
|
||||
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
if [ -z "$IP" ]; then
|
||||
IP="localhost"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════╗"
|
||||
echo "║ 🏝️ ARCHIPELAGO BITCOIN NODE OS ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo " Starting Archipelago server..."
|
||||
echo ""
|
||||
echo " ┌─────────────────────────────────────────────────────────┐"
|
||||
echo " │ │"
|
||||
echo " │ 🌐 OPEN IN YOUR BROWSER: │"
|
||||
echo " │ │"
|
||||
echo " │ http://$IP "
|
||||
echo " │ │"
|
||||
echo " └─────────────────────────────────────────────────────────┘"
|
||||
echo ""
|
||||
|
||||
if [ -n "$ARCHIPELAGO_BIN" ]; then
|
||||
echo " Using backend: $ARCHIPELAGO_BIN"
|
||||
echo " Press Ctrl+C to stop"
|
||||
echo ""
|
||||
|
||||
# Set environment for dev mode
|
||||
export ARCHIPELAGO_DEV_MODE=true
|
||||
export ARCHIPELAGO_DATA_DIR=/var/lib/archipelago
|
||||
export RUST_LOG=info
|
||||
|
||||
# Create data directory
|
||||
sudo mkdir -p /var/lib/archipelago 2>/dev/null
|
||||
|
||||
exec "$ARCHIPELAGO_BIN"
|
||||
else
|
||||
echo " ⚠️ Backend binary not found, using static file server"
|
||||
echo ""
|
||||
|
||||
# Fallback to static file server
|
||||
WEB_UI_DIR=""
|
||||
for path in /opt/archipelago/web-ui /run/live/medium/archipelago/web-ui; do
|
||||
if [ -d "$path" ]; then
|
||||
WEB_UI_DIR="$path"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$WEB_UI_DIR" ]; then
|
||||
cd "$WEB_UI_DIR"
|
||||
exec python3 -m http.server 80 --bind 0.0.0.0
|
||||
else
|
||||
echo "❌ Neither backend nor web UI found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user