Skip to content

Commit

Permalink
some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel-faber committed Mar 30, 2020
1 parent ebfd338 commit af3a3a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
13 changes: 10 additions & 3 deletions deploy-section.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ VAULT_EXE="./safe_vault";
# -vvv => log error, warn, info, debug.
# -vvvv => log error, warn, info, debug, trace.
VAULT_LOGGING_VERBOSITY="-vvvv";
# 0 => Copies vault binary to the droplet
# 1 => Does not copy the vault binary
COPY_VAULT_BINARY=1

# *********************************************************************************************************************
# *********************************************************************************************************************
Expand All @@ -48,8 +51,10 @@ if [[ ${DEBUG} != 0 ]]; then
printf 'Running genesis vault: %s\n' "${VAULT_EXE}";
fi

ssh root@${IP_LIST[0]} 'mkdir -p /home/safe; killall -9 safe_vault'
scp ${VAULT_EXE} root@${IP_LIST[0]}:/home/safe
ssh root@${IP_LIST[0]} 'mkdir -p /home/safe; killall -9 safe_vault;'
if [[ ${COPY_VAULT_BINARY} == 0 ]]; then
scp ${VAULT_EXE} root@${IP_LIST[0]}:/home/safe
fi
ssh root@${IP_LIST} "bash -s" < start-genesis-vault.bash ${IP_LIST[0]} ${VAULT_ROOT_DIR} ${VAULT_LOGGING_VERBOSITY} > connection_info
cp connection_info ~/.config/safe_vault/vault_connection_info.config
hcc=$(cat connection_info)
Expand All @@ -69,6 +74,8 @@ for (( i = 1; i < ip_list_len; i++ )); do
sleep 1;
done
ssh root@${IP_LIST[i]} 'mkdir -p /home/safe; killall -9 safe_vault > /dev/null'
scp ${VAULT_EXE} root@${IP_LIST[i]}:/home/safe
if [[ ${COPY_VAULT_BINARY} == 0 ]]; then
scp ${VAULT_EXE} root@${IP_LIST[i]}:/home/safe
fi
ssh root@${IP_LIST[i]} "bash -s" < start-new-vault.bash ${IP_LIST[i]} ${VAULT_ROOT_DIR} ${hcc@Q} ${VAULT_LOGGING_VERBOSITY}
done
3 changes: 1 addition & 2 deletions register-hosts.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash

## This script registers the remote machines in the `known_hosts`

while IFS= read -r ip
while read -r ip
do
ssh-keyscan -H ${ip} >> ~/.ssh/known_hosts
done < ip_list
2 changes: 1 addition & 1 deletion start-genesis-vault.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ if [ -d "$data_path" ]; then
else
mkdir ${data_path}
fi
echo "" > ~/.config/safe_vault/vault_connection_info.config
nohup ./safe_vault ${log_level} --first --ip ${ip} --root-dir "${data_path}" &> "${data_path}"/vault.stdout &
sleep 2;

# FIXME: This could read the old config too
hcc="$(cat ~/.config/safe_vault/vault_connection_info.config)";

if [[ ${hcc} == "" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion start-new-vault.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ if [ -d "$data_path" ]; then
else
mkdir ${data_path}
fi
nohup heaptrack ./safe_vault ${log_level} --ip ${ip} --root-dir=${data_path} --hard-coded-contacts ${hcc} &> ${data_path}/vault.stdout &
nohup ./safe_vault ${log_level} --ip ${ip} --root-dir=${data_path} --hard-coded-contacts ${hcc} &> ${data_path}/vault.stdout &

0 comments on commit af3a3a5

Please sign in to comment.