Skip to content

Commit 7d9a90c

Browse files
committed
Better IPFS?
1 parent e2d5e29 commit 7d9a90c

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

examples/justfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,13 @@ ipfs-start test_dir: _check-docker
216216
#!/usr/bin/env bash
217217
set -e
218218
echo "🐳 Starting IPFS Docker container..."
219-
219+
220220
# Pull latest kubo image if not present
221221
docker pull ipfs/kubo:latest
222222

223+
# Remove old volume to start fresh (no cached peers)
224+
docker volume rm ipfs-data 2>/dev/null || true
225+
223226
# Determine network mode based on OS
224227
if [[ "$OSTYPE" == "darwin"* ]]; then
225228
# macOS - use bridge with port mapping
@@ -229,22 +232,32 @@ ipfs-start test_dir: _check-docker
229232
NETWORK_ARGS="--network host"
230233
fi
231234

232-
# Start Docker container
235+
# Start container - daemon will init and start
233236
docker run -d --name ipfs-node -v ipfs-data:/data/ipfs $NETWORK_ARGS ipfs/kubo:latest
234237
echo " Container: ipfs-node (network: $NETWORK_ARGS)"
235-
echo " Waiting for container to start..."
238+
echo " Waiting for IPFS to initialize..."
236239
sleep 5
237-
docker exec ipfs-node ipfs --version
238-
# Remove all bootstrap peers
240+
241+
# Stop daemon to apply config changes before it connects to peers
242+
echo " Stopping daemon to configure..."
243+
docker exec ipfs-node ipfs shutdown || true
244+
sleep 2
245+
246+
# Configure IPFS for isolated mode (no external peer discovery)
247+
echo " Configuring isolated mode..."
239248
docker exec ipfs-node ipfs bootstrap rm --all
240-
# Disable DHT (prevents peer discovery)
241249
docker exec ipfs-node ipfs config --json Routing.Type '"none"'
242-
# Disable mDNS local discovery
243250
docker exec ipfs-node ipfs config --json Discovery.MDNS.Enabled false
244-
# Restart IPFS to apply changes
251+
docker exec ipfs-node ipfs config --json Swarm.RelayClient.Enabled false
252+
docker exec ipfs-node ipfs config --json Swarm.RelayService.Enabled false
253+
254+
# Restart container to start daemon with clean config
255+
echo " Starting daemon with isolated config..."
245256
docker restart ipfs-node
246257
sleep 5
247258

259+
docker exec ipfs-node ipfs --version
260+
248261
# Bitswap logging
249262
docker logs -f ipfs-node > {{ test_dir }}/ipfs-node.log 2>&1 &
250263
docker exec ipfs-node ipfs log level bitswap debug

0 commit comments

Comments
 (0)