Permalink
Browse files

Make sure mongodb is configured to respawn, but not too fast

  • Loading branch information...
1 parent 84fb181 commit 8aa0bac6a03ab40459819a453df4bf70b7630f5d @boutell boutell committed Feb 23, 2014
Showing with 15 additions and 1 deletion.
  1. +15 −1 sc-proxy/install-node-and-mongo-on-ubuntu.bash
View
16 sc-proxy/install-node-and-mongo-on-ubuntu.bash
@@ -33,10 +33,24 @@ apt-get -y install mongodb-10gen &&
echo "Installed MongoDB" &&
echo "Configuring MongoDB to listen only on localhost" &&
echo "bind_ip = 127.0.0.1" >> /etc/mongodb.conf &&
+
# The default configuration for MongoDB assumes taking up 6GB off the bat for every single
# database is cool and also inhales tons of space for journal files. This is overkill for
# most deployments, so we instruct MongoDB to use smaller files
echo "smallfiles = true" >> /etc/mongodb.conf &&
-/usr/sbin/service mongodb restart &&
+
+cat <<EOM >> /etc/init/mongodb.conf &&
+# Make sure we respawn if the physical server
+# momentarily lies about disk space, but also
+# make sure we don't respawn too fast
+
+post-stop script
+ sleep 5
+end script
+
+respawn
+EOM
+
+start mongodb &&
npm install -g forever &&
echo "Success!"

0 comments on commit 8aa0bac

Please sign in to comment.