hackerrun 0.1.2 → 0.1.7
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/dist/index.js +15 -6
- package/package.json +1 -1
- package/src/lib/cluster.ts +15 -6
package/dist/index.js
CHANGED
|
@@ -800,6 +800,12 @@ var ClusterManager = class {
|
|
|
800
800
|
const setupScript = `#!/bin/bash
|
|
801
801
|
set -e
|
|
802
802
|
|
|
803
|
+
# Install jq if not present (needed to merge Docker config)
|
|
804
|
+
if ! command -v jq &> /dev/null; then
|
|
805
|
+
apt-get update -qq
|
|
806
|
+
apt-get install -y -qq jq
|
|
807
|
+
fi
|
|
808
|
+
|
|
803
809
|
# Step 1: Add IPv6 support to Docker daemon config
|
|
804
810
|
DAEMON_JSON='/etc/docker/daemon.json'
|
|
805
811
|
if [ -f "$DAEMON_JSON" ]; then
|
|
@@ -840,18 +846,21 @@ systemctl restart docker
|
|
|
840
846
|
sleep 3
|
|
841
847
|
|
|
842
848
|
# Step 4: Recreate uncloud network with IPv6 enabled
|
|
849
|
+
# Must stop containers first - can't remove network while containers are attached
|
|
843
850
|
CONTAINERS=$(docker ps -aq --filter network=uncloud 2>/dev/null || true)
|
|
844
851
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
852
|
+
if [ -n "$CONTAINERS" ]; then
|
|
853
|
+
echo "Stopping containers on uncloud network..."
|
|
854
|
+
docker stop $CONTAINERS 2>/dev/null || true
|
|
855
|
+
fi
|
|
848
856
|
|
|
849
857
|
docker network rm uncloud 2>/dev/null || true
|
|
850
858
|
docker network create --driver bridge --subnet 10.210.0.0/24 --gateway 10.210.0.1 --ipv6 --subnet fd00:a10:210::/64 --gateway fd00:a10:210::1 uncloud
|
|
851
859
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
860
|
+
if [ -n "$CONTAINERS" ]; then
|
|
861
|
+
echo "Restarting containers..."
|
|
862
|
+
docker start $CONTAINERS 2>/dev/null || true
|
|
863
|
+
fi
|
|
855
864
|
|
|
856
865
|
# Step 5: Start the iptables service
|
|
857
866
|
systemctl start docker-ipv6-nat64
|
package/package.json
CHANGED
package/src/lib/cluster.ts
CHANGED
|
@@ -366,6 +366,12 @@ export class ClusterManager {
|
|
|
366
366
|
const setupScript = `#!/bin/bash
|
|
367
367
|
set -e
|
|
368
368
|
|
|
369
|
+
# Install jq if not present (needed to merge Docker config)
|
|
370
|
+
if ! command -v jq &> /dev/null; then
|
|
371
|
+
apt-get update -qq
|
|
372
|
+
apt-get install -y -qq jq
|
|
373
|
+
fi
|
|
374
|
+
|
|
369
375
|
# Step 1: Add IPv6 support to Docker daemon config
|
|
370
376
|
DAEMON_JSON='/etc/docker/daemon.json'
|
|
371
377
|
if [ -f "$DAEMON_JSON" ]; then
|
|
@@ -406,11 +412,13 @@ systemctl restart docker
|
|
|
406
412
|
sleep 3
|
|
407
413
|
|
|
408
414
|
# Step 4: Recreate uncloud network with IPv6 enabled
|
|
415
|
+
# Must stop containers first - can't remove network while containers are attached
|
|
409
416
|
CONTAINERS=$(docker ps -aq --filter network=uncloud 2>/dev/null || true)
|
|
410
417
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
if [ -n "$CONTAINERS" ]; then
|
|
419
|
+
echo "Stopping containers on uncloud network..."
|
|
420
|
+
docker stop $CONTAINERS 2>/dev/null || true
|
|
421
|
+
fi
|
|
414
422
|
|
|
415
423
|
docker network rm uncloud 2>/dev/null || true
|
|
416
424
|
docker network create --driver bridge \
|
|
@@ -418,9 +426,10 @@ docker network create --driver bridge \
|
|
|
418
426
|
--ipv6 --subnet fd00:a10:210::/64 --gateway fd00:a10:210::1 \
|
|
419
427
|
uncloud
|
|
420
428
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
429
|
+
if [ -n "$CONTAINERS" ]; then
|
|
430
|
+
echo "Restarting containers..."
|
|
431
|
+
docker start $CONTAINERS 2>/dev/null || true
|
|
432
|
+
fi
|
|
424
433
|
|
|
425
434
|
# Step 5: Start the iptables service
|
|
426
435
|
systemctl start docker-ipv6-nat64
|