committing my progress, but no working tests yet. stuck on bug where I can't curl the URL I get from the deploy transcript
This commit is contained in:
1 parent
06f2c8ff5e
commit
3e2989d954
6 files changed
+69
-5
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
KEYNAME="$1"
|
||||
indent() { sed "s/^/ /"; }
|
||||
echo "-----> Booting EC2 instance..."
|
||||
start=$(ec2-run-instances -k $1 ami-f3d1bb9a 2>/dev/null)
|
||||
if [[ $? > 0 ]]; then
|
||||
echo "$start"
|
||||
exit
|
||||
fi
|
||||
INSTANCE=$(echo "$start" | awk '/^INSTANCE/ {print $2}')
|
||||
terminate() {
|
||||
echo "-----> Terminating $INSTANCE..."
|
||||
ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down"
|
||||
}
|
||||
trap "terminate" EXIT
|
||||
sleep 30
|
||||
status=""
|
||||
while [[ "$status" != "running" ]]; do
|
||||
info=$(ec2-describe-instances 2>/dev/null | grep $INSTANCE)
|
||||
status=$(echo "$info" | cut -f 6 | grep run)
|
||||
echo " Waiting..."
|
||||
sleep 5
|
||||
if [[ $status == "running" ]]; then
|
||||
echo "-----> $INSTANCE has succesfully booted!"
|
||||
break
|
||||
fi
|
||||
done
|
||||
PUBLIC_IP=$(echo "$info" | awk '{print $14}')
|
||||
echo "-----> Waiting for SSH at $PUBLIC_IP..."
|
||||
sleep 10
|
||||
echo "-----> Connecting and running boostrap script..."
|
||||
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent
|
||||
Reference in new issue
Block a user