Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 8aa0bac6a03ab40459819a453df4bf70b7630f5d 1 parent 84fb181
@boutell boutell authored
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!"
Please sign in to comment.
Something went wrong with that request. Please try again.