From 2222565941bdf2516d1e3e5ae0f97f35dc023b0d Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 30 Aug 2020 01:10:06 -0400 Subject: get deployment scripts to work --- scripts/deploy/app/build.yml | 2 +- scripts/deploy/app/reset.yml | 1 + scripts/deploy/app/run.yml | 2 +- scripts/deploy/clients.txt | 16 ++++++++++++++++ scripts/deploy/gen_all.sh | 2 +- scripts/deploy/gen_inventory.py | 4 +++- scripts/deploy/group_vars/all.yml | 15 ++++++++++++--- scripts/deploy/group_vars/clients.yml | 4 +++- scripts/deploy/replicas.txt | 4 ++++ scripts/gen_conf.py | 17 ++++++++++++++++- 10 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 scripts/deploy/clients.txt create mode 100644 scripts/deploy/replicas.txt diff --git a/scripts/deploy/app/build.yml b/scripts/deploy/app/build.yml index 2a0c24c..af6774e 100644 --- a/scripts/deploy/app/build.yml +++ b/scripts/deploy/app/build.yml @@ -10,7 +10,7 @@ - file: path: "{{ (hs_repo_dir, 'build') | path_join }}" state: absent - - command: cmake -DCMAKE_BUID_TYPE=Release -DHOTSTUFF_PROTO_LOG=OFF -DCMAKE_CXX_FLAGS={{ hs_flags | default('') }} + - command: cmake -DCMAKE_BUID_TYPE=Release -DHOTSTUFF_PROTO_LOG=OFF "-DCMAKE_CXX_FLAGS='{{ hs_flags | default('') }}'" args: chdir: "{{ hs_repo_dir }}" environment: diff --git a/scripts/deploy/app/reset.yml b/scripts/deploy/app/reset.yml index 1b80b27..f1c2873 100644 --- a/scripts/deploy/app/reset.yml +++ b/scripts/deploy/app/reset.yml @@ -7,6 +7,7 @@ - name: reset hotstuff vars: + conf_dir: "{{ (testbed, hs_conf_dir) | path_join }}" log_dir: "{{ (testbed, hs_log_dir) | path_join }}" block: - name: remove confs diff --git a/scripts/deploy/app/run.yml b/scripts/deploy/app/run.yml index 260d611..14a2eb1 100644 --- a/scripts/deploy/app/run.yml +++ b/scripts/deploy/app/run.yml @@ -34,7 +34,7 @@ log_dir: "{{ log_dir }}" cwd: "{{ conf_dir }}" conf: "{{ extra_conf | basename }}" - tls: false + tls: "{{ hs_tls | default(false) }}" environment: PATH: /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin register: spawn_results diff --git a/scripts/deploy/clients.txt b/scripts/deploy/clients.txt new file mode 100644 index 0000000..000cd7a --- /dev/null +++ b/scripts/deploy/clients.txt @@ -0,0 +1,16 @@ +18.225.36.80 +18.225.36.80 +18.225.36.80 +18.225.36.80 +18.225.36.80 +18.225.36.80 +18.225.36.80 +18.225.36.80 +3.17.180.6 +3.17.180.6 +3.17.180.6 +3.17.180.6 +3.17.180.6 +3.17.180.6 +3.17.180.6 +3.17.180.6 diff --git a/scripts/deploy/gen_all.sh b/scripts/deploy/gen_all.sh index 295bf99..cd592cf 100755 --- a/scripts/deploy/gen_all.sh +++ b/scripts/deploy/gen_all.sh @@ -8,4 +8,4 @@ python3 ./gen_inventory.py --prefix 'hotstuff.gen' > nodes.ini awk '{print $2}' replicas.txt > replicas_inter.txt -python ../gen_conf.py --ips replicas_inter.txt --iter 1 --prefix 'hotstuff.gen' --keygen ../../hotstuff-keygen --tls-keygen ../../hotstuff-tls-keygen +python3 ../gen_conf.py --ips replicas_inter.txt --iter 1 --prefix 'hotstuff.gen' --keygen ../../hotstuff-keygen --tls-keygen ../../hotstuff-tls-keygen --block-size 400 diff --git a/scripts/deploy/gen_inventory.py b/scripts/deploy/gen_inventory.py index 23af205..151bf45 100644 --- a/scripts/deploy/gen_inventory.py +++ b/scripts/deploy/gen_inventory.py @@ -31,4 +31,6 @@ if __name__ == "__main__": print("\n[clients]") for (i, ip) in enumerate(clients): - print("client{} ansible_host={} cid={}".format(i, ip, i)) + host_idx = host_idx_count.setdefault(pub_ip, 0) + host_idx_count[pub_ip] += 1 + print("client{} ansible_host={} host_idx={} cid={}".format(i, ip, host_idx, i)) diff --git a/scripts/deploy/group_vars/all.yml b/scripts/deploy/group_vars/all.yml index d9e9a44..13d720f 100644 --- a/scripts/deploy/group_vars/all.yml +++ b/scripts/deploy/group_vars/all.yml @@ -1,15 +1,22 @@ --- ## basic config +# NOTE: change to your aws ec2 key file here +ansible_ssh_private_key_file: ~/.ssh/ted-aws-key2.pem + +# the rest of config works for Ubuntu 18.04 image on Amazon EC2 + ansible_connection: ssh ansible_user: ubuntu -# change to your aws ec2 key file here -ansible_ssh_private_key_file: ~/.ssh/ted-aws-key2.pem # remote directory that keeps the work directory for the running app testbed_prefix: "/home/ubuntu/testbed" +# must use Python 3 +ansible_python_interpreter: /usr/bin/python3 -## app specific config +## build config +hs_flags: "-g -DHOTSTUFF_ENABLE_BENCHMARK" +## app config # process name that is used by killall in reset bin_name: hotstuff-app # binary path (remote) @@ -22,3 +29,5 @@ hs_local_repo_dir: "../../" hs_conf_dir: "conf" hs_log_dir: "log" hs_base_conf: "./hotstuff.gen.conf" +# enable/disable TLS encrpytion for inter-replica communication +hs_tls: false diff --git a/scripts/deploy/group_vars/clients.yml b/scripts/deploy/group_vars/clients.yml index 5c5afd8..57e13ff 100644 --- a/scripts/deploy/group_vars/clients.yml +++ b/scripts/deploy/group_vars/clients.yml @@ -1,4 +1,6 @@ --- bin_name: "hotstuff-client" -max_iter: 100000 +# total number of commands +max_iter: 200000 +# number of concurrently outstanding requests (commands) max_async: 175 diff --git a/scripts/deploy/replicas.txt b/scripts/deploy/replicas.txt new file mode 100644 index 0000000..eee8b20 --- /dev/null +++ b/scripts/deploy/replicas.txt @@ -0,0 +1,4 @@ +3.131.95.69 172.31.21.137 +18.221.35.19 172.31.29.43 +18.217.161.193 172.31.25.133 +18.191.48.38 172.31.25.71 diff --git a/scripts/gen_conf.py b/scripts/gen_conf.py index 428b5b5..8e3be43 100644 --- a/scripts/gen_conf.py +++ b/scripts/gen_conf.py @@ -15,6 +15,11 @@ if __name__ == "__main__": parser.add_argument('--nodes', type=str, default='nodes.txt') parser.add_argument('--block-size', type=int, default=1) parser.add_argument('--pace-maker', type=str, default='dummy') + parser.add_argument('--nworker', type=int, default=4) + parser.add_argument('--repnworker', type=int, default=4) + parser.add_argument('--clinworker', type=int, default=4) + parser.add_argument('--repburst', type=int, default=1000) + parser.add_argument('--cliburst', type=int, default=1000) args = parser.parse_args() @@ -43,8 +48,18 @@ if __name__ == "__main__": tls_p = subprocess.Popen([tls_keygen_bin, '--num', str(len(replicas))], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')) tls_keys = [[t[4:] for t in l.decode('ascii').split()] for l in tls_p.stdout] - if not (args.block_size is None): + if args.block_size is not None: main_conf.write("block-size = {}\n".format(args.block_size)) + if args.nworker is not None: + main_conf.write("nworker = {}\n".format(args.nworker)) + if args.repnworker is not None: + main_conf.write("repnworker = {}\n".format(args.repnworker)) + if args.clinworker is not None: + main_conf.write("clinworker = {}\n".format(args.clinworker)) + if args.repburst is not None: + main_conf.write("repburst = {}\n".format(args.repburst)) + if args.cliburst is not None: + main_conf.write("cliburst = {}\n".format(args.cliburst)) if not (args.pace_maker is None): main_conf.write("pace-maker = {}\n".format(args.pace_maker)) for r in zip(replicas, keys, tls_keys, itertools.count(0)): -- cgit v1.2.3-70-g09d2