Browse files

Merge branch 'master' of git://

* 'master' of git://
  .gitignore properly ignored
  .gitignore properly ignored
  fixed the monitoring (cloudwatch)
  fixed the launch config user-data
  upgrade to mongodb 2.0, moved to 1 image member/arbiter, user-data, and many fixes
  added to .gitignore
  clean, empty file
  • Loading branch information...
2 parents 115000a + 0b74d1e commit 34d5944e345c174956278bf865021b65887dd5d8 @flavia flavia committed Jan 9, 2012
Showing with 62 additions and 0 deletions.
  1. +62 −0
@@ -0,0 +1,62 @@
+# we get the replica set configuration from user-data, this way we can
+# use features as auto-scaling to safeguard our setup
+# name: this will be replica set name, but will also result in
+# and in SimpleDB/SQS
+# size: the size of the volume, if one is created (see source)
+# source: starting point for the replica set, if not empty it can be either
+# snapshot id or volume id. if a volume is created (if source is empty
+# or a snapshot id is given) the size will be determined above
+userdata=`curl --silent`
+regex='s/.*\:[ \t]*"\{0,1\}\([^,"]*\)"\{0,1\},\{0,1\}/\1/'
+sed="sed '${regex}'"
+if [ "${userdata}" != "" ]; then
+ # basic settings
+ export SET_NAME=`eval "echo '${userdata}' | ${grep} '\"name\"' | ${sed}"`
+ export SET_SIZE=`eval "echo '${userdata}' | ${grep} '\"size\"' | ${sed}"`
+ export SET_SRC=`eval "echo '${userdata}' | ${grep} '\"source\"' | ${sed}"`
+ export ROLE=`eval "echo '${userdata}' | ${grep} '\"role\"' | ${sed}"`
+# AWS settings
+export AWS_ACCOUNT_ID=""
+# EC2 settings (needs some EBS and Route53 priviliges)
+export EC2_KEY_ID=""
+export EC2_SECRET_KEY=""
+export R53_KEY_ID=""
+export R53_SECRET_KEY=""
+export HOSTED_ZONE_ID=""
+# SQS settings
+export SQS_KEY_ID=""
+export SQS_ACCESS_KEY=""
+# some of these things are present on the instance
+export EC2_KEY_DIR=/root/.ec2
+export AWS_CREDENTIAL_FILE=${EC2_KEY_DIR}/aws_credentials.txt
+export EC2_PRIVATE_KEY=${EC2_KEY_DIR}/pk-.pem
+export EC2_CERT=${EC2_KEY_DIR}/cert-.pem
+export EC2_ACCESS_KEY=${EC2_KEY_ID}
+curl="curl --retry 3 --silent --show-error --fail"
+export EC2_AVAILABILITY_ZONE=$($curl $instance_data_url/meta-data/placement/availability-zone)
+export EC2_INSTANCE_ID=$($curl $instance_data_url/meta-data/instance-id)
+export SDB_SERVICE_URL=''
+# changing this is entirely your own responsibility, I wouldn't do it
+export SQS_TASK_QUEUE="${SET_NAME}-tasks"

0 comments on commit 34d5944

Please sign in to comment.