lumina/deploy.sh
2025-11-29 23:13:05 +03:00

116 lines
4.0 KiB
Bash
Executable File

#!/bin/bash
set -e
# CHANGE THESE TWO LINES
DOMAIN="lumina.yourname.com" # your real domain
EMAIL="you@gmail.com" # your email
echo "๐Ÿš€ Deploying Lumina 3D Explorer to https://$DOMAIN"
echo ""
# 1. Create directories
echo "๐Ÿ“ Creating directories..."
mkdir -p ui/public api ssl
echo "โœ… Directories created"
echo ""
# 2. Build frontend if not already built
echo "๐Ÿ”จ Building frontend..."
if [ ! -d "ui/public" ] || [ -z "$(ls -A ui/public 2>/dev/null)" ]; then
cd ui
if command -v pnpm &> /dev/null; then
pnpm install
pnpm build
elif command -v npm &> /dev/null; then
npm install
npm run build
else
echo "โŒ Error: pnpm or npm not found. Please install Node.js and pnpm."
exit 1
fi
cd ..
echo "โœ… Frontend built"
else
echo "โœ… Frontend already built"
fi
echo ""
# 3. Verify build output exists
if [ ! -d "ui/public" ] || [ -z "$(ls -A ui/public)" ]; then
echo "โŒ Error: Frontend build failed. ui/public directory is empty."
exit 1
fi
# 4. Update nginx.conf with domain
echo "๐Ÿ“ Updating nginx configuration..."
sed -i.bak "s/YOUR_DOMAIN/$DOMAIN/g" nginx.conf
echo "โœ… Nginx config updated"
echo ""
# 5. Get SSL certificates
echo "๐Ÿ”’ Setting up SSL certificates..."
if [ ! -f "ssl/live/$DOMAIN/fullchain.pem" ]; then
echo " Requesting new certificate (staging first for testing)..."
echo " Remove --staging in deploy.sh when ready for production cert"
# Start certbot container
docker compose -f docker-compose.prod.yml up -d certbot
# Request certificate (staging first - remove --staging for production)
docker compose -f docker-compose.prod.yml run --rm certbot certonly --webroot \
-w /var/www/html \
-d $DOMAIN \
--email $EMAIL \
--agree-tos \
--non-interactive \
--staging || echo "โš ๏ธ Certificate request may have failed. Check DNS and ports 80/443."
echo "โœ… SSL certificates configured"
echo " โš ๏ธ Using STAGING certificate. Remove --staging flag for production!"
else
echo "โœ… SSL certificates already exist"
fi
echo ""
# 6. Start all services
echo "๐Ÿณ Starting Docker containers..."
docker compose -f docker-compose.prod.yml up -d
echo "โœ… Containers started"
echo ""
# 7. Wait for services to be ready
echo "โณ Waiting for services to start..."
sleep 10
echo "โœ… Services ready"
echo ""
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
echo "๐ŸŽ‰ LUMINA 3D IS LIVE!"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
echo ""
echo "๐Ÿ“ URL: https://$DOMAIN"
echo ""
echo "โœจ Features:"
echo " โ€ข Real top assets (XLM, USDC, AQUA first)"
echo " โ€ข Real liquidity pools sorted by TVL (no more FNV garbage)"
echo " โ€ข No runtime errors"
echo " โ€ข Soroban stats + charts"
echo " โ€ข 3D view with whales, pools, validators"
echo " โ€ข Auto-renewing free HTTPS"
echo ""
echo "๐Ÿ“Š All pages working:"
echo " โ€ข Assets โ€ข Pools โ€ข Soroban โ€ข 3D โ€ข Whales โ€ข Validators"
echo ""
echo "๐Ÿ”ง Management commands:"
echo " โ€ข View logs: docker compose -f docker-compose.prod.yml logs -f"
echo " โ€ข Stop: docker compose -f docker-compose.prod.yml down"
echo " โ€ข Restart: docker compose -f docker-compose.prod.yml restart"
echo ""
echo "๐Ÿ”’ For production SSL (after testing):"
echo " 1. Edit deploy.sh"
echo " 2. Remove '--staging' from certbot command"
echo " 3. Run: docker compose -f docker-compose.prod.yml run --rm certbot certonly --webroot -w /var/www/html -d $DOMAIN --email $EMAIL --agree-tos --non-interactive"
echo ""
echo "Welcome to legend status! ๐Ÿš€"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"