compose-website/deploy/add-site.sh

23 lines
603 B
Bash
Raw Normal View History

2014-10-17 14:34:28 +00:00
#!/bin/sh
2014-11-04 14:27:07 +00:00
if [ $# -ge 5 ]; then
2014-10-17 14:34:28 +00:00
SERVER=$1
DOMAIN=$2
PEMFILE=$3
2014-11-04 14:27:07 +00:00
IMAGE=$4
GITREPO=$5
2014-10-17 14:34:28 +00:00
else
2014-11-04 14:27:07 +00:00
echo "Usage: sh ./deploy/add-site.sh server domain pemfile image gitrepo [user]"
2014-10-17 14:34:28 +00:00
exit 1
fi
2014-11-04 14:27:07 +00:00
if [ $# -ge 6 ]; then
USER=$6
2014-10-17 14:34:28 +00:00
else
USER="core"
fi
2014-11-04 14:27:07 +00:00
echo "Adding $DOMAIN to $SERVER, running $IMAGE behind $PEMFILE and pulling from $GITREPO"
2014-10-17 14:34:28 +00:00
echo "Remote user is $USER"
2014-11-04 18:07:18 +00:00
ssh $USER@$SERVER sudo mkdir -p /data/domains/$DOMAIN/$IMAGE/data
scp $PEMFILE $USER@$SERVER:/data/runtime/haproxy/approved-certs/$DOMAIN.pem
2014-11-04 14:27:07 +00:00
ssh $USER@$SERVER sudo sh /data/indiehosters/scripts/activate-user.sh $DOMAIN $IMAGE $GITREPO