Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of git://github.com/9apps/mongodb

* 'master' of git://github.com/9apps/mongodb:
  gitignore
  .gitignore properly ignored
  .gitignore properly ignored
  tsja...
  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 config.sh to .gitignore
  clean, empty config.sh file
  • Loading branch information...
commit 34d5944e345c174956278bf865021b65887dd5d8 2 parents 115000a + 0b74d1e
flavia flavia authored

Showing 1 changed file with 62 additions and 0 deletions. Show diff stats Hide diff stats

  1. +62 0 config.example.sh
62 config.example.sh
... ... @@ -0,0 +1,62 @@
  1 +#!/bin/sh
  2 +# we get the replica set configuration from user-data, this way we can
  3 +# use features as auto-scaling to safeguard our setup
  4 +#
  5 +# name: this will be replica set name, but will also result in
  6 +# setname.9apps.net and in SimpleDB/SQS
  7 +# size: the size of the volume, if one is created (see source)
  8 +# source: starting point for the replica set, if not empty it can be either
  9 +# snapshot id or volume id. if a volume is created (if source is empty
  10 +# or a snapshot id is given) the size will be determined above
  11 +
  12 +userdata=`curl --silent http://169.254.169.254/latest/user-data`
  13 +grep="grep"
  14 +regex='s/.*\:[ \t]*"\{0,1\}\([^,"]*\)"\{0,1\},\{0,1\}/\1/'
  15 +sed="sed '${regex}'"
  16 +
  17 +if [ "${userdata}" != "" ]; then
  18 + # basic settings
  19 + export SET_NAME=`eval "echo '${userdata}' | ${grep} '\"name\"' | ${sed}"`
  20 + export SET_SIZE=`eval "echo '${userdata}' | ${grep} '\"size\"' | ${sed}"`
  21 + export SET_SRC=`eval "echo '${userdata}' | ${grep} '\"source\"' | ${sed}"`
  22 + export ROLE=`eval "echo '${userdata}' | ${grep} '\"role\"' | ${sed}"`
  23 +fi
  24 +
  25 +# AWS settings
  26 +export AWS_ACCOUNT_ID=""
  27 +
  28 +# EC2 settings (needs some EBS and Route53 priviliges)
  29 +export EC2_KEY_ID=""
  30 +export EC2_SECRET_KEY=""
  31 +
  32 +export R53_KEY_ID=""
  33 +export R53_SECRET_KEY=""
  34 +export HOSTED_ZONE_NAME=""
  35 +export HOSTED_ZONE_ID=""
  36 +
  37 +# SQS settings
  38 +export SQS_KEY_ID=""
  39 +export SQS_ACCESS_KEY=""
  40 +
  41 +# some of these things are present on the instance
  42 +export EC2_KEY_DIR=/root/.ec2
  43 +export AWS_CREDENTIAL_FILE=${EC2_KEY_DIR}/aws_credentials.txt
  44 +export EC2_PRIVATE_KEY=${EC2_KEY_DIR}/pk-.pem
  45 +export EC2_CERT=${EC2_KEY_DIR}/cert-.pem
  46 +export EC2_ACCESS_KEY=${EC2_KEY_ID}
  47 +export AWS_ACCESS_KEY_ID=${EC2_KEY_ID}
  48 +export EC2_SECRET_KEY=${EC2_SECRET_KEY}
  49 +export AWS_SECRET_ACCESS_KEY=${EC2_SECRET_KEY}
  50 +export EC2_USER_ID=${AWS_ACCOUNT_ID}
  51 +
  52 +curl="curl --retry 3 --silent --show-error --fail"
  53 +instance_data_url=http://169.254.169.254/latest
  54 +
  55 +export EC2_AVAILABILITY_ZONE=$($curl $instance_data_url/meta-data/placement/availability-zone)
  56 +export EC2_REGION=${EC2_AVAILABILITY_ZONE:0:${#EC2_AVAILABILITY_ZONE}-1}
  57 +export EC2_INSTANCE_ID=$($curl $instance_data_url/meta-data/instance-id)
  58 +
  59 +export SDB_SERVICE_URL='https://sdb.amazonaws.com'
  60 +
  61 +# changing this is entirely your own responsibility, I wouldn't do it
  62 +export SQS_TASK_QUEUE="${SET_NAME}-tasks"

0 comments on commit 34d5944

Please sign in to comment.
Something went wrong with that request. Please try again.