This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
M5.sh
executable file
·75 lines (59 loc) · 2.13 KB
/
M5.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# name of the docker image
DOCKER_IMAGE=scssubstratee/substratee:M5.2
# clone the rust-sgx-sdk (used to run the substratee-worker in the docker)
git clone https://github.com/baidu/rust-sgx-sdk.git
# get the substraTEE docker image from docker hub
docker pull $DOCKER_IMAGE
# if you want to build the docker image yourself, use the following command:
# docker build -t substratee -f DockerfileM5 .
# prepare the docker specific network
docker network rm substratee-net
docker network create --subnet 192.168.10.0/24 substratee-net
# prepare the output log directory
mkdir -p output
# start the tmux session
SESSION=substraTEEM5Demo
tmux has-session -t $SESSION
if [ $? != 0 ]
then
tmux -2 new -d -s $SESSION -n "substraTEE M5 Demo"
# create a window split by 3
tmux split-window -v
tmux split-window -h
# enable pane titles
tmux set -g pane-border-status top
# set length of left status to 50
tmux set -g status-left-length 50
# color the panes
tmux select-pane -t 1 -P 'fg=colour073' # node
tmux select-pane -t 2 -P 'fg=colour011' # client
tmux select-pane -t 3 -P 'fg=colour043' # worker 1
# start the substratee-node in pane 1
tmux send-keys -t1 "docker run -ti \
--ip=192.168.10.10 \
--network=substratee-net \
-v $(pwd)/output:/substraTEE/output \
$DOCKER_IMAGE \
\"/substraTEE/start_node.sh\"" Enter
# start the substratee-worker in pane 2
tmux send-keys -t2 "docker run -ti \
--ip=192.168.10.21 \
--network=substratee-net \
--device /dev/isgx \
-v $(pwd)/output:/substraTEE/output \
-v $(pwd)/rust-sgx-sdk:/root/sgx \
-v /var/run/aesmd:/var/run/aesmd \
-v $(pwd)/intel_cert:/substraTEE/intel_cert \
$DOCKER_IMAGE \
\"/substraTEE/start_worker.sh\"" Enter
# start the substratee-client in pane 3
tmux send-keys -t3 "docker run -ti \
--ip=192.168.10.30 \
--network=substratee-net \
-v $(pwd)/output:/substraTEE/output \
$DOCKER_IMAGE \
\"/substraTEE/start_client.sh\"" Enter
fi
# Attach to session
tmux attach -t $SESSION