Permalink
Browse files

Adding a post-create script to install mongo and create the users.

  • Loading branch information...
1 parent 1b94768 commit 136408261d219a7c4ec940f6db8b17b43207e04a @shane-tomlinson shane-tomlinson committed Aug 30, 2012
Showing with 31 additions and 0 deletions.
  1. +3 −0 .awsbox.json
  2. +28 −0 scripts/aws/post-create.sh
View
@@ -2,6 +2,9 @@
"processes": [ "./server/main.js" ],
"env": {
"MONGOLAB_URI": "mongodb://beer:thisismyfavoritebeer@127.0.0.1:27017/myfavoritebeer"
+ },
+ "hooks": {
+ "postcreate": "scripts/aws/post-create.sh"
}
}
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Mongo is in a special repo
+echo "Installing MongoDB..."
+
+echo "[10gen]
+name=10gen Repository
+baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
+gpgcheck=0" | sudo tee -a /etc/yum.repos.d/10gen.repo
+
+
+# install mongo
+sudo yum -y install mongo-10gen-server
+sudo yum -y install sysstat
+
+# create data directories
+sudo mkdir /data
+sudo mkdir /data/db
+
+# set up permissions so mongod can write to data
+sudo chown -R mongod:mongod /data
+
+echo "Starting MongoDB... This might take a while"
+sudo /etc/init.d/mongod start
+
+echo "Configuring Database Users..."
+sudo mongo 127.0.0.1:27017/myfavoritebeer --eval "db.addUser('beer', 'thisismyfavoritebeer');"
+

0 comments on commit 1364082

Please sign in to comment.