diff --git a/docker-compose.yml b/docker-compose.yml index 375664a..c5dc047 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,25 +11,12 @@ services: build: context: i2p depends_on: - - i2pd-floodfill1 - - i2pd-floodfill2 + - i2pd-floodfill networks: - no_internet volumes: - netdb:/var/lib/i2p/i2p-config/netDb - i2pd-server: - build: - context: i2p - depends_on: - - i2pd-floodfill1 - - i2pd-floodfill2 - networks: - no_internet: - ipv4_address: 172.16.200.10 - volumes: - - netdb:/var/lib/i2p/i2p-config/netDb - contained: build: context: contained/ @@ -39,6 +26,8 @@ services: - NET_RAW depends_on: - i2pd + environment: + PROXY_SAM_HOST: 172.16.200.3 # First floodfill volumes: - /tmp/contained:/mount - ./contained/bin:/opt/bin @@ -46,19 +35,8 @@ services: no_internet: ipv4_address: 172.16.200.20 - i2pd-floodfill1: - build: - context: i2p - args: - FLOODFILL: "true" - depends_on: - - volume_setup - networks: - - no_internet - volumes: - - netdb:/var/lib/i2p/i2p-config/netDb - - i2pd-floodfill2: + # Must have at least 2! + i2pd-floodfill: build: context: i2p args: diff --git a/scripts/testnet.sh b/scripts/testnet.sh index ce4e229..1eaa6e2 100755 --- a/scripts/testnet.sh +++ b/scripts/testnet.sh @@ -12,39 +12,44 @@ IFS=$'\n\t' routerCount=${1:-2} WAIT_TIME=60 +FLOODFILL_COUNT=2 _log(){ echo "====$1" } _execAll(){ - for i in $(seq 1 ${routerCount}) + service=$1 ; shift + serviceCount=$1 ; shift + for i in $(seq 1 ${serviceCount}) do - _log "==Router $i" - docker-compose exec --index $i i2pd "$@" + _log "==$service $i" + docker-compose exec --index $i $service "$@" done } _log "Clean everything" docker-compose down -v --remove-orphans -_log "Start up ${routerCount} router(s)" -docker-compose up -d --scale i2pd=${routerCount} +_log "Start up ${routerCount} router(s) and ${FLOODFILL_COUNT} floodfills" +docker-compose up -d --scale i2pd=${routerCount} --scale=i2pd-floodfill=${FLOODFILL_COUNT} +totalRouterCount=$(( $routerCount + $FLOODFILL_COUNT )) riCount=0 - -while [ $riCount != $routerCount ]; do +while [ $riCount != $totalRouterCount ]; do _log "Waiting ${WAIT_TIME} seconds out of courtesy" sleep ${WAIT_TIME}s _log "Gracefully shut them down to store their routerInfo (RI) in the netDb" - _execAll i2prouter stop + _execAll i2pd-floodfill ${FLOODFILL_COUNT} i2prouter stop + _execAll i2pd ${routerCount} i2prouter stop _log "Starting all routers back up" sleep 5s + docker-compose start i2pd-floodfill docker-compose start i2pd - _log "Contents of netDb (expecting ${routerCount} entries)" + _log "Contents of netDb (expecting ${totalRouterCount} entries)" netDbOutput="$(docker-compose exec i2pd find netDb -name '*.dat')" riCount=$(echo "${netDbOutput[@]}" | grep routerInfo | wc -l) _log "Found $riCount entries:"