Skip to content

Commit

Permalink
add custom path
Browse files Browse the repository at this point in the history
  • Loading branch information
junchao committed Jan 17, 2025
1 parent 3c3e9a2 commit 3d2d934
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ Run the script:
./performance/pbft_performance.sh config/kv_performance_server.conf

Results will be saved locally and be shown on the screen as well.


## Using non-ubuntu account ##
The default path for the workspace to deploy the system is /home/ubuntu
If you want to change the path, you can update ``script/env.sh``
7 changes: 4 additions & 3 deletions scripts/deploy/performance/run_performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

./script/deploy.sh $1
. ./script/load_config.sh $1
. ./script/env.sh

server_name=`echo "$server" | awk -F':' '{print $NF}'`
server_bin=${server_name}
Expand All @@ -33,7 +34,7 @@ count=1
for ip in ${iplist[@]};
do
echo "server bin:"${server_bin}
`ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@${ip} "killall -9 ${server_bin}"`
`ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ${user}@${ip} "killall -9 ${server_bin}"`
((count++))
done

Expand All @@ -46,8 +47,8 @@ idx=1
echo "getting results"
for ip in ${iplist[@]};
do
echo "scp -i ${key} ubuntu@${ip}:/home/ubuntu/${server_bin}.log ./${ip}_log"
`scp -i ${key} ubuntu@${ip}:/home/ubuntu/resilientdb_app/${idx}/${server_bin}.log result_${ip}_log`
echo "scp -i ${key} ${user}@${ip}:${home_path}/${server_bin}.log ./${ip}_log"
`scp -i ${key} ${user}@${ip}:${home_path}/resilientdb_app/${idx}/${server_bin}.log result_${ip}_log`
((idx++))
done

Expand Down
16 changes: 8 additions & 8 deletions scripts/deploy/script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function run_cmd(){
idx=1
for ip in ${deploy_iplist[@]};
do
ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@${ip} "cd ${main_folder}/$idx; $1" &
ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ${user}@${ip} "cd ${main_folder}/$idx; $1" &
((count++))
((idx++))
done
Expand All @@ -98,20 +98,20 @@ function run_cmd(){

function run_one_cmd(){
echo "run one:"$1
ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@${ip} "$1"
ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ${user}@${ip} "$1"
}

run_cmd "killall -9 ${server_bin}"
if [ $performance ];
then
run_cmd "rm -rf /home/ubuntu/${main_folder}"
run_cmd "rm -rf ${home_path}/${main_folder}"
fi

idx=1
for ip in ${deploy_iplist[@]};
do
run_one_cmd "mkdir -p /home/ubuntu/${main_folder}/$idx" &
folder="/home/ubuntu/${main_folder}/$idx"
run_one_cmd "mkdir -p ${home_path}/${main_folder}/$idx" &
folder="${home_path}/${main_folder}/$idx"
run_one_cmd "rm -rf ${folder}/${server_bin}; rm ${folder}/${server_bin}*.log; rm -rf ${folder}/server.config; rm -rf ${folder}/cert;"
((count++))
((idx++))
Expand All @@ -133,8 +133,8 @@ idx=1
count=0
for ip in ${deploy_iplist[@]};
do
echo "scp -i ${key} -r ${bin_path} ${output_path}/server.config ${output_path}/cert ubuntu@${ip}:/home/ubuntu/${main_folder}/$idx"
scp -i ${key} -r ${bin_path} ${output_path}/server.config ${output_path}/cert ubuntu@${ip}:/home/ubuntu/${main_folder}/$idx &
echo "scp -i ${key} -r ${bin_path} ${output_path}/server.config ${output_path}/cert ${user}@${ip}:${home_path}/${main_folder}/$idx"
scp -i ${key} -r ${bin_path} ${output_path}/server.config ${output_path}/cert ${user}@${ip}:${home_path}/${main_folder}/$idx &
((count++))
((idx++))
done
Expand Down Expand Up @@ -170,7 +170,7 @@ do
resp=""
while [ "$resp" = "" ]
do
resp=`ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@${ip} "cd ${main_folder}/$idx; grep \"receive public size:${#iplist[@]}\" ${server_bin}.log"`
resp=`ssh -i ${key} -n -o BatchMode=yes -o StrictHostKeyChecking=no ${user}@${ip} "cd ${main_folder}/$idx; grep \"receive public size:${#iplist[@]}\" ${server_bin}.log"`
if [ "$resp" = "" ]; then
sleep 1
fi
Expand Down
2 changes: 2 additions & 0 deletions scripts/deploy/script/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
set +e

CURRENT_PATH=$PWD
user=ubuntu
home_path=/home/ubuntu

i=0
while [ ! -f "WORKSPACE" ]
Expand Down

0 comments on commit 3d2d934

Please sign in to comment.