Skip to content

Commit

Permalink
Merge pull request #337 from dedis/more-nodes
Browse files Browse the repository at this point in the history
feat: add two nodes
  • Loading branch information
PascalinDe authored Sep 1, 2023
2 parents fa61577 + 940531e commit e8f12ba
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 5 deletions.
42 changes: 42 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,46 @@ services:
networks:
d-voting:
ipv4_address: 172.19.44.252
dela-worker-3: # DELA worker node
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
environment:
PROXYKEY: ${PUBLIC_KEY}
PROXYPORT: ${PROXYPORT}
LLVL: debug
volumes:
- dela-worker-3-data:/data
hostname: dela-worker-3
ports:
- 127.0.0.1:40002:40000
security_opt:
- apparmor:unconfined
cap_add:
- SYS_PTRACE
networks:
d-voting:
ipv4_address: 172.19.44.251
dela-worker-4: # DELA worker node
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
environment:
PROXYKEY: ${PUBLIC_KEY}
PROXYPORT: ${PROXYPORT}
LLVL: debug
volumes:
- dela-worker-4-data:/data
hostname: dela-worker-4
ports:
- 127.0.0.1:40002:40000
security_opt:
- apparmor:unconfined
cap_add:
- SYS_PTRACE
networks:
d-voting:
ipv4_address: 172.19.44.250

frontend: # web service frontend
image: frontend:latest
Expand Down Expand Up @@ -121,6 +161,8 @@ volumes:
dela-worker-0-data:
dela-worker-1-data:
dela-worker-2-data:
dela-worker-3-data:
dela-worker-4-data:
backend-data:

networks:
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,34 @@ services:
networks:
d-voting:
ipv4_address: 172.19.44.252
dela-worker-3: # DELA worker node
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela
environment:
PROXYKEY: ${PUBLIC_KEY}
PROXYPORT: ${PROXYPORT}
LLVL: info
volumes:
- dela-worker-3-data:/data
hostname: dela-worker-3
networks:
d-voting:
ipv4_address: 172.19.44.251
dela-worker-4: # DELA worker node
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela
environment:
PROXYKEY: ${PUBLIC_KEY}
PROXYPORT: ${PROXYPORT}
LLVL: info
volumes:
- dela-worker-4-data:/data
hostname: dela-worker-4
networks:
d-voting:
ipv4_address: 172.19.44.250

frontend: # web service frontend
image: frontend:latest
Expand Down Expand Up @@ -99,6 +127,8 @@ volumes:
dela-worker-0-data:
dela-worker-1-data:
dela-worker-2-data:
dela-worker-3-data:
dela-worker-4-data:
backend-data:

networks:
Expand Down
10 changes: 5 additions & 5 deletions init_dela.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ MEMBERS="";


# share the certificate
for container in dela-worker-1 dela-worker-2; do
for container in dela-worker-1 dela-worker-2 dela-worker-3 dela-worker-4; do
TOKEN_ARGS=$(docker compose exec dela-worker-0 /bin/bash -c 'LLVL=error memcoin --config /data/node minogrpc token');
docker compose exec "$container" memcoin --config /data/node minogrpc join --address //dela-worker-0:2000 $TOKEN_ARGS;
done

# create a new chain with the nodes
for container in dela-worker-0 dela-worker-1 dela-worker-2; do
for container in dela-worker-0 dela-worker-1 dela-worker-2 dela-worker-3 dela-worker-4; do
# add node to the chain
MEMBERS="$MEMBERS --member $(docker compose exec $container /bin/bash -c 'LLVL=error memcoin --config /data/node ordering export')";
done
docker compose exec dela-worker-0 memcoin --config /data/node ordering setup $MEMBERS;

# authorize the signer to handle the access contract on each node
for signer in dela-worker-0 dela-worker-1 dela-worker-2; do
for signer in dela-worker-0 dela-worker-1 dela-worker-2 dela-worker-3 dela-worker-4; do
IDENTITY=$(docker compose exec "$signer" crypto bls signer read --path /data/node/private.key --format BASE64_PUBKEY);
for node in dela-worker-0 dela-worker-1 dela-worker-2; do
for node in dela-worker-0 dela-worker-1 dela-worker-2 dela-worker-3 dela-worker-4; do
docker compose exec "$node" memcoin --config /data/node access add --identity "$IDENTITY";
done
done

# update the access contract
for container in dela-worker-0 dela-worker-1 dela-worker-2; do
for container in dela-worker-0 dela-worker-1 dela-worker-2 dela-worker-3 dela-worker-4; do
IDENTITY=$(docker compose exec "$container" crypto bls signer read --path /data/node/private.key --format BASE64_PUBKEY);
docker compose exec dela-worker-0 memcoin --config /data/node pool add\
--key /data/node/private.key\
Expand Down

0 comments on commit e8f12ba

Please sign in to comment.