8.5 KiB
8.5 KiB
Deployment Guide
This guide covers deploying the HVAC Trainer Network Events plugin to development and production environments.
Quick Start
# Deploy to development
./Users/ben/dev/upskill-event-manager/wordpress-dev/deploy.sh --config deploy-config.sh
# Deploy and run tests
./Users/ben/dev/upskill-event-manager/wordpress-dev/deploy.sh --config deploy-config.sh --run-tests
# Deploy to production
./Users/ben/dev/upskill-event-manager/wordpress-dev/deploy.sh --config deploy-config-production.sh
Plugin Dependencies
The HVAC Trainer Network Events plugin requires the following plugins:
- The Events Calendar (6.10.2 or higher)
- The Events Calendar Pro (7.4.2 or higher)
- Event Tickets (5.19.3 or higher)
- Event Tickets Plus (6.2.0 or higher)
- The Events Calendar: Community Events (latest version)
- Spectra Pro (2.0.0 or higher)
- Premium Starter Templates (4.4.14 or higher)
- Essential Blocks (5.3.2 or higher)
Important Notes:
- Plugin versions are managed separately from deployment
- Do not update plugins as part of deployment or testing
- Plugin updates should be tested separately in a staging environment
- Use the plugin management system of your hosting environment for updates
Configuration Files
Development Configuration
File: deploy-config.sh
REMOTE_HOST="upskill_wordpress"
REMOTE_USER="root"
WP_PATH="/var/www/html/"
PLUGIN_SLUG="network-events"
WP_CLI_PATH="wp"
PURGE_BREEZE_CACHE=false
USE_ROOT=true
Production Configuration
File: deploy-config-production.sh
- Contains production-specific settings
- Includes additional security measures
- Requires SSH key configuration
Deployment Process
-
Pre-deployment Checks
- Verify dependencies
- Run tests
- Check file permissions
-
Deployment Steps
- Package plugin files
- Transfer to target environment
- Update WordPress configuration
- Clear caches
-
Post-deployment Verification
- Check plugin activation
- Verify functionality
- Monitor error logs
Development Environment
Setup
# Start development environment
cd /Users/ben/dev/upskill-event-manager/wordpress-dev
./Users/ben/dev/upskill-event-manager/wordpress-dev/manage-env.sh start
# Stop development environment
./Users/ben/dev/upskill-event-manager/wordpress-dev/manage-env.sh stop
# Reset development environment
./Users/ben/dev/upskill-event-manager/wordpress-dev/manage-env.sh reset
Production Environment
Requirements
- SSH access to production server
- WordPress admin credentials
- Appropriate file permissions
Deployment Steps
- Configure SSH access
- Update production configuration
- Run deployment script
- Verify deployment
Staging Environment
The staging environment on Cloudways serves as a pre-production testing platform. It includes dedicated configuration, deployment, and testing procedures.
Environment Setup
- Configure Environment Variables
# Required in .env file
UPSKILL_STAGING_URL=https://wordpress-974670-5399585.cloudwaysapps.com/
UPSKILL_STAGING_IP=146.190.76.204
UPSKILL_STAGING_SSH_USER=roodev
UPSKILL_STAGING_PASS=<password>
UPSKILL_STAGING_PATH=/home/974670.cloudwaysapps.com/uberrxmprk/public_html
UPSKILL_STAGING_DB_NAME=uberrxmprk
UPSKILL_STAGING_DB_USER=uberrxmprk
UPSKILL_STAGING_DB_PASSWORD=<password>
- Deploy Configuration
# Deploy configuration files
./bin/deploy-config-staging.sh
# Verify deployment
./bin/verify-staging.sh
- Configure Test Environment
# Set up test configuration
./bin/configure-staging-tests.sh
# Run initial tests
./bin/run-staging-unit-tests.sh
Deployment Process
- Pre-deployment
# Verify staging environment
./bin/verify-staging.sh
# Configure test environment
./bin/configure-staging-tests.sh
# Run tests before deployment
./bin/run-staging-tests.sh
- Deploy Plugin
# Deploy plugin files
./bin/deploy-plugin.sh --config wordpress-dev/deploy-config-staging.sh
# Verify deployment
./bin/verify-staging.sh --deployment
- Post-deployment
# Run tests after deployment
./bin/run-staging-tests.sh
# Check logs
./bin/verify-staging.sh --logs
Configuration Files
- deploy-config-staging.sh
REMOTE_HOST="${UPSKILL_STAGING_IP}"
REMOTE_USER="${UPSKILL_STAGING_SSH_USER}"
REMOTE_PATH_BASE="/home/974670.cloudwaysapps.com/uberrxmprk/public_html"
PLUGIN_SLUG="hvac-community-events"
REMOTE_PLUGIN_PATH="${REMOTE_PATH_BASE}/wp-content/plugins/${PLUGIN_SLUG}/"
LOCAL_PLUGIN_PATH="../wp-content/plugins/${PLUGIN_SLUG}/"
- wp-tests-config-staging.php
define('DB_NAME', 'uberrxmprk');
define('DB_USER', 'uberrxmprk');
define('DB_PASSWORD', 'vRVr7GJCAZ');
define('DB_HOST', 'localhost');
define('ABSPATH', '/home/974670.cloudwaysapps.com/uberrxmprk/public_html/');
Staging-Specific Tools
- Configuration
deploy-config-staging.sh: Deployment configurationconfigure-staging-tests.sh: Test environment setupwp-tests-config-staging.php: WordPress test configuration
- Deployment
deploy-plugin.sh: Deploy plugin filesdeploy-config-staging.sh: Deploy configuration files
- Testing
run-staging-unit-tests.sh: Run unit testsrun-staging-tests.sh: Run all test suites
- Verification
verify-staging.sh: Environment verificationsync-staging.sh: Data synchronization
Staging Environment Maintenance
- Regular Tasks
- Run tests weekly
- Monitor error logs
- Update test data
- Verify plugin functionality
- Data Management
# Sync data from staging
./bin/sync-staging.sh
# Deploy fresh test data
./bin/deploy-config-staging.sh --test-data
- Monitoring
# Check logs
./bin/verify-staging.sh --logs
# Monitor performance
./bin/verify-staging.sh --performance
Troubleshooting
Development Environment Issues
-
Permission Errors
# Fix permissions ./Users/ben/dev/upskill-event-manager/manage-env.sh fix-permissions -
Cache Issues
# Clear WordPress cache wp cache flush -
Plugin Activation Issues
# Check plugin status wp plugin list
Staging Environment Issues
-
SSH Connection Issues
# Test SSH connection sshpass -p "$UPSKILL_STAGING_PASS" ssh "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP" "echo 'Connection test'" # Check SSH configuration ./bin/verify-staging.sh --ssh # Verify credentials env | grep UPSKILL_STAGING -
Test Environment Issues
# Reconfigure test environment ./bin/configure-staging-tests.sh # Check test configuration ./bin/verify-staging.sh --test-env # View test logs ./bin/verify-staging.sh --logs -
Database Connection Issues
# Test database connection mysql -h "$UPSKILL_STAGING_IP" -u "$UPSKILL_STAGING_DB_USER" -p"$UPSKILL_STAGING_DB_PASSWORD" "$UPSKILL_STAGING_DB_NAME" -e "SELECT 1" # Verify database configuration ./bin/verify-staging.sh --database # Check database permissions ./bin/verify-staging.sh --permissions -
Deployment Issues
# Check deployment status ./bin/verify-staging.sh --deployment # Verify file permissions ./bin/verify-staging.sh --permissions # Check plugin status ./bin/verify-staging.sh --plugin -
Test Failures
# Run specific test ./bin/run-staging-unit-tests.sh --filter=test_name # Debug test environment ./bin/verify-staging.sh --test-env # View detailed test output ./bin/run-staging-unit-tests.sh --debug -
Performance Issues
# Check server resources ./bin/verify-staging.sh --performance # Monitor PHP processes ./bin/verify-staging.sh --processes # View error logs ./bin/verify-staging.sh --logs
Rollback Procedure
If deployment fails:
- Restore from backup
- Revert plugin files
- Clear caches
- Verify functionality
Maintenance
Regular Tasks
- Update dependencies
- Run tests
- Monitor error logs
- Backup data
Backup Management
# Create backup
./Users/ben/dev/upskill-event-manager/wordpress-dev/manage-env.sh backup
# Restore from backup
./Users/ben/dev/upskill-event-manager/wordpress-dev/manage-env.sh restore
Security Considerations
-
Configuration Security
- Use environment variables
- Secure sensitive data
- Restrict file permissions
-
Access Control
- Limit SSH access
- Use strong passwords
- Enable two-factor authentication
-
Monitoring
- Check error logs
- Monitor file changes
- Track plugin activity