Skip to content

Commit

Permalink
Merge pull request #970 from iotaledger/feat/minimal-docker-network
Browse files Browse the repository at this point in the history
Add option to run a minimal docker network
  • Loading branch information
muXxer authored May 14, 2024
2 parents c58790e + 43b6e3e commit 857a7cd
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 9 deletions.
47 changes: 47 additions & 0 deletions tools/docker-network/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ services:
--prometheus.goMetrics=true
--prometheus.processMetrics=true
--debugAPI.enabled=true
profiles:
- minimal
- full

node-2-validator:
image: docker-network-node-1-validator:latest
Expand Down Expand Up @@ -68,6 +71,8 @@ services:
--inx.bindAddress=0.0.0.0:9029
--prometheus.goMetrics=true
--prometheus.processMetrics=true
profiles:
- full

node-3-validator:
image: docker-network-node-1-validator:latest
Expand Down Expand Up @@ -100,6 +105,8 @@ services:
--inx.bindAddress=0.0.0.0:9029
--prometheus.goMetrics=true
--prometheus.processMetrics=true
profiles:
- full

node-4-validator:
image: docker-network-node-1-validator:latest
Expand Down Expand Up @@ -130,6 +137,8 @@ services:
--node.alias=node-4-validator
--inx.enabled=true
--inx.bindAddress=0.0.0.0:9029
profiles:
- full

node-5:
image: docker-network-node-1-validator:latest
Expand Down Expand Up @@ -162,6 +171,8 @@ services:
--inx.bindAddress=0.0.0.0:9029
--prometheus.goMetrics=true
--prometheus.processMetrics=true
profiles:
- full

node-6:
image: docker-network-node-1-validator:latest
Expand Down Expand Up @@ -194,6 +205,8 @@ services:
--inx.bindAddress=0.0.0.0:9029
--prometheus.goMetrics=true
--prometheus.processMetrics=true
profiles:
- full

##################################################################
# Monitoring #
Expand Down Expand Up @@ -255,6 +268,9 @@ services:
--inx.address=node-1-validator:9029
--restAPI.bindAddress=0.0.0.0:9091
--restAPI.advertiseAddress=inx-indexer:9091
profiles:
- minimal
- full

inx-mqtt:
image: iotaledger/inx-mqtt:2.0-alpha
Expand All @@ -268,6 +284,9 @@ services:
command: >
--inx.address=node-1-validator:9029
--mqtt.websocket.bindAddress=inx-mqtt:1888
profiles:
- minimal
- full

inx-blockissuer:
image: iotaledger/inx-blockissuer:1.0-alpha
Expand All @@ -287,6 +306,9 @@ services:
--restAPI.bindAddress=inx-blockissuer:9086
--blockIssuer.accountAddress=rms1prkursay9fs2qjmfctamd6yxg9x8r3ry47786x0mvwek4qr9xd9d5c6gkun
--blockIssuer.proofOfWork.targetTrailingZeros=5
profiles:
- minimal
- full

inx-faucet:
image: iotaledger/inx-faucet:2.0-alpha
Expand Down Expand Up @@ -314,6 +336,9 @@ services:
--faucet.baseTokenAmountMaxTarget=5000000000
--faucet.manaAmount=100000000
--faucet.manaAmountMinFaucet=1000000000
profiles:
- minimal
- full

inx-validator-1:
image: iotaledger/inx-validator:1.0-alpha
Expand All @@ -332,6 +357,9 @@ services:
--validator.ignoreBootstrapped=true
--validator.accountAddress=rms1pzg8cqhfxqhq7pt37y8cs4v5u4kcc48lquy2k73ehsdhf5ukhya3y5rx2w6
--validator.issueCandidacyPayload=${ISSUE_CANDIDACY_PAYLOAD_V1:-true}
profiles:
- minimal
- full

inx-validator-2:
image: iotaledger/inx-validator:1.0-alpha
Expand All @@ -349,6 +377,8 @@ services:
--inx.address=node-2-validator:9029
--validator.accountAddress=rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl
--validator.issueCandidacyPayload=${ISSUE_CANDIDACY_PAYLOAD_V2:-true}
profiles:
- full

inx-validator-3:
image: iotaledger/inx-validator:1.0-alpha
Expand All @@ -366,6 +396,8 @@ services:
--inx.address=node-3-validator:9029
--validator.accountAddress=rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt
--validator.issueCandidacyPayload=${ISSUE_CANDIDACY_PAYLOAD_V3:-true}
profiles:
- full

inx-validator-4:
image: iotaledger/inx-validator:1.0-alpha
Expand All @@ -383,6 +415,8 @@ services:
--inx.address=node-4-validator:9029
--validator.accountAddress=rms1pr8cxs3dzu9xh4cduff4dd4cxdthpjkpwmz2244f75m0urslrsvtsshrrjw
--validator.issueCandidacyPayload=${ISSUE_CANDIDACY_PAYLOAD_V4:-true}
profiles:
- full

inx-dashboard-1:
container_name: inx-dashboard-1
Expand All @@ -402,6 +436,9 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- minimal
- full

inx-dashboard-2:
container_name: inx-dashboard-2
Expand All @@ -421,6 +458,8 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- full

inx-dashboard-3:
container_name: inx-dashboard-3
Expand All @@ -440,6 +479,8 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- full

inx-dashboard-4:
container_name: inx-dashboard-4
Expand All @@ -459,6 +500,8 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- full

inx-dashboard-5:
container_name: inx-dashboard-5
Expand All @@ -478,6 +521,8 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- full

inx-dashboard-6:
container_name: inx-dashboard-6
Expand All @@ -497,6 +542,8 @@ services:
- "--dashboard.auth.username=${DASHBOARD_USERNAME:-admin}"
- "--dashboard.auth.passwordHash=${DASHBOARD_PASSWORD:-0000000000000000000000000000000000000000000000000000000000000000}"
- "--dashboard.auth.passwordSalt=${DASHBOARD_SALT:-0000000000000000000000000000000000000000000000000000000000000000}"
profiles:
- full

# Create our own network
networks:
Expand Down
43 changes: 34 additions & 9 deletions tools/docker-network/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@
# Create a function to join an array of strings by a given character
function join { local IFS="$1"; shift; echo "$*"; }

# All parameters can be optional now, just make sure we don't have too many
if [[ $# -gt 2 ]] ; then
echo 'Call with ./run.sh [monitoring=0|1]'
exit 0
fi

MONITORING=${1:-0}
# Initialize variables
MONITORING=0
MINIMAL=0

# Loop over all arguments
for arg in "$@"
do
case $arg in
monitoring=*)
MONITORING="${arg#*=}"
shift
;;
minimal=*)
MINIMAL="${arg#*=}"
shift
;;
*)
# Unknown option
echo "Unknown argument: $arg"
echo 'Call with ./run.sh [monitoring=0|1] [minimal=0|1]'
exit 1
;;
esac
done

export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
Expand Down Expand Up @@ -66,13 +83,21 @@ fi
chmod o+r docker-network-snapshots/snapshot.bin

echo "Run iota-core network"
# IOTA_CORE_PEER_REPLICAS is used in docker-compose.yml to determine how many replicas to create
export IOTA_CORE_PEER_REPLICAS=$REPLICAS

# Profiles is created to set which docker profiles to run
# https://docs.docker.com/compose/profiles/
PROFILES=()
if [ $MONITORING -ne 0 ]; then
PROFILES+=("monitoring")
echo "Monitoring profile active"
fi

if [ $MINIMAL -ne 0 ]; then
PROFILES+=("minimal")
echo "Minimal profile active"
else
PROFILES+=("full")
echo "Full profile active"
fi

export COMPOSE_PROFILES=$(join , ${PROFILES[@]})
Expand Down

0 comments on commit 857a7cd

Please sign in to comment.