3cf792e80b
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! 🚀
134 lines
4.0 KiB
Bash
Executable File
134 lines
4.0 KiB
Bash
Executable File
#!/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
|