@geekbeer/minion 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +1 -1
- package/README.md +1 -1
- package/config.js +1 -1
- package/minion-cli.sh +18 -18
- package/package.json +1 -1
- package/server.js +3 -3
package/.env.example
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# (no heartbeat, no HQ communication).
|
|
6
6
|
|
|
7
7
|
# HQ URL (optional) - The URL of the HQ server
|
|
8
|
-
# For managed service: https://minion.
|
|
8
|
+
# For managed service: https://minion-agent.com
|
|
9
9
|
# For local Docker development: http://host.docker.internal:3000
|
|
10
10
|
HQ_URL=
|
|
11
11
|
|
package/README.md
CHANGED
package/config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minion Agent Configuration
|
|
3
3
|
*
|
|
4
4
|
* Optional environment variables (for HQ connection):
|
|
5
|
-
* - HQ_URL: The URL of the HQ server (e.g., https://minion.
|
|
5
|
+
* - HQ_URL: The URL of the HQ server (e.g., https://minion-agent.com)
|
|
6
6
|
* - API_TOKEN: The API token for this minion (obtained from dashboard)
|
|
7
7
|
* - MINION_ID: The minion's UUID (assigned by HQ)
|
|
8
8
|
*
|
package/minion-cli.sh
CHANGED
|
@@ -257,23 +257,6 @@ SUPEOF
|
|
|
257
257
|
fi
|
|
258
258
|
fi
|
|
259
259
|
|
|
260
|
-
# Notify HQ if configured
|
|
261
|
-
if [ -n "$HQ_URL" ] && [ -n "$API_TOKEN" ]; then
|
|
262
|
-
echo ""
|
|
263
|
-
echo "Notifying HQ of setup completion..."
|
|
264
|
-
local NOTIFY_RESPONSE
|
|
265
|
-
NOTIFY_RESPONSE=$(curl -sf -X POST "${HQ_URL}/api/minion/setup-complete" \
|
|
266
|
-
-H "Content-Type: application/json" \
|
|
267
|
-
-H "Authorization: Bearer ${API_TOKEN}" \
|
|
268
|
-
-d "{}" 2>&1) || true
|
|
269
|
-
|
|
270
|
-
if echo "$NOTIFY_RESPONSE" | grep -q '"success":true' 2>/dev/null; then
|
|
271
|
-
echo " -> HQ notified successfully"
|
|
272
|
-
else
|
|
273
|
-
echo " -> HQ notification skipped (HQ may not be reachable)"
|
|
274
|
-
fi
|
|
275
|
-
fi
|
|
276
|
-
|
|
277
260
|
# Step 6 (optional): Cloudflare Tunnel setup
|
|
278
261
|
if [ "$SETUP_TUNNEL" = true ]; then
|
|
279
262
|
echo ""
|
|
@@ -299,7 +282,7 @@ SUPEOF
|
|
|
299
282
|
# Response contains credentials_json and config_yml (generated server-side)
|
|
300
283
|
echo " Fetching tunnel configuration from HQ..."
|
|
301
284
|
local TUNNEL_DATA
|
|
302
|
-
TUNNEL_DATA=$(curl -
|
|
285
|
+
TUNNEL_DATA=$(curl -sfL -H "Authorization: Bearer ${API_TOKEN}" \
|
|
303
286
|
"${HQ_URL}/api/minion/tunnel-credentials" 2>&1) || true
|
|
304
287
|
|
|
305
288
|
if [ -z "$TUNNEL_DATA" ] || ! echo "$TUNNEL_DATA" | jq -e '.tunnel_id' > /dev/null 2>&1; then
|
|
@@ -331,6 +314,23 @@ SUPEOF
|
|
|
331
314
|
fi
|
|
332
315
|
fi
|
|
333
316
|
|
|
317
|
+
# Notify HQ if configured (after all steps including tunnel setup)
|
|
318
|
+
if [ -n "$HQ_URL" ] && [ -n "$API_TOKEN" ]; then
|
|
319
|
+
echo ""
|
|
320
|
+
echo "Notifying HQ of setup completion..."
|
|
321
|
+
local NOTIFY_RESPONSE
|
|
322
|
+
NOTIFY_RESPONSE=$(curl -sfL -X POST "${HQ_URL}/api/minion/setup-complete" \
|
|
323
|
+
-H "Content-Type: application/json" \
|
|
324
|
+
-H "Authorization: Bearer ${API_TOKEN}" \
|
|
325
|
+
-d "{}" 2>&1) || true
|
|
326
|
+
|
|
327
|
+
if echo "$NOTIFY_RESPONSE" | grep -q '"success":true' 2>/dev/null; then
|
|
328
|
+
echo " -> HQ notified successfully"
|
|
329
|
+
else
|
|
330
|
+
echo " -> HQ notification skipped (HQ may not be reachable)"
|
|
331
|
+
fi
|
|
332
|
+
fi
|
|
333
|
+
|
|
334
334
|
echo ""
|
|
335
335
|
echo "========================================="
|
|
336
336
|
echo " Setup Complete!"
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -53,12 +53,12 @@ function buildAllowedCommands() {
|
|
|
53
53
|
deferred: true,
|
|
54
54
|
}
|
|
55
55
|
commands['restart-display'] = {
|
|
56
|
-
description: 'Restart Xvfb and noVNC services',
|
|
57
|
-
command: `${SUDO}systemctl restart xvfb novnc`,
|
|
56
|
+
description: 'Restart Xvfb, Fluxbox, x11vnc and noVNC services',
|
|
57
|
+
command: `${SUDO}systemctl restart xvfb fluxbox x11vnc novnc`,
|
|
58
58
|
}
|
|
59
59
|
commands['status-services'] = {
|
|
60
60
|
description: 'Check status of all services',
|
|
61
|
-
command: 'systemctl status minion-agent xvfb novnc --no-pager',
|
|
61
|
+
command: 'systemctl status minion-agent xvfb fluxbox x11vnc novnc --no-pager',
|
|
62
62
|
}
|
|
63
63
|
} else if (PROC_MGR === 'supervisord') {
|
|
64
64
|
commands['restart-agent'] = {
|