-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-utils.psm1
More file actions
42 lines (34 loc) · 1.13 KB
/
docker-utils.psm1
File metadata and controls
42 lines (34 loc) · 1.13 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
# Start all services
function Start-Services {
Write-Host "Starting application services..."
docker-compose up -d
Write-Host "Starting monitoring services..."
docker-compose -f docker-compose.monitoring.yml up -d
}
# Stop all services
function Stop-Services {
Write-Host "Stopping monitoring services..."
docker-compose -f docker-compose.monitoring.yml down
Write-Host "Stopping application services..."
docker-compose down
}
# Check service status
function Get-ServicesStatus {
Write-Host "Application Services Status:"
docker-compose ps
Write-Host "`nMonitoring Services Status:"
docker-compose -f docker-compose.monitoring.yml ps
}
# View logs
function Get-ServiceLogs {
param (
[Parameter(Mandatory=$true)]
[string]$Service
)
if ($Service -in @("prometheus", "grafana", "node-exporter", "cadvisor")) {
docker-compose -f docker-compose.monitoring.yml logs --tail=100 -f $Service
} else {
docker-compose logs --tail=100 -f $Service
}
}
Export-ModuleMember -Function Start-Services, Stop-Services, Get-ServicesStatus, Get-ServiceLogs