upskill-event-manager/wordpress-dev/bin/obsolete/verify-with-wpcli.sh
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

71 lines
No EOL
2 KiB
Bash
Executable file

#!/bin/bash
# Load environment variables from current directory
if [ ! -f .env ]; then
echo "Error: .env file not found in current directory!"
exit 1
fi
source .env
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Function to check if a command was successful
check_status() {
if [ $? -eq 0 ]; then
echo -e "${GREEN}$1${NC}"
return 0
else
echo -e "${RED}$1${NC}"
return 1
fi
}
echo -e "${YELLOW}Starting environment verification with WP-CLI...${NC}"
# Check if containers are running
echo "Checking Docker containers..."
if ! docker-compose ps | grep -q "wordpress.*Up"; then
echo -e "${RED}WordPress container is not running${NC}"
exit 1
fi
if ! docker-compose ps | grep -q "db.*Up"; then
echo -e "${RED}Database container is not running${NC}"
exit 1
fi
check_status "Container status check"
# Install WP-CLI in the container
echo "Installing WP-CLI..."
docker-compose exec wordpress /bin/bash -c 'curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp'
check_status "WP-CLI installation"
# Check database connection
echo "Verifying database connection..."
if ! docker-compose exec wordpress wp db check --allow-root > /dev/null 2>&1; then
echo -e "${RED}Database connection failed${NC}"
exit 1
fi
check_status "Database connection"
# Verify WordPress installation
echo "Verifying WordPress installation..."
if ! docker-compose exec wordpress wp core is-installed --allow-root; then
echo -e "${RED}WordPress is not properly installed${NC}"
exit 1
fi
check_status "WordPress installation"
# Test homepage accessibility
echo "Testing homepage accessibility..."
if ! curl -s -I "http://localhost:8080" | grep -q "200 OK"; then
echo -e "${RED}Homepage is not accessible${NC}"
exit 1
fi
check_status "Homepage accessibility"
echo -e "${GREEN}Environment verification completed successfully!${NC}"