ip=$1
retry=0
- until timeout 10s ssh $ssh_args ec2-user@$ip "exit" >/dev/null 2>&1
+ until timeout 10s ssh $ssh_args ubuntu@$ip "exit" >/dev/null 2>&1
do
echo "retry connect rubbos vm ip $ip $retry"
sleep 1
bottlenecks_prepare_env()
{
- echo "Bottlenecks prepare env in VMs"
+ echo "Bottlenecks prepare env"
# configue rubbos control ssh key
generate_ssh_key
for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
$rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
do
- scp $ssh_args -r $SCRIPT_DIR ec2-user@$i:/tmp
- ssh $ssh_args ec2-user@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" &
+ scp $ssh_args -r $SCRIPT_DIR ubuntu@$i:/tmp
+ ssh $ssh_args ubuntu@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" &
done
- # ugly use ssh execute script to fix ec2-user previlege issue
- ssh $ssh_args ec2-user@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh"
+ # ugly use ssh execute script to fix ubuntu previlege issue
+ ssh $ssh_args ubuntu@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh"
# test root access
for i in $rubbos_control $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
done
}
+git_checkout()
+{
+ if sudo git cat-file -e $1^{commit} 2>/dev/null; then
+ # branch, tag or sha1 object
+ sudo git checkout $1
+ else
+ # refspec / changeset
+ sudo git fetch --tags --progress $2 $1
+ sudo git checkout FETCH_HEAD
+ fi
+}
+
bottlenecks_download_repo()
{
echo "Bottlenecks: download bottlenecks repo"
- if [ -d $BOTTLENECKS_REPO_DIR/.git ]; then
- cd $BOTTLENECKS_REPO_DIR
- sudo git pull origin master
- if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
- sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
- fi
- cd -
- else
- sudo rm -rf $BOTTLENECKS_REPO_DIR
+ sudo git config --global http.sslVerify false
+ if [ ! -d $BOTTLENECKS_REPO_DIR ]; then
sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
- if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
- sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
- fi
-
fi
+ sudo cd $BOTTLENECKS_REPO_DIR
+ sudo git checkout master && sudo git pull
+ git_checkout $BOTTLENECKS_BRANCH $BOTTLENECKS_REPO
+ sudo cd -
}
bottlenecks_config_hosts_ip()
SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd`
ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes"
- source $SCRIPT_DIR/package.conf
source $SCRIPT_DIR/hosts.conf
+ source $SCRIPT_DIR/package.conf
source $SCRIPT_DIR/common.sh
bottlenecks_prepare_env
+ set -x
bottlenecks_download_repo
bottlenecks_config_hosts_ip
bottlenecks_download_packages