-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.sh
More file actions
executable file
·98 lines (92 loc) · 2.86 KB
/
compose.sh
File metadata and controls
executable file
·98 lines (92 loc) · 2.86 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
#!/bin/bash
# Docker Compose wrapper with plugin container management
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
show_help() {
echo "Usage: $0 <command> [options]"
echo ""
echo "Enhanced docker compose wrapper that properly manages plugin containers"
echo ""
echo "Commands:"
echo " up [options] Start the bot (same as docker compose up)"
echo " down [options] Stop the bot and all plugin containers"
echo " stop [options] Stop the bot and all plugin containers"
echo " restart Restart the bot and all plugin containers"
echo " logs [options] Show logs (same as docker compose logs)"
echo " ps [options] Show container status including plugins"
echo " * Pass through to docker compose"
echo ""
echo "Examples:"
echo " $0 up -d Start bot in background"
echo " $0 down Stop bot and all plugins"
echo " $0 logs -f Follow bot logs"
echo " $0 ps Show all containers"
}
cleanup_plugins() {
echo "🔍 Cleaning up plugin containers..."
if [ -x "./stop_all_plugins.sh" ]; then
./stop_all_plugins.sh
else
echo "⚠️ stop_all_plugins.sh not found or not executable"
fi
}
show_status() {
echo "📊 Container Status:"
echo ""
echo "🤖 Main Bot:"
docker ps --filter "name=simplex-bot-v2" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" 2>/dev/null || echo " No bot containers running"
echo ""
echo "🔌 Plugin Containers:"
docker ps --filter "label=simplex.plugin" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" 2>/dev/null || echo " No plugin containers running"
}
case "$1" in
"help"|"-h"|"--help")
show_help
;;
"up")
echo "🚀 Starting SimplexBot..."
shift
docker compose up "$@"
;;
"down")
echo "🛑 Stopping SimplexBot and plugins..."
shift
docker compose down "$@"
cleanup_plugins
echo "✅ All containers stopped"
;;
"stop")
echo "🛑 Stopping SimplexBot and plugins..."
shift
docker compose stop "$@"
cleanup_plugins
echo "✅ All containers stopped"
;;
"restart")
echo "🔄 Restarting SimplexBot and plugins..."
docker compose down
cleanup_plugins
echo "⏳ Waiting 2 seconds..."
sleep 2
docker compose up -d
echo "✅ SimplexBot restarted"
;;
"ps"|"status")
shift
show_status
if [ "$1" != "--no-compose" ]; then
echo ""
echo "📋 Compose Services:"
docker compose ps "$@"
fi
;;
"logs")
shift
docker compose logs "$@"
;;
*)
# Pass through to docker compose
docker compose "$@"
;;
esac