Skip to content

Commit

Permalink
install ec2 tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Nov 28, 2009
1 parent 8efec3c commit b09fece
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/couchdb-ec2-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EC2_GROUP=default
USER=ubuntu

# couchdb version (just used to name the AMI manifest)
COUCH_VER="0.10"
COUCHDB_VERSION="0.10"

require_var "$EC2_KEY_NAME" "EC2_KEY_NAME"
require_var "$EC2_PRIVATE_KEY" "EC2_PRIVATE_KEY"
Expand Down
12 changes: 5 additions & 7 deletions bin/create-couchdb-image
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
. "$bin"/couchdb-ec2-env.sh

AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $COUCH_VER | grep $ARCH | grep available | awk '{print $2}'`
AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $COUCHDB_VERSION | grep $ARCH | grep available | awk '{print $2}'`

[ ! -z $AMI_IMAGE ] && echo "AMI already registered, use: ec2-deregister $AMI_IMAGE" && exit -1

echo "will bundle to: $S3_BUCKET/couchdb-$COUCH_VER-$ARCH.manifest.xml"
echo "will bundle to: $S3_BUCKET/couchdb-$COUCHDB_VERSION-$ARCH.manifest.xml"

echo "Starting an AMI with ID $BASE_AMI_IMAGE."
OUTPUT=`ec2-run-instances $BASE_AMI_IMAGE -k $EC2_KEY_NAME -t $INSTANCE_TYPE`
Expand Down Expand Up @@ -65,9 +65,7 @@ echo "AWS_ACCOUNT_ID=$AWS_ACCOUNT_ID" > "$TMP_ENV_FILE"
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> "$TMP_ENV_FILE"
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> "$TMP_ENV_FILE"
echo "AWS_ACCOUNT_ID=$AWS_ACCOUNT_ID" >> "$TMP_ENV_FILE"
# echo "COUCHDB_VERSION=$COUCHDB_VERSION" >> "$TMP_ENV_FILE"
# echo "COUCHDB_SVN=$COUCHDB_SVN" >> "$TMP_ENV_FILE"
# echo "ERLANG_URL=$ERLANG_URL" >> "$TMP_ENV_FILE"
echo "COUCHDB_VERSION=$COUCHDB_VERSION" >> "$TMP_ENV_FILE"
echo "ARCH=$ARCH" >> "$TMP_ENV_FILE"
echo "S3_BUCKET=$S3_BUCKET" >> "$TMP_ENV_FILE"
echo "BUNDLE=$BUNDLE" >> "$TMP_ENV_FILE"
Expand Down Expand Up @@ -106,8 +104,8 @@ ssh $SSH_OPTS "$USER@$HOSTNAME" 'sudo /mnt/makeami/create-couchdb-image-remote'

# Register image
echo "registering ami"
ec2-register $S3_BUCKET/couchdb-$COUCH_VER-$ARCH.manifest.xml
echo "registered: $S3_BUCKET/couchdb-$COUCH_VER-$ARCH.manifest.xml"
ec2-register $S3_BUCKET/couchdb-$COUCHDB_VERSION-$ARCH.manifest.xml
echo "registered: $S3_BUCKET/couchdb-$COUCHDB_VERSION-$ARCH.manifest.xml"

echo "Terminating instance"
ec2-terminate-instances $BOOTING_INSTANCE
2 changes: 1 addition & 1 deletion bin/launch-couchdb-instance
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bin=`cd "$bin"; pwd`
. "$bin"/couchdb-ec2-env.sh

# Get the name for the AMI Image
AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $COUCH_VER | grep $ARCH | grep available | awk '{print $2}'`
AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $COUCHDB_VERSION | grep $ARCH | grep available | awk '{print $2}'`


# Start a master
Expand Down
10 changes: 7 additions & 3 deletions bin/remote/create-couchdb-image-remote
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ cat /mnt/makeami/motd >> /etc/motd
cat /mnt/makeami/motd >> /etc/motd.tail

# updating things
echo "enabling the multiverse repository"
sed -i -e 's/universe/universe multiverse/g' /etc/apt/sources.list

echo "updating and upgrading Ubuntu"
apt-get update -y
apt-get clean -y
apt-get upgrade -y

# install CouchDB (Can we use apt-get?)
echo "installing CouchDB and Apache2 with apt-get"
apt-get install -y couchdb apache2
apt-get install -y couchdb apache2 ec2-api-tools ec2-ami-tools

echo "using /mnt/couchdb for data and logs"
mkdir -p /mnt/couchdb/data
Expand Down Expand Up @@ -74,9 +78,9 @@ echo "bundling image"
cd ~
# Don't need to delete .bash_history since it isn't written until exit.
df -h
ec2-bundle-vol -d /mnt -k /mnt/makeami/pk*.pem -c /mnt/makeami/cert*.pem -u $AWS_ACCOUNT_ID -s 3072 -p couchdb-$COUCH_VER-$ARCH -r $ARCH
ec2-bundle-vol -d /mnt -k /mnt/makeami/pk*.pem -c /mnt/makeami/cert*.pem -u $AWS_ACCOUNT_ID -s 3072 -p couchdb-$COUCHDB_VERSION-$ARCH -r $ARCH

ec2-upload-bundle -b $S3_BUCKET -m /mnt/couchdb-$COUCH_VER-$ARCH.manifest.xml -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY
ec2-upload-bundle -b $S3_BUCKET -m /mnt/couchdb-$COUCHDB_VERSION-$ARCH.manifest.xml -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY

# End
echo "EC2 setup Done"

0 comments on commit b09fece

Please sign in to comment.