# 🚀 Server Sync Configuration Guide

## 🔧 **Quick Setup (3 Steps)**

### **Step 1: Get Your Server Details**

You need these details from your server:
- **Server IP or Domain**: e.g., `192.168.1.100` or `canaccom.com`
- **Username**: Your server login username
- **SSH Access**: Make sure you can connect via SSH

### **Step 2: Configure Sync Script**

Edit `sync-to-server.sh` and update these lines:

```bash
# Change these to your actual server details:
SERVER_USER="your-username"        # Your server username
SERVER_HOST="your-server-ip"      # Your server IP or domain
SERVER_PATH="/var/www/html/canaccom"  # Where files go on server
```

**Example:**
```bash
SERVER_USER="ubuntu"
SERVER_HOST="canaccom.com"
SERVER_PATH="/var/www/html/canaccom"
```

### **Step 3: Test Connection**

```bash
# Test SSH connection
ssh your-username@your-server-ip

# Test sync script
./sync-to-server.sh -c
```

## 🎯 **Sync Commands**

### **Safe Sync (Development)**
```bash
./sync-to-server.sh
```

### **Full Sync (Production)**
```bash
./sync-to-server.sh full
```

### **Quick Updates**
```bash
# CSS only
./sync-to-server.sh css-only

# JavaScript only
./sync-to-server.sh js-only
```

### **Test What Would Be Synced**
```bash
./sync-to-server.sh -d
```

## 🔒 **SSH Key Setup (Recommended)**

### **Generate SSH Key (if needed)**
```bash
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
```

### **Copy Key to Server**
```bash
ssh-copy-id your-username@your-server-ip
```

### **Test Passwordless Login**
```bash
ssh your-username@your-server-ip
```

## 📋 **Server Requirements**

Your server needs:
- **SSH access** enabled
- **Web server** (Apache/Nginx) installed
- **Proper permissions** for web directory
- **rsync** installed (usually pre-installed)

## 🚨 **Troubleshooting**

### **Connection Failed**
```bash
# Check SSH connection
ssh -v your-username@your-server-ip

# Verify server details
nano sync-to-server.sh
```

### **Permission Denied**
```bash
# Make script executable
chmod +x sync-to-server.sh

# Check file permissions
ls -la sync-to-server.sh
```

### **Sync Failed**
```bash
# Run dry run to see issues
./sync-to-server.sh -d

# Check server directory exists
ssh your-username@your-server-ip "ls -la /var/www/html/"
```

## 🎉 **Ready to Sync!**

Once configured, you can sync all files with:

```bash
# First time setup
./server-config.sh setup

# Sync all files
./sync-to-server.sh
```

---

**Need Help?** Just provide your server details and I can help configure everything! 🚀 