# Vision Videoke - Customer Setup Guide

## Welcome to Vision Videoke! 🎬🎵

Thank you for choosing Vision Videoke, the revolutionary platform that transforms vision boards into personalized music videos with karaoke lyrics. This guide will help you get your platform up and running on Amazon Web Services (AWS) in just a few simple steps.

## What You'll Get

Once set up, your Vision Videoke platform will allow users to:
- ✅ Upload vision boards (3-10 images)
- ✅ Generate AI-powered lyrics from their images
- ✅ Create custom music with Udio AI
- ✅ Produce slideshow music videos with karaoke lyrics
- ✅ Clone voices for personalized singing
- ✅ Export videos for social media sharing

## Before You Start

### What You'll Need

**1. AWS Account**
- Active Amazon Web Services account
- Credit card for billing (you'll only pay for what you use)
- Basic familiarity with AWS console

**2. Domain Name**
- A domain name you own (e.g., yourmusicsite.com)
- Access to your domain's DNS settings

**3. API Keys** (Required for full functionality)
- **OpenAI API Key** - For AI lyric generation ([Get it here](https://platform.openai.com/api-keys))
- **Udio API Key** - For music generation ([Get it here](https://udio.com/api))
- **ElevenLabs API Key** - For voice cloning ([Get it here](https://elevenlabs.io/api))
- **Stripe Keys** - For payments (optional) ([Get them here](https://dashboard.stripe.com/apikeys))

**4. Technical Requirements**
- Email address for SSL certificate
- About 30-60 minutes for complete setup

### Estimated Costs

**AWS Costs (Monthly):**
- EC2 t3.medium instance: ~$30-40/month
- Storage (20GB): ~$2/month
- Data transfer: ~$5-15/month (depending on usage)
- **Total AWS Cost: ~$40-60/month**

**API Costs (Usage-based):**
- OpenAI: ~$0.01-0.10 per song
- Udio: ~$0.50-2.00 per song
- ElevenLabs: ~$0.10-0.50 per voice clone
- **Total API Cost: ~$0.60-2.60 per song created**

## Step-by-Step Setup

### Step 1: Set Up Your AWS EC2 Instance

**1.1 Log into AWS Console**
- Go to [aws.amazon.com](https://aws.amazon.com)
- Sign in to your AWS account
- Navigate to EC2 service

**1.2 Launch New Instance**
- Click "Launch Instance"
- **Name**: VisionVideoke-Production
- **Application and OS Images**: Amazon Linux 2 AMI (HVM), SSD Volume Type
- **Instance type**: t3.medium (recommended minimum)
- **Key pair**: Create new key pair or use existing one
  - Download and save the .pem file securely
- **Network settings**: 
  - Allow SSH traffic from: Your IP address
  - Allow HTTPS traffic from the internet: ✅
  - Allow HTTP traffic from the internet: ✅

**1.3 Configure Storage**
- **Size**: 20 GB minimum (30 GB recommended)
- **Volume type**: gp3 (recommended)

**1.4 Launch Instance**
- Review settings and click "Launch instance"
- Wait for instance to be in "running" state
- Note down the **Public IPv4 address**

### Step 2: Configure Your Domain

**2.1 Point Domain to Your Server**

**If using Route 53 (AWS DNS):**
1. Go to Route 53 in AWS console
2. Select your hosted zone
3. Create new record:
   - **Record name**: @ (for root domain) or www
   - **Record type**: A
   - **Value**: Your EC2 instance's public IP address
   - **TTL**: 300

**If using other DNS providers (GoDaddy, Namecheap, etc.):**
1. Log into your domain registrar
2. Find DNS management section
3. Create A record:
   - **Host**: @ or www
   - **Points to**: Your EC2 instance's public IP address
   - **TTL**: 300 (or default)

**2.2 Wait for DNS Propagation**
- DNS changes can take up to 24 hours to propagate
- You can check status at [whatsmydns.net](https://www.whatsmydns.net)

### Step 3: Connect to Your Server

**3.1 Connect via SSH**

**On Windows (using PuTTY):**
1. Download PuTTY from [putty.org](https://www.putty.org)
2. Convert your .pem key to .ppk format using PuTTYgen
3. Connect using:
   - **Host**: Your EC2 public IP
   - **Username**: ec2-user
   - **Private key**: Your .ppk file

**On Mac/Linux:**
```bash
# Make key file secure
chmod 400 your-key.pem

# Connect to server
ssh -i your-key.pem ec2-user@YOUR-EC2-PUBLIC-IP
```

### Step 4: Download and Run the Installer

**4.1 Download Installation Package**
```bash
# Download the installer (replace with actual download URL)
wget https://your-distribution-server.com/VisionVideoke-EC2-Installer-1.0.0.tar.gz

# Extract the package
tar -xzf VisionVideoke-EC2-Installer-1.0.0.tar.gz

# Enter the directory
cd VisionVideoke-EC2-Installer-1.0.0
```

**4.2 Run the One-Click Installer**
```bash
# Run the installer
./customer-installer.sh
```

**4.3 Follow the Installation Prompts**

The installer will ask you for:

1. **Domain name**: Enter your domain (e.g., yourmusicsite.com)
2. **Email address**: For SSL certificate (e.g., admin@yourmusicsite.com)
3. **API Keys**: Enter your API keys when prompted
   - OpenAI API Key
   - Udio API Key
   - ElevenLabs API Key
   - Stripe keys (optional)

**4.4 Wait for Installation to Complete**
- The installer will automatically:
  - Install all required software
  - Configure security settings
  - Set up SSL certificate
  - Deploy the application
  - Configure monitoring and backups

This process takes about 10-15 minutes.

### Step 5: Verify Your Installation

**5.1 Check Installation Status**
```bash
# Check if everything is running
./status.sh
```

**5.2 Test Your Website**
- Open your web browser
- Go to `https://yourdomain.com`
- You should see the Vision Videoke platform

**5.3 Test Application Health**
```bash
# Test application health
curl http://localhost:3000/health
```

Should return: `healthy`

## Post-Installation Configuration

### Update API Keys (Important!)

After installation, you may need to update your API keys:

```bash
# Edit the environment file
nano /var/www/visionvideoke/.env
```

Update these lines with your actual API keys:
```env
REACT_APP_OPENAI_API_KEY=your_actual_openai_key_here
REACT_APP_UDIO_API_KEY=your_actual_udio_key_here
REACT_APP_ELEVENLABS_API_KEY=your_actual_elevenlabs_key_here
```

Save the file (Ctrl+X, then Y, then Enter) and restart the application:
```bash
pm2 restart all
```

### Configure Payment Processing (Optional)

If you want to accept payments:

1. **Set up Stripe account** at [stripe.com](https://stripe.com)
2. **Get your API keys** from Stripe dashboard
3. **Update environment file**:
   ```bash
   nano /var/www/visionvideoke/.env
   ```
4. **Add Stripe keys**:
   ```env
   REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_live_your_stripe_key
   STRIPE_SECRET_KEY=sk_live_your_stripe_secret
   ```
5. **Restart application**:
   ```bash
   pm2 restart all
   ```

## Managing Your Platform

### Daily Management Commands

```bash
# Check system status
./status.sh

# View application logs
pm2 logs

# Restart application
pm2 restart all

# Create backup
./backup.sh

# Check SSL certificate
sudo certbot certificates
```

### Updating Your Application

When you receive application updates:

```bash
# Upload new application files to /tmp/visionvideoke-update/
# Then run:
./update-app.sh
```

### Monitoring Your Platform

**Check Application Status:**
```bash
pm2 status
```

**View Real-time Logs:**
```bash
pm2 logs --lines 50
```

**Monitor System Resources:**
```bash
htop  # Press 'q' to quit
```

**Check Disk Space:**
```bash
df -h
```

## Troubleshooting Common Issues

### Issue: Website Not Loading

**Check 1: Is the application running?**
```bash
pm2 status
```
If not running: `pm2 restart all`

**Check 2: Is Nginx running?**
```bash
sudo systemctl status nginx
```
If not running: `sudo systemctl start nginx`

**Check 3: DNS propagation**
- Check if your domain points to the correct IP
- Use [whatsmydns.net](https://www.whatsmydns.net) to verify

### Issue: SSL Certificate Problems

**Check certificate status:**
```bash
sudo certbot certificates
```

**Renew certificate manually:**
```bash
sudo certbot renew
```

**If certificate failed during installation:**
```bash
./setup-ssl.sh yourdomain.com your-email@domain.com
```

### Issue: API Keys Not Working

**Check environment file:**
```bash
cat /var/www/visionvideoke/.env | grep API_KEY
```

**Update API keys:**
```bash
nano /var/www/visionvideoke/.env
# Update the keys, save, then:
pm2 restart all
```

**Test API connectivity:**
```bash
# Test OpenAI API
curl -H "Authorization: Bearer YOUR_OPENAI_KEY" https://api.openai.com/v1/models
```

### Issue: High Memory Usage

**Check memory usage:**
```bash
free -h
pm2 monit
```

**Restart with memory limit:**
```bash
pm2 restart all --max-memory-restart 1G
```

### Issue: Application Errors

**View error logs:**
```bash
pm2 logs --err
tail -f /var/log/visionvideoke/error.log
```

**Check Nginx errors:**
```bash
sudo tail -f /var/log/nginx/error.log
```

## Getting Help

### Self-Help Resources

1. **Check status first**: `./status.sh`
2. **View logs**: `pm2 logs`
3. **Check documentation**: Files in `docs/` directory
4. **Search error messages**: Copy exact error messages for web search

### Log Collection for Support

If you need to contact support, collect logs first:

```bash
# Create support package
mkdir -p /tmp/support-logs
cp /var/log/visionvideoke/*.log /tmp/support-logs/ 2>/dev/null || true
sudo cp /var/log/nginx/*.log /tmp/support-logs/ 2>/dev/null || true
pm2 logs --lines 100 > /tmp/support-logs/pm2-logs.txt
./status.sh > /tmp/support-logs/status.txt
tar -czf support-logs-$(date +%Y%m%d).tar.gz -C /tmp support-logs/
```

### Emergency Recovery

If your platform becomes completely unresponsive:

1. **Reboot your EC2 instance** from AWS console
2. **Wait 2-3 minutes** for it to start up
3. **Connect via SSH** and run:
   ```bash
   ./status.sh
   pm2 restart all
   sudo systemctl restart nginx
   ```
4. **Check if it's working** by visiting your website

## Security Best Practices

### Regular Maintenance

**Weekly:**
- Check application status: `./status.sh`
- Review error logs: `pm2 logs --err`
- Monitor disk space: `df -h`

**Monthly:**
- Update system packages: `sudo yum update -y`
- Review access logs: `sudo tail -100 /var/log/nginx/access.log`
- Check SSL certificate expiry: `sudo certbot certificates`

### Security Recommendations

1. **Keep API keys secure** - Never share them publicly
2. **Regular backups** - Automated daily, but create manual backups before major changes
3. **Monitor access logs** - Watch for unusual activity
4. **Update regularly** - Apply security updates promptly
5. **Strong passwords** - Use complex passwords for all accounts

## Scaling Your Platform

### When to Scale Up

Consider upgrading your EC2 instance if you experience:
- High CPU usage (>80% consistently)
- High memory usage (>80% consistently)
- Slow response times
- Frequent application restarts

### How to Scale Up

1. **Stop your EC2 instance** from AWS console
2. **Change instance type** (t3.medium → t3.large → t3.xlarge)
3. **Start the instance**
4. **No configuration changes needed** - everything will work automatically

### Advanced Scaling

For high-traffic deployments, consider:
- **Load balancer** with multiple servers
- **Database server** (RDS) for user management
- **CDN** (CloudFront) for faster content delivery
- **Auto-scaling** for automatic capacity management

## Congratulations! 🎉

You've successfully set up your Vision Videoke platform! Your users can now:

- Transform their vision boards into personalized music videos
- Create custom songs with AI-powered lyrics
- Clone their voices for singing
- Share their creations on social media

### What's Next?

1. **Test the platform** with sample vision boards
2. **Configure payment processing** if needed
3. **Customize branding** and styling
4. **Set up user accounts** and management
5. **Launch your marketing** campaigns

### Support and Resources

- **Documentation**: Complete guides in the `docs/` directory
- **Status monitoring**: Use `./status.sh` regularly
- **Backup system**: Automated daily backups configured
- **SSL certificates**: Auto-renewal configured
- **Security**: Firewall and intrusion prevention configured

**Welcome to the future of personalized music creation!** 🎵🎬✨

---

*This guide was created for Vision Videoke v1.0.0. For the latest updates and additional resources, check the documentation in your installation directory.*

