upskill-event-manager/docs/deployment.md
bengizmo 37f7b426b6 feat: Implement auto page creation & fix login E2E tests
Implements automatic creation of required plugin pages (Community Login,
Trainer Registration, Trainer Dashboard) upon plugin activation. This
addresses E2E test failures caused by missing pages in the test
environment.

- Adds activation hook in `hvac-community-events.php` to call
  `hvac_ce_create_required_pages`.
- The callback function checks for existing pages by slug and creates
  them using `wp_insert_post` if missing. Includes debug logging.

Also fixes issues identified during E2E test debugging:
- Corrects fatal error in `includes/community/class-login-handler.php`
  by replacing undefined constant `HVAC_COMMUNITY_EVENTS_PATH` with
  `HVAC_CE_PLUGIN_DIR`.
- Updates `tests/e2e/tests/login.spec.ts` to use the correct selector
  `#wp-submit` for the login form submit button instead of
  `button[type="submit"]`.

Documentation updates:
- Adds `docs/automatic-page-creation-plan.md`.
- Updates `README.md` regarding automatic page creation.
- Updates Memory Bank files (`decisionLog.md`, `progress.md`,
  `activeContext.md`).

Note: Activation hook logging did not appear during WP-CLI activation,
requiring further investigation if page creation issues persist. E2E
test confirmation pending.
2025-03-28 17:18:21 -03:00

3.9 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:

  1. The Events Calendar (6.10.2 or higher)
  2. The Events Calendar Pro (7.4.2 or higher)
  3. Event Tickets (5.19.3 or higher)
  4. Event Tickets Plus (6.2.0 or higher)
  5. The Events Calendar: Community Events (latest version)
  6. Spectra Pro (2.0.0 or higher)
  7. Premium Starter Templates (4.4.14 or higher)
  8. 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

  1. Pre-deployment Checks

    • Verify dependencies
    • Run tests
    • Check file permissions
  2. Deployment Steps

    • Package plugin files
    • Transfer to target environment
    • Update WordPress configuration
    • Clear caches
  3. 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

Access Points

Production Environment

Requirements

  • SSH access to production server
  • WordPress admin credentials
  • Appropriate file permissions

Deployment Steps

  1. Configure SSH access
  2. Update production configuration
  3. Run deployment script
  4. Verify deployment

Troubleshooting

Common Issues

  1. Permission Errors

    # Fix permissions
    ./Users/ben/dev/upskill-event-manager/manage-env.sh fix-permissions
    
  2. Cache Issues

    # Clear WordPress cache
    wp cache flush
    
  3. Plugin Activation Issues

    # Check plugin status
    wp plugin list
    

Rollback Procedure

If deployment fails:

  1. Restore from backup
  2. Revert plugin files
  3. Clear caches
  4. Verify functionality

Maintenance

Regular Tasks

  1. Update dependencies
  2. Run tests
  3. Monitor error logs
  4. 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

  1. Configuration Security

    • Use environment variables
    • Secure sensitive data
    • Restrict file permissions
  2. Access Control

    • Limit SSH access
    • Use strong passwords
    • Enable two-factor authentication
  3. Monitoring

    • Check error logs
    • Monitor file changes
    • Track plugin activity