2014-10-17 12:02:52 +00:00
|
|
|
#!/bin/sh
|
|
|
|
if [ $# -ge 1 ]; then
|
|
|
|
SERVER=$1
|
|
|
|
else
|
2014-10-17 14:34:28 +00:00
|
|
|
echo "Usage: sh ./deploy/deploy.sh server [folder [branch [user]]]"
|
2014-10-17 12:02:52 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ $# -ge 2 ]; then
|
2014-10-17 14:34:28 +00:00
|
|
|
FOLDER=$2
|
|
|
|
else
|
|
|
|
FOLDER="./data/"
|
|
|
|
fi
|
|
|
|
if [ $# -ge 3 ]; then
|
2014-10-17 12:02:52 +00:00
|
|
|
BRANCH=$2
|
|
|
|
else
|
|
|
|
BRANCH="master"
|
|
|
|
fi
|
2014-10-17 14:34:28 +00:00
|
|
|
if [ $# -ge 4 ]; then
|
2014-10-17 12:02:52 +00:00
|
|
|
USER=$3
|
|
|
|
else
|
|
|
|
USER="core"
|
|
|
|
fi
|
|
|
|
if [ -e ../orchestration/per-server/$SERVER/default-site ]; then
|
|
|
|
DEFAULTSITE=`cat ../orchestration/per-server/$SERVER/default-site`
|
|
|
|
else
|
|
|
|
DEFAULTSITE=$SERVER
|
|
|
|
fi
|
2014-10-17 14:34:28 +00:00
|
|
|
echo "Hoster data folder is $FOLDER"
|
2014-10-17 12:02:52 +00:00
|
|
|
echo "Infrastructure branch is $BRANCH"
|
|
|
|
echo "Remote user is $USER"
|
|
|
|
echo "Default site is $DEFAULTSITE"
|
|
|
|
|
2014-10-17 14:34:28 +00:00
|
|
|
scp $FOLDER $USER@$SERVER:/data
|
2014-10-17 12:02:52 +00:00
|
|
|
scp ./deploy/onServer.sh $USER@$SERVER:
|
|
|
|
ssh $USER@$SERVER sudo mkdir -p /var/lib/coreos-install/
|
2014-10-17 14:34:28 +00:00
|
|
|
scp cloud-config $USER@$SERVER:/var/lib/coreos-install/user_data
|
2014-10-17 12:02:52 +00:00
|
|
|
ssh $USER@$SERVER sudo sh ./onServer.sh $BRANCH $DEFAULTSITE
|