# EzyGas Paperclip - Deployment Checklist & Setup Guide

## PRE-DEPLOYMENT REQUIREMENTS

Before you deploy, gather the following:

### ✓ **Hostinger VPS Access**
- [ ] SSH access to: `root@72.60.215.210`
- [ ] SSH password or key set up
- [ ] Server is running Ubuntu 24.04 with Docker installed

### ✓ **Anthropic API Key**
- [ ] You have a valid Claude API key
- [ ] Get it from: https://console.anthropic.com/api-keys
- [ ] You have quota/credits to run agents (budget: $1,950/month)
- [ ] You can generate new keys if current one is invalid

### ✓ **Domain Name (Optional but Recommended)**
- [ ] You own a domain (e.g., ezygas.company.com)
- [ ] You can modify DNS records
- [ ] Or you'll access via IP address initially (72.60.215.210)

### ✓ **All Deployment Files**
Make sure you have these files locally first:
- [ ] `docker-compose.yml`
- [ ] `nginx.conf`
- [ ] `backup.sh`
- [ ] `ezygas-config.json`
- [ ] `.env.template` → rename to `.env` and fill values
- [ ] `deploy.sh`

---

## STEP-BY-STEP DEPLOYMENT (30 minutes)

### **STEP 1: SSH into Your VPS**

```bash
# From your local machine
ssh root@72.60.215.210

# You'll be prompted for password (from Hostinger)
# Or if you set up SSH keys, it will use those

# Verify you're in the right place
uname -a
# Should show: Linux srv1378757.hstgr.cloud ... 24.04 ...
```

### **STEP 2: Create Deployment Directory**

```bash
# Create the main directory for EzyGas
mkdir -p /opt/ezygas
cd /opt/ezygas

# Create subdirectories
mkdir -p data/paperclip-config
mkdir -p backups
mkdir -p logs
mkdir -p ssl
mkdir -p html

# Verify structure
ls -la
# Should show: data/ backups/ logs/ ssl/ html/
```

### **STEP 3: Upload Configuration Files to VPS**

From your local machine (not inside SSH session), copy files to VPS:

```bash
# In your local terminal (where you have the files)
scp docker-compose.yml root@72.60.215.210:/opt/ezygas/
scp nginx.conf root@72.60.215.210:/opt/ezygas/
scp backup.sh root@72.60.215.210:/opt/ezygas/
scp ezygas-config.json root@72.60.215.210:/opt/ezygas/
scp .env.template root@72.60.215.210:/opt/ezygas/
scp deploy.sh root@72.60.215.210:/opt/ezygas/
scp DAY1_OPERATIONS_GUIDE.md root@72.60.215.210:/opt/ezygas/

# Verify files are there
ssh root@72.60.215.210 "ls -la /opt/ezygas/"
# Should show all files above
```

### **STEP 4: Create & Fill the .env File**

SSH back into the VPS:

```bash
ssh root@72.60.215.210
cd /opt/ezygas

# Create .env from template
cp .env.template .env

# Edit it with your values (use nano or vi)
nano .env
```

**Critical values to fill in:**

```bash
# Line ~19: Your Anthropic API key (REQUIRED)
ANTHROPIC_API_KEY=sk-ant-[YOUR-ACTUAL-KEY-HERE]

# Line ~7: A random secret key for Paperclip
PAPERCLIP_SECRET_KEY=your-32-character-random-secret-key-here
# Generate with: openssl rand -base64 32

# Line ~34-35: Database password (can leave as-is for initial setup, change later)
DB_PASSWORD=paperclip_secure_password

# Line ~60: Your domain name (optional, can use IP for now)
DOMAIN_NAME=72.60.215.210

# Lines ~64-73: Keep agent budgets as-is ($1,950/month total)

# Save the file: Ctrl+X, then Y, then Enter (in nano)
```

### **STEP 5: Make Scripts Executable**

```bash
cd /opt/ezygas
chmod +x backup.sh
chmod +x deploy.sh

# Verify
ls -la *.sh
# Should show: -rwxr-xr-x (executable)
```

### **STEP 6: Generate Self-Signed SSL Certificate**

```bash
cd /opt/ezygas

# Create a temporary SSL certificate for initial deployment
openssl req -x509 -newkey rsa:4096 -keyout ssl/key.pem -out ssl/cert.pem \
  -days 365 -nodes \
  -subj "/C=EG/ST=Cairo/L=Cairo/O=EzyGas/CN=localhost"

# Verify files were created
ls -la ssl/
# Should show: cert.pem and key.pem
```

### **STEP 7: Start Docker Containers**

```bash
cd /opt/ezygas

# Pull the latest Docker images
docker compose pull

# Build and start all services
docker compose up -d

# Watch the build process (takes 3-5 minutes)
docker compose logs -f

# Exit logs view with Ctrl+C once all services are "Up"
```

### **STEP 8: Verify All Services Are Running**

```bash
cd /opt/ezygas

# Check container status
docker compose ps

# Expected output:
# NAME                STATUS              PORTS
# ezygas-paperclip    Up (healthy)        0.0.0.0:3000->3000/tcp
# ezygas-postgres     Up (healthy)        5432/tcp
# ezygas-weaviate     Up (healthy)        0.0.0.0:8081->8080/tcp
# ezygas-nginx        Up (healthy)        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
# ezygas-backup       Up                  (no ports)

# If any show "Unhealthy" or "Exited", check logs:
docker compose logs [service-name]
```

### **STEP 9: Test Paperclip Dashboard**

Open your browser:

```
https://72.60.215.210
```

**You'll see:**
- SSL certificate warning (self-signed, that's OK)
- Click "Advanced" → "Proceed to localhost"
- Paperclip login page (default credentials set in .env)

### **STEP 10: Import EzyGas Configuration**

Inside Paperclip dashboard:

1. Go to **Settings** → **Company Setup**
2. Click **Import Configuration**
3. Select the `ezygas-config.json` file from `/opt/ezygas/`
4. Review the org chart:
   - CEO (oversight)
   - HR (team scaling)
   - Supply Chain (operations)
   - Government Relations (policy)
   - Content/Brand (narrative)
5. Click **Confirm & Import**

This creates all 6 agents, budgets, goals, and mission structure.

### **STEP 11: Enable Agent Heartbeats**

In the Paperclip dashboard:

1. Go to **Agents**
2. For each agent, click **Enable Heartbeat**
3. Verify the schedule (should be staggered):
   - CEO: Daily 6 AM
   - HR: Daily midnight
   - Supply Chain: Every hour
   - Gov Relations: Every 12 hours
   - Content/Brand: Every 6 hours

Once enabled, agents will begin executing on schedule.

### **STEP 12: Set Up Monitoring**

```bash
# Monitor logs in real-time as agents execute
ssh root@72.60.215.210
cd /opt/ezygas
docker compose logs -f paperclip

# You'll see agent execution logs as they run
# Use Ctrl+C to exit
```

---

## FINAL VERIFICATION CHECKLIST

After deployment, verify these checkpoints:

### **Infrastructure** ✓
- [ ] All 5 Docker containers running and healthy
- [ ] Paperclip dashboard accessible at https://72.60.215.210
- [ ] PostgreSQL database initialized
- [ ] Weaviate vector DB online
- [ ] Backup service running

### **Configuration** ✓
- [ ] .env file filled with real API key
- [ ] EzyGas company config imported
- [ ] All 6 agents visible in Agents view
- [ ] Agent budgets show correct monthly amounts ($1,950 total)
- [ ] Org chart matches expected structure

### **Operational Readiness** ✓
- [ ] Heartbeats enabled for all agents
- [ ] First agent execution completed (check logs)
- [ ] CEO generated first strategic briefing
- [ ] Budget tracking is active
- [ ] Backup service has run (check /opt/ezygas/backups/)

### **Resource Health** ✓
- [ ] CPU usage: 5-20% (not maxed)
- [ ] Memory usage: 3-4GB out of 8GB available
- [ ] Disk usage: < 50% of 100GB
- [ ] No error messages in logs (warnings OK)

---

## QUICK START: AGENT OBSERVATION

Once deployed, here's how to see your agents in action:

### **Watch Agent 1: Supply Chain (Runs Every Hour)**

```bash
ssh root@72.60.215.210
cd /opt/ezygas

# Wait until the next hour (e.g., if it's 14:30, wait until 15:00)
# Then run:
docker compose logs paperclip | grep "supply-chain" | tail -20

# You'll see:
# - Demand forecast for Year 1
# - Inventory planning
# - Capacity analysis
# - Cost tracking
```

### **Watch Agent 2: CEO (Runs Daily at 6 AM UTC)**

```bash
# Tomorrow morning at 6 AM Cairo time (5 AM UTC)
# Run:
docker compose logs paperclip | grep "agent-ceo" | tail -50

# You'll see strategic briefing covering:
# - 5-year mission status
# - Blockers identified
# - Recommended priorities
# - Budget report
```

### **View Agent Output in Dashboard**

1. Go to **Agents** view
2. Click on any agent card
3. See their recent tasks and outputs
4. Click **View Full Report** for detailed analysis

---

## TROUBLESHOOTING DURING DEPLOYMENT

### **Issue: Docker Compose Command Not Found**

```bash
# Docker is installed but compose plugin missing
apt-get update
apt-get install -y docker-compose-plugin

# Then try again:
docker compose ps
```

### **Issue: Permission Denied on Files**

```bash
# Make sure you're in the right directory
cd /opt/ezygas
ls -la

# Make scripts executable
chmod +x *.sh

# Or make all files writable
chmod 755 /opt/ezygas/*
```

### **Issue: API Key Invalid**

```bash
# Check if API key is correct
cat /opt/ezygas/.env | grep ANTHROPIC

# Verify it matches: https://console.anthropic.com/api-keys
# If wrong, update it:
nano /opt/ezygas/.env
# Fix the key, save
docker compose restart paperclip
```

### **Issue: Port Already in Use (Port 80/443)**

```bash
# Check what's using port 80/443
netstat -tlnp | grep -E ":80|:443"

# If something else is running:
# Option 1: Stop the other service
# Option 2: Change Nginx ports in docker-compose.yml:
#   ports: "8080:80" (then access via http://IP:8080)
```

### **Issue: Out of Disk Space**

```bash
# Check disk usage
df -h

# If /opt/ezygas/backups is large, clean old backups:
cd /opt/ezygas/backups
ls -lh
# Delete old files:
rm ezygas_postgres_20250101*.sql.gz

# Or adjust retention in backup.sh
```

---

## POST-DEPLOYMENT: FIRST WEEK TASKS

### **Day 1 (Today)**
- [ ] Verify all containers are running
- [ ] Agents begin executing on schedule
- [ ] First agent outputs appear in logs
- [ ] Dashboard is accessible

### **Day 2**
- [ ] Review first 24 hours of agent execution
- [ ] Check budget tracking is accurate
- [ ] Fine-tune any agent instructions if needed
- [ ] Set up email/Slack notifications (optional)

### **Day 3**
- [ ] Set up Let's Encrypt certificate (if you have a domain)
- [ ] Configure DNS to point to your VPS
- [ ] Begin feeding real operational data to agents
- [ ] Review CEO strategic briefing

### **Day 4-7**
- [ ] Fine-tune agent schedules based on resource usage
- [ ] Review all agent outputs for quality
- [ ] Begin using agent insights in actual business decisions
- [ ] Plan integration with external systems (CRM, accounting, etc.)

---

## ESTIMATED COSTS (Monthly)

| Item | Cost | Notes |
|------|------|-------|
| Hostinger VPS | $8-15 | Already owned |
| Claude API (agents) | $1,950 | Agent budgets |
| Backups/Storage | $5 | On VPS storage |
| **TOTAL** | **~$1,975** | All-in operational |

---

## NEXT STEPS AFTER DEPLOYMENT SUCCEEDS

Once you confirm all 6 agents are running and producing outputs:

1. **Feed Real Data**: Start providing actual supply chain, customer, and financial data to agents
2. **Set Up Integrations**: Connect to your CRM, accounting software, etc.
3. **Use Agent Insights**: Make actual business decisions based on agent recommendations
4. **Measure ROI**: Track whether $1,950/month is worth the operational improvements
5. **Scale Up**: Once proven, consider adding more agents or expanding heartbeat frequency

---

## SUPPORT & DOCUMENTATION

- **Full Operations Guide**: `/opt/ezygas/DAY1_OPERATIONS_GUIDE.md`
- **Configuration File**: `/opt/ezygas/ezygas-config.json`
- **Docker Logs**: `docker compose logs -f [service]`
- **Paperclip GitHub**: https://github.com/paperclipai/paperclip
- **Paperclip Docs**: https://docs.paperclip.ing

---

## YOU'RE READY

If you've completed all steps above, your EzyGas autonomous operating system is **live and operational**.

**You now have:**
- ✓ A distributed team of 6 AI agents working 24/7
- ✓ Full governance & budget controls
- ✓ Complete audit trail of every decision
- ✓ Mission-aligned execution on all fronts
- ✓ Scalable infrastructure on your VPS

The question is no longer **"Can I automate my business?"**

The question is: **"How fast can I scale?"**

---

**Last Step**: Take a screenshot of your Paperclip dashboard with all 6 agents online and send it to confirm deployment is successful.

