-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-all-microservices.sh
More file actions
executable file
·129 lines (100 loc) · 4.1 KB
/
Copy pathstart-all-microservices.sh
File metadata and controls
executable file
·129 lines (100 loc) · 4.1 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
echo "🚀 Uruchamianie wszystkich mikroserwisów InvoiceApp..."
# Kolory dla czytelności
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}📦 Sprawdzanie wymagań...${NC}"
# Sprawdź czy Docker jest zainstalowany
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Docker nie jest zainstalowany!${NC}"
exit 1
fi
# Sprawdź czy Docker Compose jest zainstalowany
if ! command -v docker-compose &> /dev/null; then
echo -e "${RED}❌ Docker Compose nie jest zainstalowany!${NC}"
exit 1
fi
echo -e "${GREEN}✅ Docker i Docker Compose są dostępne${NC}"
# Funkcja do sprawdzania statusu kontenera
check_container() {
local container_name=$1
local max_attempts=30
local attempt=1
echo -e "${YELLOW}Sprawdzanie kontenera: $container_name...${NC}"
while [ $attempt -le $max_attempts ]; do
if docker ps | grep -q "$container_name"; then
echo -e "${GREEN}✅ $container_name jest uruchomiony${NC}"
return 0
fi
echo "⏳ Próba $attempt/$max_attempts - czekanie na $container_name..."
sleep 2
((attempt++))
done
echo -e "${RED}❌ $container_name nie uruchomił się w oczekiwanym czasie${NC}"
return 1
}
# Zatrzymaj istniejące kontenery
echo -e "${YELLOW}🛑 Zatrzymywanie istniejących kontenerów...${NC}"
docker-compose down
# Uruchom infrastrukturę
echo -e "${BLUE}🏗️ Uruchamianie infrastruktury...${NC}"
docker-compose up -d mongodb postgres redis elasticsearch zookeeper kafka
# Sprawdź statusy infrastruktury
check_container "invoice_mongodb"
check_container "invoice_postgres"
check_container "invoice_redis"
check_container "invoice_elasticsearch"
check_container "invoice_kafka"
echo -e "${YELLOW}⏳ Czekanie 10 sekund na stabilizację infrastruktury...${NC}"
sleep 10
# Uruchom mikroserwisy
echo -e "${BLUE}🎯 Uruchamianie mikroserwisów...${NC}"
docker-compose up -d auth-service invoice-service product-service analytics-service notification-service utility-service-php
# Sprawdź statusy mikroserwisów
check_container "invoice_auth_service"
check_container "invoice_invoice_service"
check_container "invoice_product_service"
check_container "invoice_analytics_service"
check_container "invoice_notification_service"
check_container "invoice_utility_service"
# Uruchom API Gateway
echo -e "${BLUE}🌐 Uruchamianie API Gateway...${NC}"
docker-compose up -d api-gateway
check_container "invoice_api_gateway"
# Uruchom frontend
echo -e "${BLUE}💻 Uruchamianie Frontend...${NC}"
docker-compose up -d frontend
check_container "invoice_v2_react"
# Uruchom monitoring
echo -e "${BLUE}📊 Uruchamianie monitoringu...${NC}"
docker-compose up -d kibana kafka-ui
check_container "invoice_kibana"
check_container "invoice_kafka_ui"
echo -e "${GREEN}🎉 Wszystkie serwisy zostały uruchomione!${NC}"
echo -e "${BLUE}📋 Status serwisów:${NC}"
echo "=================="
docker-compose ps
echo -e "\n${BLUE}🔗 Dostępne endpointy:${NC}"
echo "======================"
echo -e "${GREEN}Frontend:${NC} http://localhost:3001"
echo -e "${GREEN}API Gateway:${NC} http://localhost:5000"
echo -e "${GREEN}Swagger UI:${NC} http://localhost:5000/api-docs"
echo -e "${GREEN}Product Service:${NC} http://localhost:3003"
echo -e "${GREEN}Notification Service:${NC} http://localhost:3004"
echo -e "${GREEN}Utility Service:${NC} http://localhost:3005"
echo -e "${GREEN}Kibana:${NC} http://localhost:5601"
echo -e "${GREEN}Kafka UI:${NC} http://localhost:8080"
echo -e "\n${BLUE}📊 Bazy danych:${NC}"
echo "==============="
echo -e "${GREEN}PostgreSQL:${NC} localhost:5433"
echo -e "${GREEN}MongoDB:${NC} localhost:27017"
echo -e "${GREEN}Redis:${NC} localhost:6379"
echo -e "${GREEN}Elasticsearch:${NC} localhost:9200"
echo -e "\n${YELLOW}💡 Aby zatrzymać wszystkie serwisy, uruchom:${NC}"
echo " ./stop-all-microservices.sh"
echo " lub"
echo " docker-compose down"
echo -e "\n${GREEN}🎯 System mikroserwisów InvoiceApp jest gotowy do użycia!${NC}"