-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy.sh
executable file
·71 lines (67 loc) · 1.76 KB
/
deploy.sh
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
#!/bin/bash
# Make script exit on first error
set -e
# Function to display usage instructions
show_usage() {
echo "Usage: ./deploy.sh [COMMAND]"
echo ""
echo "Commands:"
echo " start - Start all services"
echo " stop - Stop all services"
echo " restart - Restart all services"
echo " logs - Show logs from all services"
echo " build - Rebuild all services"
echo " clean - Remove all containers and volumes"
echo " status - Show status of all services"
}
# Check if Docker is running
check_docker() {
if ! docker info > /dev/null 2>&1; then
echo "Error: Docker is not running"
exit 1
fi
}
case "$1" in
"start")
check_docker
echo "Starting RunWatch services..."
docker-compose up -d
echo "Services started successfully!"
;;
"stop")
check_docker
echo "Stopping RunWatch services..."
docker-compose down
echo "Services stopped successfully!"
;;
"restart")
check_docker
echo "Restarting RunWatch services..."
docker-compose restart
echo "Services restarted successfully!"
;;
"logs")
check_docker
docker-compose logs -f
;;
"build")
check_docker
echo "Rebuilding RunWatch services..."
docker-compose build --no-cache
docker-compose up -d
echo "Services rebuilt and started successfully!"
;;
"clean")
check_docker
echo "Removing all containers and volumes..."
docker-compose down -v
echo "Cleanup completed successfully!"
;;
"status")
check_docker
docker-compose ps
;;
*)
show_usage
;;
esac