Updated for public server.
This commit is contained in:
71
setup.sh
Executable file → Normal file
71
setup.sh
Executable file → Normal file
@@ -1,12 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Setting up WordPress development environment..."
|
||||
echo "Setting up WordPress/WooCommerce environment for shuffleandskirmish.co.uk..."
|
||||
|
||||
# Check if .env file exists
|
||||
if [ ! -f .env ]; then
|
||||
echo "❌ Error: .env file not found!"
|
||||
echo "Please create a .env file with the following variables:"
|
||||
echo " DB_ROOT_PASSWORD=your_root_password"
|
||||
echo " DB_NAME=your_database_name"
|
||||
echo " DB_USER=your_database_user"
|
||||
echo " DB_PASSWORD=your_database_password"
|
||||
echo " WORDPRESS_DEBUG=0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create directories with proper permissions
|
||||
echo "Creating necessary directories..."
|
||||
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 .
|
||||
echo "Setting permissions..."
|
||||
chown -R $USER:$USER .
|
||||
|
||||
# Set directory permissions
|
||||
chmod -R 755 wp-content/
|
||||
@@ -15,40 +29,69 @@ 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."
|
||||
echo "❌ Docker is not running. Please start Docker first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if traefik-public network exists
|
||||
if ! docker network inspect traefik-public > /dev/null 2>&1; then
|
||||
echo "❌ Error: traefik-public network does not exist!"
|
||||
echo "Please ensure Traefik is properly set up with the traefik-public network."
|
||||
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"
|
||||
DOCKER_COMPOSE_CMD="docker compose"
|
||||
else
|
||||
echo "User not in docker group, using sudo..."
|
||||
DOCKER_COMPOSE_CMD="sudo docker-compose"
|
||||
DOCKER_COMPOSE_CMD="sudo docker compose"
|
||||
fi
|
||||
|
||||
# Pull latest images
|
||||
echo "Pulling latest Docker images..."
|
||||
$DOCKER_COMPOSE_CMD pull
|
||||
|
||||
# Build and start containers
|
||||
echo "Building and starting containers..."
|
||||
$DOCKER_COMPOSE_CMD up -d
|
||||
|
||||
echo "Waiting for containers to initialize..."
|
||||
sleep 15
|
||||
sleep 20
|
||||
|
||||
# Check if containers are running
|
||||
if $DOCKER_COMPOSE_CMD ps | grep -q "Up"; then
|
||||
echo "✅ WordPress development environment is ready!"
|
||||
if $DOCKER_COMPOSE_CMD ps | grep -q "running"; then
|
||||
echo ""
|
||||
echo "🌐 WordPress: http://localhost:8000"
|
||||
echo "📊 phpMyAdmin: http://localhost:8080"
|
||||
echo "✅ WordPress/WooCommerce environment is ready!"
|
||||
echo ""
|
||||
echo "Default credentials:"
|
||||
echo "WordPress Admin: admin / admin (you'll set this during installation)"
|
||||
echo "MySQL: root / root_password"
|
||||
echo "🌐 WordPress Site: https://shuffleandskirmish.co.uk"
|
||||
echo "🌐 WordPress Site (www): https://www.shuffleandskirmish.co.uk"
|
||||
echo "📊 phpMyAdmin: https://pma.shuffleandskirmish.co.uk"
|
||||
echo ""
|
||||
echo "Useful commands:"
|
||||
echo "⚠️ IMPORTANT SETUP STEPS:"
|
||||
echo "1. Visit https://shuffleandskirmish.co.uk to complete WordPress installation"
|
||||
echo "2. Install WooCommerce plugin from WordPress admin"
|
||||
echo "3. Configure SSL settings in WordPress (should be automatic with Traefik)"
|
||||
echo "4. Update DNS records to point to this server:"
|
||||
echo " - shuffleandskirmish.co.uk -> Server IP"
|
||||
echo " - www.shuffleandskirmish.co.uk -> Server IP"
|
||||
echo " - pma.shuffleandskirmish.co.uk -> Server IP"
|
||||
echo ""
|
||||
echo "🔒 Security Notes:"
|
||||
echo " - phpMyAdmin is exposed at pma.shuffleandskirmish.co.uk"
|
||||
echo " - Consider restricting access or disabling it in production"
|
||||
echo " - Change default database passwords in .env file"
|
||||
echo ""
|
||||
echo "📝 Useful commands:"
|
||||
echo " View logs: $DOCKER_COMPOSE_CMD logs -f"
|
||||
echo " View specific service: $DOCKER_COMPOSE_CMD logs -f wordpress"
|
||||
echo " Stop: $DOCKER_COMPOSE_CMD stop"
|
||||
echo " Start: $DOCKER_COMPOSE_CMD start"
|
||||
echo " Restart: $DOCKER_COMPOSE_CMD restart"
|
||||
echo " Remove: $DOCKER_COMPOSE_CMD down"
|
||||
echo " Remove with volumes: $DOCKER_COMPOSE_CMD down -v"
|
||||
else
|
||||
echo "❌ Some containers failed to start. Check logs with: $DOCKER_COMPOSE_CMD logs"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user