upskill-event-manager/wordpress-dev
bengizmo d1509b3d60 feat(dev-env): implement backup-based development workflow
This commit introduces a more reliable and consistent approach to setting up
the development environment using backups:

- Add setup-from-backup.sh script for environment setup from existing backups
- Standardize script naming and organization
- Move obsolete scripts to bin/obsolete directory
- Update documentation with new workflow instructions
- Create migration guide for transitioning to new workflow
- Update Memory Bank with workflow improvements

The new workflow provides:
- More reliable environment setup
- Faster setup process
- Offline development capability
- Consistent development environments across team members

Breaking changes:
- setup-dev.sh is replaced by setup-from-backup.sh
- sync-and-setup.sh is replaced by separate scripts
- verify-with-wpcli.sh is no longer used

Migration path is documented in MIGRATION_GUIDE.md
2025-03-26 11:26:18 -03:00
..
bin feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
nginx-conf feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
php.ini docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
playwright-report docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
ssl feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
test-results feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
tests docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
wordpress feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
dev-env.conf Initial commit: Implemented registration and login functionality 2025-03-25 10:56:29 -03:00
dev_env_proposal.md feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
docker-compose.yml docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
Dockerfile docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
MIGRATION_GUIDE.md feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
nginx.conf Initial commit: Implemented registration and login functionality 2025-03-25 10:56:29 -03:00
package-lock.json docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
package.json docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
php-fpm.conf docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
README.md feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
testing.md feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00
tsconfig.json docs: update Memory Bank and implementation plan with development environment progress 2025-03-25 14:28:26 -03:00
wordpress_output.html feat(dev-env): implement backup-based development workflow 2025-03-26 11:26:18 -03:00

WordPress Development Environment

Status: Active/Authoritative Last Updated: March 26, 2025 Scope: Development environment setup and configuration

This is a Docker-based development environment for WordPress that replicates the production environment on Cloudways. It includes WordPress with PHP 8.1, MariaDB, and phpMyAdmin.

Prerequisites

  • Docker and Docker Compose
  • Git
  • Node.js and npm (for E2E tests)
  • mkcert (for SSL support, installed automatically if needed)

Environment Setup

1. Configuration

The .env file contains:

  • Production server details
  • Database credentials
  • WordPress authentication
  • SSL configuration
  • Development settings

2. Development Environment Setup from Backup

The recommended way to set up the development environment is using existing backups:

# Set up environment from the latest backup
./bin/setup-from-backup.sh

# Verify setup
./bin/verify-simple.sh

This process:

  1. Uses the latest backup from the backups/ directory
  2. Sets up the Docker containers (WordPress, MariaDB, phpMyAdmin, Nginx)
  3. Imports the database from the backup
  4. Updates site URLs to point to localhost:8080
  5. Configures WordPress with the correct settings

3. Creating New Backups

If you need to create a new backup from production:

# Create a new backup from production
./bin/sync-production-fixed.sh

This will create a new backup in the backups/ directory with the current date and time.

4. Plugin Setup

Required plugins are included in the backups:

  • The Events Calendar Suite (6.10.2+)
  • Event Tickets Suite (5.19.3+)
  • Additional required plugins

Access Points

Development Tools

Environment Management

# Set up environment from backup
./bin/setup-from-backup.sh

# Create a new backup from production
./bin/sync-production-fixed.sh

# Verify environment
./bin/verify-simple.sh

# More detailed verification
./bin/verify-dev-fixed.sh

# Reset development environment
./bin/reset-dev.sh

# Setup SSL (if needed)
./bin/setup-ssl.sh

Testing

# Run all tests
./bin/run-tests.sh

# Run specific test suites
./bin/run-tests.sh --unit
./bin/run-tests.sh --integration
./bin/run-tests.sh --e2e

Database Operations

# Manage database operations
./bin/manage-db-fixed.sh

# Reset development database
./bin/reset-dev.sh

Logs and Cleanup

# View logs
./bin/logs.sh

# Clean up environment
./bin/cleanup.sh

Troubleshooting

Common Issues

  1. Environment Issues

    # Check container status
    docker-compose ps
    
    # View container logs
    docker-compose logs
    # or
    ./bin/logs.sh
    
  2. Database Issues

    # Reset database
    ./bin/reset-dev.sh
    
    # Verify database connection
    ./bin/verify-simple.sh
    
  3. Backup Issues

    # Check available backups
    ls -la backups/
    
    # Create a new backup
    ./bin/sync-production-fixed.sh
    
  4. WordPress Access Issues

    # Check if WordPress is accessible
    curl -I http://localhost:8080
    
    # Restart containers
    docker-compose down && docker-compose up -d
    

Debug Mode

WordPress debug mode is enabled by default in the development environment. Debug logs can be viewed with:

# View debug logs
docker-compose logs wordpress
# or
./bin/logs.sh wordpress

Migration Guide

If you were using the old setup scripts (setup-dev.sh, sync-production.sh), follow these steps to migrate to the new workflow:

  1. Create a backup of your current development environment if needed
  2. Pull the latest changes from the repository
  3. Use the new setup-from-backup.sh script to set up your environment
  4. If you need to create a new backup from production, use sync-production-fixed.sh

Security Notes

  1. Never commit .env to version control
  2. Use WordPress Application Passwords for API access
  3. Keep production credentials secure
  4. Regularly rotate passwords and tokens
  5. Keep SSL certificates secure

Support

For issues:

  1. Check debug logs
  2. Review container logs
  3. Verify environment configuration
  4. Contact development team:

Last Updated: March 26, 2025