forked from cnoe-io/ai-platform-engineering
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·210 lines (178 loc) · 5.97 KB
/
deploy.sh
File metadata and controls
executable file
·210 lines (178 loc) · 5.97 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
# Check for stop command
if [ "$1" = "stop" ]; then
echo "Stopping all services..."
docker compose -f docker-compose.yaml --profile a2a-p2p --profile a2a-over-slim down
exit 0
fi
# Check for detached mode argument (default to detached)
DETACHED="yes"
if [ "$1" = "--no-detach" ] || [ "$1" = "-f" ]; then
DETACHED="no"
fi
# Load environment variables from .env file
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
# Check transport mode (default to p2p)
TRANSPORT=${A2A_TRANSPORT:-p2p}
# Get currently running services
RUNNING_SERVICES=$(docker compose -f docker-compose.yaml ps --services 2>/dev/null || echo "")
# Build list of services that should be running
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="platform-engineer-slim slim-dataplane slim-control-plane"
else
SHOULD_RUN="platform-engineer-p2p"
fi
if [ "$ENABLE_AGENT_FORGE" = "true" ]; then
SHOULD_RUN="$SHOULD_RUN backstage-agent-forge"
fi
if [ "$ENABLE_GITHUB" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-github-slim"
else
SHOULD_RUN="$SHOULD_RUN agent-github-p2p"
fi
fi
if [ "$ENABLE_WEATHER" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-weather-slim"
else
SHOULD_RUN="$SHOULD_RUN agent-weather-p2p"
fi
fi
if [ "$ENABLE_BACKSTAGE" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-backstage-slim mcp-backstage"
else
SHOULD_RUN="$SHOULD_RUN agent-backstage-p2p mcp-backstage"
fi
fi
if [ "$ENABLE_ARGOCD" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-argocd-slim mcp-argocd"
else
SHOULD_RUN="$SHOULD_RUN agent-argocd-p2p mcp-argocd"
fi
fi
if [ "$ENABLE_CONFLUENCE" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-confluence-slim mcp-confluence"
else
SHOULD_RUN="$SHOULD_RUN agent-confluence-p2p mcp-confluence"
fi
fi
if [ "$ENABLE_JIRA" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-jira-slim mcp-jira"
else
SHOULD_RUN="$SHOULD_RUN agent-jira-p2p mcp-jira"
fi
fi
if [ "$ENABLE_KOMODOR" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-komodor-slim mcp-komodor"
else
SHOULD_RUN="$SHOULD_RUN agent-komodor-p2p mcp-komodor"
fi
fi
if [ "$ENABLE_PAGERDUTY" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-pagerduty-slim mcp-pagerduty"
else
SHOULD_RUN="$SHOULD_RUN agent-pagerduty-p2p mcp-pagerduty"
fi
fi
if [ "$ENABLE_SLACK" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-slack-slim mcp-slack"
else
SHOULD_RUN="$SHOULD_RUN agent-slack-p2p mcp-slack"
fi
fi
if [ "$ENABLE_SPLUNK" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-splunk-slim mcp-splunk"
else
SHOULD_RUN="$SHOULD_RUN agent-splunk-p2p mcp-splunk"
fi
fi
if [ "$ENABLE_WEBEX" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-webex-slim mcp-webex"
else
SHOULD_RUN="$SHOULD_RUN agent-webex-p2p mcp-webex"
fi
fi
if [ "$ENABLE_AWS" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-aws-slim"
else
SHOULD_RUN="$SHOULD_RUN agent-aws-p2p"
fi
fi
# Add Petstore agent if enabled
if [ "$ENABLE_PETSTORE" = "true" ]; then
if [ "$TRANSPORT" = "slim" ]; then
SHOULD_RUN="$SHOULD_RUN agent-petstore-slim"
else
SHOULD_RUN="$SHOULD_RUN agent-petstore-p2p"
fi
fi
# Add RAG services if enabled
if [ "$ENABLE_RAG" = "true" ]; then
SHOULD_RUN="$SHOULD_RUN rag_server agent_rag rag_webui rag-redis milvus-standalone etcd milvus-minio"
fi
# Add GraphRAG services if enabled
if [ "$ENABLE_GRAPH_RAG" = "true" ]; then
SHOULD_RUN="$SHOULD_RUN rag_server agent_rag rag_webui rag-redis milvus-standalone etcd milvus-minio agent_ontology neo4j neo4j-ontology"
fi
if [ "$ENABLE_TRACING" = "true" ]; then
SHOULD_RUN="$SHOULD_RUN langfuse-worker langfuse-web langfuse-clickhouse langfuse-minio langfuse-redis langfuse-postgres"
fi
# Find services to stop (running but not in should_run list)
TO_STOP=""
for service in $RUNNING_SERVICES; do
if ! echo "$SHOULD_RUN" | grep -q "$service"; then
TO_STOP="$TO_STOP $service"
fi
done
# Stop unwanted services
if [ -n "$TO_STOP" ]; then
echo "Stopping services no longer needed:$TO_STOP"
docker compose -f docker-compose.yaml stop $TO_STOP
docker compose -f docker-compose.yaml rm -f $TO_STOP
fi
echo "Deploying services with $TRANSPORT transport: $SHOULD_RUN"
# Separate platform engineer from other services
PLATFORM_ENGINEER=""
OTHER_SERVICES=""
for service in $SHOULD_RUN; do
if [[ "$service" == "platform-engineer-p2p" || "$service" == "platform-engineer-slim" ]]; then
PLATFORM_ENGINEER="$service"
else
OTHER_SERVICES="$OTHER_SERVICES $service"
fi
done
# Start other services first
if [ -n "$OTHER_SERVICES" ]; then
echo "Starting supporting services: $OTHER_SERVICES"
docker compose -f docker-compose.yaml up -d $OTHER_SERVICES
# Wait for all services to be running
echo "Waiting for services to be ready..."
for service in $OTHER_SERVICES; do
while [ "$(docker compose -f docker-compose.yaml ps -q $service 2>/dev/null | xargs docker inspect -f '{{.State.Status}}' 2>/dev/null)" != "running" ]; do
sleep 1
done
done
echo "All supporting services are running"
fi
# Start platform engineer last
if [ -n "$PLATFORM_ENGINEER" ]; then
echo "Starting platform engineer: $PLATFORM_ENGINEER"
if [ "$DETACHED" = "no" ]; then
docker compose -f docker-compose.yaml up $PLATFORM_ENGINEER
else
docker compose -f docker-compose.yaml up -d $PLATFORM_ENGINEER
fi
fi