# 🚀 Lion POS - Quick Start Guide

## Two Deployment Options Ready

Your project is now configured for **both localhost and cPanel deployment**. 

---

## 📱 OPTION 1: Run on Localhost (Recommended for Development)

### Quick Start (Automated)

```bash
cd /Users/joshua/Downloads/Lion\ POS\ v3.5
bash start-localhost.sh
```

This will automatically:
- ✅ Start Docker containers (MySQL, Redis, Laravel)
- ✅ Install PHP dependencies
- ✅ Create database and run migrations
- ✅ Install frontend assets
- ✅ Cache configuration

### Manual Setup (If Script Fails)

```bash
# Start containers
docker-compose up -d

# Wait 15 seconds, then run:
composer install
php artisan migrate
npm install && npm run dev
```

### Access Points

| Service | URL | Credentials |
|---------|-----|-------------|
| **Application** | http://localhost | - |
| **PHPMyAdmin** | http://localhost:8080 | root/laravel |
| **Mailhog** (Email) | http://localhost:8025 | - |

### Stop Development

```bash
docker-compose down
```

---

## 🌐 OPTION 2: Deploy on cPanel (lion.kivulakebreezeguesthouse.com)

### Step 1: Prepare cPanel

1. Login to cPanel: `https://lion.kivulakebreezeguesthouse.com:2083`
2. Create a **MySQL database**:
   - Go to **MySQL Databases**
   - Create database name: `lion_pos_prod` (or your choice)
   - Create user with password
   - Grant all privileges to user
3. Note your credentials:
   - Database name
   - Database username
   - Database password

### Step 2: Upload Project Files

**Option A: Using SSH (Recommended)**

```bash
# SSH into your cPanel server
ssh username@lion.kivulakebreezeguesthouse.com

# Navigate to your domain directory
cd ~/public_html

# Clone or upload your project
# If using Git: git clone your-repo-url .
# If using FTP: Use an FTP client to upload all files
```

**Option B: Using FTP/SFTP**

1. Use FileZilla or similar FTP client
2. Connect with your cPanel credentials
3. Upload all files to `public_html` folder
4. Skip: `.env`, `vendor/`, `node_modules/`

### Step 3: Deploy Using Provided Script

```bash
# Via SSH on your cPanel server:
cd ~/public_html
bash deploy-cpanel.sh

# When prompted, enter:
# - Your database name
# - Your database username
# - Your database password
# - Your domain: lion.kivulakebreezeguesthouse.com
# - Your email address
```

### Step 4: Configure Domain

In cPanel **Addon Domains** or **Domains**:
- Ensure document root points to: `public_html/public`
- (This is critical for Laravel!)

### Step 5: Enable HTTPS

1. In cPanel, look for **AutoSSL** or **SSL/TLS**
2. Install certificate for your domain
3. Update APP_URL in .env to use `https://`

### Access Your Live App

```
https://lion.kivulakebreezeguesthouse.com
```

---

## 🔧 Troubleshooting

### Localhost Issues

**Docker containers won't start:**
```bash
docker-compose down
docker-compose up -d --build
```

**Database connection error:**
```bash
docker-compose logs mysql
docker-compose exec mysql mysql -u root -p lion_pos_local
```

**Clear cache and restart:**
```bash
php artisan cache:clear
php artisan config:clear
docker-compose restart
```

### cPanel Issues

**"500 Error" or "Laravel not found":**
1. Check `.env` file exists and has correct DB credentials
2. Check `storage/logs/laravel.log` for detailed errors
3. Verify `public_html/public` is set as document root

**"Permission denied" on storage:**
```bash
ssh username@lion.kivulakebreezeguesthouse.com
cd ~/public_html
chmod -R 777 storage/ bootstrap/cache/
```

**Database migration fails:**
1. Verify database exists in cPanel
2. Verify user has all privileges
3. Check credentials in `.env` match cPanel

---

## 📚 More Information

- **Full Deployment Guide**: See `DEPLOYMENT_GUIDE.md`
- **API Documentation**: See `DOCS.html`
- **Laravel Docs**: https://laravel.com/docs
- **Docker Docs**: https://docs.docker.com

---

## ⚡ Quick Commands

### Localhost Development
```bash
docker-compose up -d              # Start
docker-compose down               # Stop
docker-compose logs -f            # View logs
php artisan tinker               # Interactive shell
npm run watch                    # Watch frontend changes
```

### cPanel Production
```bash
php artisan migrate              # Run migrations
php artisan cache:clear          # Clear cache
php artisan optimize             # Optimize application
tail -f storage/logs/laravel.log # View logs
```

---

## ✅ Checklist

### Before Running Localhost
- [ ] Docker Desktop is installed and running
- [ ] Have at least 2GB free disk space
- [ ] Port 80 is available (or modify docker-compose.yml)

### Before Deploying to cPanel
- [ ] cPanel credentials ready
- [ ] FTP/SSH access available
- [ ] Database created in cPanel
- [ ] Domain points to your cPanel server

---

## 🎯 Next Steps

1. **Start Localhost:**
   ```bash
   bash start-localhost.sh
   ```

2. **Or Deploy to cPanel:**
   - Upload files via FTP
   - Run: `bash deploy-cpanel.sh`

3. **Test Your Application**
   - Visit the application URL
   - Create test orders/data
   - Monitor logs for errors

---

**Need Help?** Check `DEPLOYMENT_GUIDE.md` for detailed troubleshooting.
