soroban-abacus-flashcards/nas-deployment/deploy.sh

46 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Soroban Abacus Flashcards - NAS Deployment Script
# This script deploys the monorepo's apps/web to abaci.one
set -e
NAS_HOST="nas.home.network"
NAS_PATH="/volume1/homes/antialias/projects/abaci.one"
LOCAL_DIR="$(dirname "$0")"
echo "🚀 Deploying Soroban Abacus Flashcards to NAS..."
# Stop existing services
echo "📦 Stopping existing services..."
ssh "$NAS_HOST" "cd '$NAS_PATH' && docker-compose down || true"
# Copy deployment files
echo "📁 Copying deployment files..."
scp "$LOCAL_DIR/docker-compose.yaml" "$NAS_HOST:$NAS_PATH/"
scp "$LOCAL_DIR/.env" "$NAS_HOST:$NAS_PATH/" 2>/dev/null || echo "⚠️ No .env file found locally - using existing on NAS"
# Ensure DDNS config is in place (only if it doesn't exist)
ssh "$NAS_HOST" "mkdir -p '$NAS_PATH/ddns-data'"
scp "$LOCAL_DIR/ddns-data/ddns-config.json" "$NAS_HOST:$NAS_PATH/ddns-data/" 2>/dev/null || echo " Using existing DDNS config"
# Create required directories
echo "📂 Creating required directories..."
ssh "$NAS_HOST" "cd '$NAS_PATH' && mkdir -p public data uploads"
# Pull latest image and start services
echo "🐳 Starting services..."
ssh "$NAS_HOST" "cd '$NAS_PATH' && docker-compose pull && docker-compose up -d"
# Show status
echo "✅ Deployment complete!"
echo ""
echo "🌐 Services:"
echo " - Soroban Flashcards: https://abaci.one"
echo " - DDNS Web UI: http://$(ssh "$NAS_HOST" "hostname -I | awk '{print \$1}'"):8000"
echo ""
echo "📊 Check status:"
echo " ssh $NAS_HOST 'cd $NAS_PATH && docker-compose ps'"
echo ""
echo "📝 View logs:"
echo " ssh $NAS_HOST 'cd $NAS_PATH && docker-compose logs -f soroban-abacus-flashcards'"