Add deployment documentation and automated deploy script
Make it dead simple to deploy and run validation scripts on test servers.
NEW FILES:
1. testing/DEPLOYMENT.md
- Complete deployment guide with 5 different methods
- SCP (simplest), GitHub clone, wget/curl, copy-paste, archive
- Step-by-step instructions for both InterWorx and Plesk
- What to expect during execution
- How to review and share results
- Troubleshooting section
- Security notes (scripts are read-only, safe to run)
2. testing/deploy-and-run.sh (AUTOMATED!)
- One command to deploy, run, and retrieve results
- Handles all 4 steps automatically
- Shows live summary of pass/fail/warn counts
- Extracts critical answers automatically
- Error handling and helpful tips
USAGE:
Simple method (manual):
```bash
scp testing/validate-interworx.sh root@SERVER:/tmp/
ssh root@SERVER "/tmp/validate-interworx.sh"
scp root@SERVER:/tmp/interworx-validation-results.txt ./
```
Automated method (one command!):
```bash
cd testing/
./deploy-and-run.sh 192.168.1.100 interworx
# OR
./deploy-and-run.sh plesk-server.com plesk
```
WHAT THE AUTOMATED SCRIPT DOES:
[1/4] Deploys script to server via SCP
[2/4] Runs validation script remotely
[3/4] Retrieves results file
[4/4] Shows summary (PASS/FAIL/WARN counts + critical answers)
OUTPUT EXAMPLE:
```
=======================================================================
VALIDATION SUMMARY
=======================================================================
PASS: 45
FAIL: 0
WARN: 3
✓ All critical tests passed!
=======================================================================
CRITICAL ANSWERS FOUND
=======================================================================
Document roots: /home/USERNAME/DOMAIN/html/
Access logs: /home/USERNAME/var/DOMAIN/logs/access_log
Database prefix: username_ (VERIFIED)
Cron user: testuser
```
SECURITY:
- Scripts are read-only (don't modify system)
- Only exception: cron test (writes then immediately deletes)
- Results in /tmp/ (auto-cleaned on reboot)
- No passwords logged
Ready to deploy to test servers! 🚀
This commit is contained in:
@@ -0,0 +1,289 @@
|
|||||||
|
# Deploying Validation Scripts to Test Servers
|
||||||
|
|
||||||
|
## Quick Deploy Methods
|
||||||
|
|
||||||
|
### Method 1: SCP (Simplest - If You Have SSH Access)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From your current server (where scripts are):
|
||||||
|
|
||||||
|
# Deploy to InterWorx server:
|
||||||
|
scp /root/server-toolkit/testing/validate-interworx.sh root@interworx-server-ip:/tmp/
|
||||||
|
|
||||||
|
# Deploy to Plesk server:
|
||||||
|
scp /root/server-toolkit/testing/validate-plesk.sh root@plesk-server-ip:/tmp/
|
||||||
|
|
||||||
|
# Then SSH and run:
|
||||||
|
ssh root@interworx-server-ip
|
||||||
|
chmod +x /tmp/validate-interworx.sh
|
||||||
|
/tmp/validate-interworx.sh
|
||||||
|
|
||||||
|
# Get results back:
|
||||||
|
scp root@interworx-server-ip:/tmp/interworx-validation-results.txt ./
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method 2: GitHub (If Toolkit is in Git Repo)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# On test server:
|
||||||
|
cd /tmp
|
||||||
|
git clone https://github.com/YOUR_USERNAME/server-toolkit.git
|
||||||
|
cd server-toolkit/testing
|
||||||
|
chmod +x validate-*.sh
|
||||||
|
|
||||||
|
# Run appropriate script:
|
||||||
|
./validate-interworx.sh # On InterWorx
|
||||||
|
./validate-plesk.sh # On Plesk
|
||||||
|
|
||||||
|
# Results in: /tmp/interworx-validation-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method 3: Wget/Curl (If Scripts Are Hosted)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# On test server:
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
# Download script:
|
||||||
|
wget https://your-server.com/validate-interworx.sh
|
||||||
|
# OR
|
||||||
|
curl -O https://your-server.com/validate-interworx.sh
|
||||||
|
|
||||||
|
chmod +x validate-interworx.sh
|
||||||
|
./validate-interworx.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method 4: Copy-Paste (If No Direct Access)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# On your current server, display the script:
|
||||||
|
cat /root/server-toolkit/testing/validate-interworx.sh
|
||||||
|
|
||||||
|
# On test server, create file:
|
||||||
|
nano /tmp/validate-interworx.sh
|
||||||
|
# Paste content, save
|
||||||
|
|
||||||
|
chmod +x /tmp/validate-interworx.sh
|
||||||
|
/tmp/validate-interworx.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method 5: Archive and Transfer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create archive on current server:
|
||||||
|
cd /root/server-toolkit
|
||||||
|
tar -czf /tmp/validation-scripts.tar.gz testing/
|
||||||
|
|
||||||
|
# Transfer via SCP:
|
||||||
|
scp /tmp/validation-scripts.tar.gz root@test-server:/tmp/
|
||||||
|
|
||||||
|
# On test server:
|
||||||
|
cd /tmp
|
||||||
|
tar -xzf validation-scripts.tar.gz
|
||||||
|
cd testing
|
||||||
|
chmod +x validate-*.sh
|
||||||
|
./validate-interworx.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Step-by-Step: Recommended Workflow
|
||||||
|
|
||||||
|
### For InterWorx Server:
|
||||||
|
|
||||||
|
1. **Transfer script:**
|
||||||
|
```bash
|
||||||
|
scp /root/server-toolkit/testing/validate-interworx.sh root@INTERWORX_IP:/tmp/
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **SSH to server:**
|
||||||
|
```bash
|
||||||
|
ssh root@INTERWORX_IP
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Make executable and run:**
|
||||||
|
```bash
|
||||||
|
chmod +x /tmp/validate-interworx.sh
|
||||||
|
/tmp/validate-interworx.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Watch the output** - it will show real-time test results with colors
|
||||||
|
|
||||||
|
5. **When done, review results:**
|
||||||
|
```bash
|
||||||
|
less /tmp/interworx-validation-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Get results back to your machine:**
|
||||||
|
```bash
|
||||||
|
# From your local machine:
|
||||||
|
scp root@INTERWORX_IP:/tmp/interworx-validation-results.txt ./interworx-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### For Plesk Server:
|
||||||
|
|
||||||
|
Same steps, just replace:
|
||||||
|
- `validate-interworx.sh` → `validate-plesk.sh`
|
||||||
|
- `interworx-validation-results.txt` → `plesk-validation-results.txt`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What You'll See During Execution
|
||||||
|
|
||||||
|
```
|
||||||
|
=======================================================================
|
||||||
|
INTERWORX VALIDATION SCRIPT
|
||||||
|
=======================================================================
|
||||||
|
This script will verify all assumptions about InterWorx
|
||||||
|
Results will be saved to: /tmp/interworx-validation-results.txt
|
||||||
|
|
||||||
|
Started: Wed Nov 20 14:30:22 EST 2025
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
TEST 1: Control Panel Detection
|
||||||
|
=======================================================================
|
||||||
|
[PASS] InterWorx installation directory exists: /usr/local/interworx
|
||||||
|
[PASS] InterWorx config file exists: /usr/local/interworx/iworx.ini
|
||||||
|
[INFO] InterWorx version: 7.10.2
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
TEST 2: File System Structure
|
||||||
|
=======================================================================
|
||||||
|
[PASS] Found test user: testuser with domain: example.com
|
||||||
|
[PASS] Document root exists: /home/testuser/example.com/html
|
||||||
|
[PASS] Log directory exists: /home/testuser/var/example.com/logs
|
||||||
|
[PASS] Access log exists: /home/testuser/var/example.com/logs/access_log
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## After Running - What to Do
|
||||||
|
|
||||||
|
### 1. Review the Results File
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Quick summary:
|
||||||
|
grep -E "PASS|FAIL|WARN" /tmp/interworx-validation-results.txt | sort | uniq -c
|
||||||
|
|
||||||
|
# See critical answers:
|
||||||
|
grep -A5 "QUICK REFERENCE FOR DEVELOPERS" /tmp/interworx-validation-results.txt
|
||||||
|
|
||||||
|
# See directory structures:
|
||||||
|
grep -A20 "DIRECTORY STRUCTURE" /tmp/interworx-validation-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Share Results
|
||||||
|
|
||||||
|
**Option A: Copy entire file content**
|
||||||
|
```bash
|
||||||
|
cat /tmp/interworx-validation-results.txt
|
||||||
|
# Copy and paste to pastebin/gist/email
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option B: Transfer file back**
|
||||||
|
```bash
|
||||||
|
scp root@test-server:/tmp/interworx-validation-results.txt ./
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option C: Email from server**
|
||||||
|
```bash
|
||||||
|
mail -s "InterWorx Validation Results" your@email.com < /tmp/interworx-validation-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Look for Critical Info
|
||||||
|
|
||||||
|
Search the results file for:
|
||||||
|
```bash
|
||||||
|
# Cron user answer:
|
||||||
|
grep "ANSWER.*cron" /tmp/interworx-validation-results.txt
|
||||||
|
|
||||||
|
# Database prefix answer:
|
||||||
|
grep -i "database prefix" /tmp/interworx-validation-results.txt
|
||||||
|
|
||||||
|
# Failed tests:
|
||||||
|
grep "FAIL" /tmp/interworx-validation-results.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### "Permission denied"
|
||||||
|
```bash
|
||||||
|
# Make sure script is executable:
|
||||||
|
chmod +x /tmp/validate-interworx.sh
|
||||||
|
|
||||||
|
# Run as root:
|
||||||
|
sudo /tmp/validate-interworx.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### "Command not found: tree"
|
||||||
|
**This is OK!** Scripts have fallback to `find` command. Output will still work.
|
||||||
|
|
||||||
|
### "No test user/domain found"
|
||||||
|
This means server has no hosting accounts set up. Script will still run but some tests will show WARN.
|
||||||
|
|
||||||
|
### Script hangs or takes long time
|
||||||
|
- Database connection tests may wait for timeout if MySQL isn't accessible
|
||||||
|
- Large servers with many domains may take 2-3 minutes
|
||||||
|
- This is normal - let it complete
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Security Notes
|
||||||
|
|
||||||
|
- ✅ Scripts are **read-only** - they don't modify anything (except brief cron test)
|
||||||
|
- ✅ Cron test writes entry then **immediately removes it**
|
||||||
|
- ✅ Results file is in `/tmp/` - automatically cleaned on reboot
|
||||||
|
- ✅ No sensitive passwords are logged
|
||||||
|
- ⚠️ Results file contains domain names, usernames, file paths
|
||||||
|
- ⚠️ Remove results file after review: `rm /tmp/*-validation-results.txt`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Expected Runtime
|
||||||
|
|
||||||
|
- **InterWorx**: 30-60 seconds (depends on # of users/domains)
|
||||||
|
- **Plesk**: 30-90 seconds (depends on # of domains)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What Gets Created
|
||||||
|
|
||||||
|
**Files created:**
|
||||||
|
- `/tmp/interworx-validation-results.txt` OR `/tmp/plesk-validation-results.txt`
|
||||||
|
- `/tmp/iworx_cron_backup_*` (temporary, auto-deleted)
|
||||||
|
- `/tmp/plesk_cron_backup_*` (temporary, auto-deleted)
|
||||||
|
|
||||||
|
**No permanent changes** to the system.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Command Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Deploy
|
||||||
|
scp validate-interworx.sh root@SERVER:/tmp/
|
||||||
|
|
||||||
|
# Run
|
||||||
|
ssh root@SERVER "/tmp/validate-interworx.sh"
|
||||||
|
|
||||||
|
# Get results
|
||||||
|
scp root@SERVER:/tmp/interworx-validation-results.txt ./
|
||||||
|
|
||||||
|
# One-liner (deploy, run, get results):
|
||||||
|
scp validate-interworx.sh root@SERVER:/tmp/ && \
|
||||||
|
ssh root@SERVER "chmod +x /tmp/validate-interworx.sh && /tmp/validate-interworx.sh" && \
|
||||||
|
scp root@SERVER:/tmp/interworx-validation-results.txt ./
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Need Help?
|
||||||
|
|
||||||
|
If you encounter issues:
|
||||||
|
1. Check `/tmp/interworx-validation-results.txt` for error details
|
||||||
|
2. Run with bash debugging: `bash -x /tmp/validate-interworx.sh`
|
||||||
|
3. Share the results file with the development team
|
||||||
Executable
+133
@@ -0,0 +1,133 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Quick Deploy & Run Validation Scripts
|
||||||
|
# Usage: ./deploy-and-run.sh <server-ip> <interworx|plesk>
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "Usage: $0 <server-ip> <interworx|plesk>"
|
||||||
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo " $0 192.168.1.100 interworx"
|
||||||
|
echo " $0 plesk.example.com plesk"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SERVER="$1"
|
||||||
|
PANEL="$2"
|
||||||
|
|
||||||
|
# Validate panel type
|
||||||
|
if [[ "$PANEL" != "interworx" ]] && [[ "$PANEL" != "plesk" ]]; then
|
||||||
|
echo "Error: Panel must be 'interworx' or 'plesk'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
SCRIPT_NAME="validate-${PANEL}.sh"
|
||||||
|
SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_NAME}"
|
||||||
|
RESULTS_FILE="${PANEL}-validation-results.txt"
|
||||||
|
|
||||||
|
# Check if script exists
|
||||||
|
if [ ! -f "$SCRIPT_PATH" ]; then
|
||||||
|
echo "Error: Script not found: $SCRIPT_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "VALIDATION SCRIPT DEPLOYMENT"
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "Server: $SERVER"
|
||||||
|
echo "Panel: $PANEL"
|
||||||
|
echo "Script: $SCRIPT_NAME"
|
||||||
|
echo "======================================================================="
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Step 1: Deploy script
|
||||||
|
echo "[1/4] Deploying script to server..."
|
||||||
|
if scp "$SCRIPT_PATH" "root@${SERVER}:/tmp/${SCRIPT_NAME}"; then
|
||||||
|
echo "✓ Script deployed successfully"
|
||||||
|
else
|
||||||
|
echo "✗ Failed to deploy script"
|
||||||
|
echo "Tip: Make sure SSH key authentication is set up, or use: ssh-copy-id root@${SERVER}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Step 2: Make executable and run
|
||||||
|
echo "[2/4] Running validation script on server..."
|
||||||
|
echo "This may take 1-2 minutes..."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if ssh "root@${SERVER}" "chmod +x /tmp/${SCRIPT_NAME} && /tmp/${SCRIPT_NAME}"; then
|
||||||
|
echo ""
|
||||||
|
echo "✓ Validation completed successfully"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "⚠ Validation script encountered issues (check output above)"
|
||||||
|
echo "Continuing to retrieve results file..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Step 3: Retrieve results
|
||||||
|
echo "[3/4] Retrieving results file..."
|
||||||
|
if scp "root@${SERVER}:/tmp/${RESULTS_FILE}" "./${RESULTS_FILE}"; then
|
||||||
|
echo "✓ Results file retrieved: ./${RESULTS_FILE}"
|
||||||
|
else
|
||||||
|
echo "✗ Failed to retrieve results file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Step 4: Show summary
|
||||||
|
echo "[4/4] Generating summary..."
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "VALIDATION SUMMARY"
|
||||||
|
echo "======================================================================="
|
||||||
|
|
||||||
|
# Count results
|
||||||
|
PASS_COUNT=$(grep -c "^\[PASS\]" "$RESULTS_FILE" 2>/dev/null || echo "0")
|
||||||
|
FAIL_COUNT=$(grep -c "^\[FAIL\]" "$RESULTS_FILE" 2>/dev/null || echo "0")
|
||||||
|
WARN_COUNT=$(grep -c "^\[WARN\]" "$RESULTS_FILE" 2>/dev/null || echo "0")
|
||||||
|
|
||||||
|
echo "PASS: $PASS_COUNT"
|
||||||
|
echo "FAIL: $FAIL_COUNT"
|
||||||
|
echo "WARN: $WARN_COUNT"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ "$FAIL_COUNT" -eq 0 ]; then
|
||||||
|
echo "✓ All critical tests passed!"
|
||||||
|
else
|
||||||
|
echo "⚠ Some tests failed - review results file"
|
||||||
|
echo ""
|
||||||
|
echo "Failed tests:"
|
||||||
|
grep "^\[FAIL\]" "$RESULTS_FILE" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "CRITICAL ANSWERS FOUND"
|
||||||
|
echo "======================================================================="
|
||||||
|
|
||||||
|
# Extract critical answers
|
||||||
|
grep -A10 "QUICK REFERENCE FOR DEVELOPERS" "$RESULTS_FILE" 2>/dev/null | head -15 || echo "See full results file"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "NEXT STEPS"
|
||||||
|
echo "======================================================================="
|
||||||
|
echo "1. Review full results: cat ${RESULTS_FILE}"
|
||||||
|
echo "2. Check directory structures: grep 'DIRECTORY STRUCTURE' ${RESULTS_FILE}"
|
||||||
|
echo "3. Share results with development team if needed"
|
||||||
|
echo ""
|
||||||
|
echo "Full results file: $(pwd)/${RESULTS_FILE}"
|
||||||
|
echo "======================================================================="
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user