compose-website/deploy/deploy.sh

35 lines
803 B
Bash
Raw Normal View History

#!/bin/sh
2014-11-05 12:43:16 +00:00
if [ $# -ge 2 ]; then
SERVER=$1
2014-11-05 12:43:16 +00:00
BACKUP_DEST=$2
else
2014-11-05 12:43:16 +00:00
echo "Usage: sh ./deploy/deploy.sh server backup_dest [branch [user]]]"
exit 1
fi
2014-10-17 14:34:28 +00:00
if [ $# -ge 3 ]; then
2014-10-20 10:08:40 +00:00
BRANCH=$3
else
BRANCH="master"
fi
2014-10-17 14:34:28 +00:00
if [ $# -ge 4 ]; then
2014-10-20 10:08:40 +00:00
USER=$4
else
USER="core"
fi
2014-11-05 12:43:16 +00:00
echo "Server to deploy is $SERVER"
echo "Backups will live under $BACKUP_DEST"
echo "IndieHosters repo branch is $BRANCH"
echo "Remote user is $USER"
scp ./deploy/onServer.sh $USER@$SERVER:
2014-11-05 12:43:16 +00:00
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-11-05 12:43:16 +00:00
ssh $USER@$SERVER sudo sh ./onServer.sh $BRANCH $SERVER
# overrides BACKUP_DESTINATION from cloud-config
echo $BACKUP_DEST > ./deploy/tmp.txt
scp ./deploy/tmp.txt $USER@SERVER:/data/BACKUP_DESTINATION
rm ./deploy/tmp.txt