Rocky_Mountain_Vending/workers/deploy.sh
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

84 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
# Deployment script for Cloudflare Workers
# This script helps deploy the API worker to Cloudflare
set -e
echo "🚀 Deploying Rocky Mountain Vending API Worker to Cloudflare"
echo ""
# Check if wrangler is installed
if ! command -v wrangler &> /dev/null; then
echo "❌ Wrangler CLI not found. Please install it:"
echo " npm install -g wrangler"
exit 1
fi
# Check if logged in
if ! wrangler whoami &> /dev/null; then
echo "❌ Not logged in to Cloudflare. Please run:"
echo " wrangler login"
exit 1
fi
echo "✅ Wrangler CLI found and authenticated"
echo ""
# Check if buckets exist
echo "📦 Checking R2 buckets..."
if ! wrangler r2 bucket list | grep -q "vending-vm-manuals"; then
echo "⚠️ Manuals bucket not found. Creating..."
wrangler r2 bucket create vending-vm-manuals
echo "✅ Created vending-vm-manuals bucket"
else
echo "✅ Manuals bucket exists"
fi
if ! wrangler r2 bucket list | grep -q "vending-vm-thumbnails"; then
echo "⚠️ Thumbnails bucket not found. Creating..."
wrangler r2 bucket create vending-vm-thumbnails
echo "✅ Created vending-vm-thumbnails bucket"
else
echo "✅ Thumbnails bucket exists"
fi
echo ""
# Determine environment
ENV=${1:-production}
echo "🌍 Deploying to: $ENV environment"
echo ""
# Deploy worker
if [ "$ENV" = "development" ]; then
echo "📤 Deploying to development..."
wrangler deploy --env development
else
echo "📤 Deploying to production..."
wrangler deploy
fi
echo ""
echo "✅ Deployment complete!"
echo ""
echo "Worker URL:"
if [ "$ENV" = "development" ]; then
echo " https://rocky-mountain-vending-api-dev.matt-bd6.workers.dev"
else
echo " https://rocky-mountain-vending-api.matt-bd6.workers.dev"
fi
echo ""
echo "Test the deployment:"
echo " curl https://rocky-mountain-vending-api.matt-bd6.workers.dev/health"
echo ""