-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·112 lines (96 loc) · 2.91 KB
/
deploy.sh
File metadata and controls
executable file
·112 lines (96 loc) · 2.91 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
#!/bin/bash
# SentinelPrime Deployment Script
# Deploys the full SentinelPrime stack
set -e
echo "🔐 SentinelPrime Deployment"
echo "======================================"
# Check Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
# Create required directories
echo "📁 Creating directories..."
mkdir -p monitoring/grafana/dashboards
mkdir -p monitoring/grafana/datasources
mkdir -p logs
# Create Prometheus config
echo "📊 Creating Prometheus configuration..."
cat > monitoring/prometheus.yml << EOF
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'sentinel-control-plane'
static_configs:
- targets: ['control-plane:8000']
metrics_path: '/metrics'
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
EOF
# Create Grafana datasource
echo "📈 Creating Grafana datasource..."
cat > monitoring/grafana/datasources/prometheus.yml << EOF
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
EOF
# Create .env file
if [ ! -f .env ]; then
echo "🔧 Creating .env file..."
cat > .env << EOF
# SentinelPrime Configuration
KAFKA_BOOTSTRAP_SERVERS=kafka:9092
NEO4J_URI=bolt://neo4j:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=sentinelprime
REDIS_HOST=redis
REDIS_PORT=6379
AUTO_ENFORCE_ENABLED=false
LOG_LEVEL=INFO
EOF
fi
# Build and start services
echo "🐳 Building and starting Docker containers..."
docker-compose up -d --build
# Wait for services to be ready
echo "⏳ Waiting for services to be ready..."
sleep 10
# Check service health
echo "🏥 Checking service health..."
services=("kafka:9092" "neo4j:7687" "redis:6379" "elasticsearch:9200")
for service in "${services[@]}"; do
IFS=':' read -r host port <<< "$service"
echo "Checking $host:$port..."
timeout 30 bash -c "until docker-compose exec -T $host nc -z localhost $port 2>/dev/null; do sleep 1; done" || echo "⚠️ Warning: $host might not be ready"
done
# Display service URLs
echo ""
echo "✅ SentinelPrime is running!"
echo "======================================"
echo "Control Plane API: http://localhost:8000"
echo "API Documentation: http://localhost:8000/docs"
echo "Kibana: http://localhost:5601"
echo "Grafana: http://localhost:3000 (admin/sentinelprime)"
echo "Neo4j Browser: http://localhost:7474 (neo4j/sentinelprime)"
echo "Prometheus: http://localhost:9090"
echo ""
echo "📝 To view logs:"
echo " docker-compose logs -f control-plane"
echo ""
echo "🛑 To stop:"
echo " docker-compose down"
echo ""
echo "🗑️ To stop and remove volumes:"
echo " docker-compose down -v"
echo ""