upskill-event-manager/wordpress-dev/README.md

156 lines
No EOL
3 KiB
Markdown

# WordPress Development Environment
**Status**: Active/Authoritative
**Last Updated**: March 12, 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
```bash
# Start environment
./bin/setup-dev.sh
# Verify setup
./bin/verify-dev.sh
```
This creates:
- WordPress (PHP 8.1-FPM)
- MariaDB
- phpMyAdmin
- Nginx (with SSL support)
### 3. Plugin Setup
Required plugins are automatically synced from production:
- The Events Calendar Suite (6.10.2+)
- Event Tickets Suite (5.19.3+)
- Additional required plugins
## Access Points
- WordPress Site:
- HTTP: http://localhost:8080
- HTTPS: https://localhost:8443 (when SSL enabled)
- phpMyAdmin: http://localhost:8081
- Server: db
- Username: from .env (DEV_DB_USER)
- Password: from .env (DEV_DB_PASSWORD)
## Development Tools
### Environment Management
```bash
# Setup development environment
./bin/setup-dev.sh
# Sync with production
./bin/sync-production.sh
# Verify environment
./bin/verify-dev.sh
# Setup SSL (if needed)
./bin/setup-ssl.sh
```
### Testing
```bash
# 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
```bash
# Backup development database
./bin/backup-dev-db.sh
# Import production database
./bin/import-prod-db.sh
# Reset development database
./bin/reset-dev-db.sh
```
## Troubleshooting
### Common Issues
1. **Environment Issues**
```bash
# Check container status
docker-compose ps
# View container logs
docker-compose logs
```
2. **Database Issues**
```bash
# Reset database
./bin/reset-dev-db.sh
# Verify database connection
./bin/verify-dev.sh
```
3. **Plugin Issues**
```bash
# Resync plugins from production
./bin/sync-production.sh --plugins-only
# Verify plugin status
./bin/verify-dev.sh --plugins
```
### Debug Mode
```bash
# Enable WordPress debug mode
./bin/setup-dev.sh --debug
# View debug logs
tail -f wp-content/debug.log
```
## 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:
- Email: support@tealmaker.com
- Slack: #network-events-support
*Last Updated: March 25, 2025*