Files
shuffle_and_skirmish_website/setup.sh
2025-11-24 21:33:55 +00:00

54 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
echo "Setting up WordPress development environment..."
# Create directories with proper permissions
mkdir -p wp-content/themes wp-content/plugins wp-content/uploads mysql/data
# Set ownership of current directory to current user
sudo chown -R $USER:$USER .
# Set directory permissions
chmod -R 755 wp-content/
chmod -R 755 mysql/
chmod 644 .env
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "Docker is not running. Please start Docker first."
exit 1
fi
# Check if user is in docker group
if groups $USER | grep -q '\bdocker\b'; then
echo "User is in docker group, proceeding without sudo..."
DOCKER_COMPOSE_CMD="docker-compose"
else
echo "User not in docker group, using sudo..."
DOCKER_COMPOSE_CMD="sudo docker-compose"
fi
echo "Building and starting containers..."
$DOCKER_COMPOSE_CMD up -d
echo "Waiting for containers to initialize..."
sleep 15
# Check if containers are running
if $DOCKER_COMPOSE_CMD ps | grep -q "Up"; then
echo "✅ WordPress development environment is ready!"
echo ""
echo "🌐 WordPress: http://localhost:8000"
echo "📊 phpMyAdmin: http://localhost:8080"
echo ""
echo "Default credentials:"
echo "WordPress Admin: admin / admin (you'll set this during installation)"
echo "MySQL: root / root_password"
echo ""
echo "Useful commands:"
echo " View logs: $DOCKER_COMPOSE_CMD logs -f"
echo " Stop: $DOCKER_COMPOSE_CMD stop"
echo " Remove: $DOCKER_COMPOSE_CMD down"
else
echo "❌ Some containers failed to start. Check logs with: $DOCKER_COMPOSE_CMD logs"
fi