-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
79 lines (65 loc) · 2.29 KB
/
setup.sh
File metadata and controls
79 lines (65 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Multi-WordPress Deployment Setup Script
# This script automates the initial setup process
set -e
echo "🚀 Multi-WordPress Deployment Setup"
echo "=================================="
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
echo "✅ Docker and Docker Compose are installed"
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp env.example .env
echo "⚠️ Please edit .env file with your actual domain names and passwords"
echo " Then run this script again."
exit 0
fi
# Create required directories
echo "📁 Creating required directories..."
mkdir -p certs logs/nginx vhost.d html
# Set proper permissions
echo "🔐 Setting proper permissions..."
chmod 600 .env
chmod 755 setup.sh
# Pull Docker images
echo "📦 Pulling Docker images..."
docker-compose pull
# Start the stack
echo "🚀 Starting the Docker Compose stack..."
docker-compose up -d
# Wait for services to be ready
echo "⏳ Waiting for services to be ready..."
sleep 30
# Check service status
echo "📊 Checking service status..."
docker-compose ps
echo ""
echo "🎉 Setup complete!"
echo ""
echo "📋 Next steps:"
echo "1. Update your DNS records to point to this server"
echo "2. Wait for SSL certificates to be issued (may take a few minutes)"
echo "3. Access your WordPress sites:"
echo " - Site 1: https://$(grep WP1_DOMAIN .env | cut -d'=' -f2)"
echo " - Site 2: https://$(grep WP2_DOMAIN .env | cut -d'=' -f2)"
echo " - Site 3: https://$(grep WP3_DOMAIN .env | cut -d'=' -f2)"
echo " - phpMyAdmin: https://$(grep PMA_DOMAIN .env | cut -d'=' -f2)"
echo ""
echo "📝 Useful commands:"
echo " - View logs: docker-compose logs [service-name]"
echo " - Stop stack: docker-compose down"
echo " - Restart stack: docker-compose restart"
echo " - Update stack: docker-compose pull && docker-compose up -d"
echo ""
echo "🔍 Check logs for any issues:"
echo " docker-compose logs nginx-proxy"
echo " docker-compose logs letsencrypt"