[Lunar-commits] <moonbase> mongodb: Initial import of mongodb a NoSQL database

Stefan Wold ratler at lunar-linux.org
Mon Dec 6 07:51:13 CET 2010


commit 62c6cefda604469419587de7c026d5d3c31759dd
Author: Stefan Wold <ratler at lunar-linux.org>
Date:   Sun Dec 5 19:01:24 2010 +0100

    mongodb: Initial import of mongodb a NoSQL database
---
 sql/mongodb/BUILD               |   15 ++++++++
 sql/mongodb/DEPENDS             |    6 +++
 sql/mongodb/DETAILS             |   30 +++++++++++++++
 sql/mongodb/config.d/mongodb    |   12 ++++++
 sql/mongodb/init.d/mongodb      |   75 +++++++++++++++++++++++++++++++++++++++
 sql/mongodb/logrotade.d/mongodb |   10 +++++
 6 files changed, 148 insertions(+), 0 deletions(-)

diff --git a/sql/mongodb/BUILD b/sql/mongodb/BUILD
new file mode 100644
index 0000000..2949254
--- /dev/null
+++ b/sql/mongodb/BUILD
@@ -0,0 +1,15 @@
+(
+  add_priv_user mongodb:mongodb -d /var/lib/mongodb  &&
+
+  patch_it $SOURCE2 1 &&
+
+  scons all &&
+  prepare_install &&
+  scons --full --nostrip install --prefix=/usr &&
+
+  for i in /var/{lib,log}/mongodb; do
+    install -d $i -o mongodb -g mongodb -m 770
+  done
+
+
+) > $C_FIFO 2>&1
diff --git a/sql/mongodb/DEPENDS b/sql/mongodb/DEPENDS
new file mode 100644
index 0000000..b9b572e
--- /dev/null
+++ b/sql/mongodb/DEPENDS
@@ -0,0 +1,6 @@
+depends spidermonkey
+depends boost
+depends pcre
+depends scons
+depends ncurses
+depends readline
diff --git a/sql/mongodb/DETAILS b/sql/mongodb/DETAILS
new file mode 100644
index 0000000..ec6bc8e
--- /dev/null
+++ b/sql/mongodb/DETAILS
@@ -0,0 +1,30 @@
+          MODULE=mongodb
+         VERSION=r1.6.4
+          SOURCE=$MODULE-src-$VERSION.tar.gz
+         SOURCE2=$MODULE-1.6.0-fix-scons.patch
+      SOURCE_URL=http://downloads.mongodb.org/src/
+     SOURCE2_URL=$PATCH_URL
+SOURCE_DIRECTORY=$BUILD_DIRECTORY/$MODULE-src-$VERSION
+      SOURCE_VFY=sha256:47de312e3f479358c6f529ffed2a0de659c741cd781bf7a3cd0bc1a507ed19fe
+     SOURCE2_VFY=sha256:de26882ff9adcf46eb2227e185f7d880549333f0e87703cdf984cd1c4612ffd9
+        WEB_SITE="http://www.mongodb.org/"
+         ENTERED=20101205
+         UPDATED=20101205
+           SHORT="A scalable, high-performance, key-value store, document-oriented database"
+cat <<EOF
+MongoDB bridges the gap between key-value stores (which are fast and
+highly scalable) and traditional RDBMS systems (which provide rich
+queries and deep functionality).
+
+MongoDB (from "humongous") is a scalable, high-performance, open
+source, document-oriented database. Written in C++, MongoDB features:
+- Document-oriented storage
+- Full Index Support
+- Replication & High Availability
+- Auto-Sharding
+- Querying
+- Fast In-Place Updates
+- Map/Reduce
+- GridFS
+- Commercial Support
+EOF
diff --git a/sql/mongodb/config.d/mongodb b/sql/mongodb/config.d/mongodb
new file mode 100644
index 0000000..e6b1722
--- /dev/null
+++ b/sql/mongodb/config.d/mongodb
@@ -0,0 +1,12 @@
+#
+# MongoDB config.d
+#
+MDB_USER=mongodb
+MDB_DATADIR=/var/lib/mongodb
+MDB_BINDIP=127.0.0.1
+MDB_PORT=27017
+MDB_LOG=/var/log/mongodb/mongodb.log
+MDB_FORK="--fork"
+
+# Extra options
+MDB_OPTIONS=
diff --git a/sql/mongodb/init.d/mongodb b/sql/mongodb/init.d/mongodb
new file mode 100644
index 0000000..12f9410
--- /dev/null
+++ b/sql/mongodb/init.d/mongodb
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Startup script for mongodb
+#
+# chkconfig: 345 90 20
+# description: A scalable, high-performance, key-value store, document-oriented database
+# processname: mongod
+# pidfile: /var/run/mongodb.pid
+
+# config settings
+[ -f /etc/config.d/mongodb ] && . /etc/config.d/mongodb
+[ -x /usr/bin/mongod ] || exit 1
+
+ARGS=""
+
+MDBPID=$(cat /var/run/mongodb.pid)
+
+if [ -z "$MDB_USER" ] ; then
+	echo "ERROR: A MDB_USER must be set!"
+	exit 1
+fi
+
+if [ -n "$MDB_BINDIP" ]; then
+  ARGS+=" --bind_ip $MDB_BINDIP"
+fi
+
+if [ -n "$MDB_PORT" ]; then
+  ARGS+=" --port $MDB_PORT"
+fi
+
+if [ -n "$MDB_DATADIR" ]; then
+  ARGS+=" --dbpath $MDB_DATADIR"
+fi
+
+if [ -n "$MDB_LOG" ]; then
+  ARGS+=" --logpath $MDB_LOG --logappend"
+fi
+
+if [ -n "$MDB_FORK" ]; then
+  ARGS+=" $MDB_FORK"
+fi
+
+if [ -n "$MDB_OPTIONS" ]; then
+  ARGS+=" $MDB_OPTIONS"
+fi
+
+start()
+{
+  echo -n "Starting mongodb: "
+  if [ -n "$MDBPID" ]; then
+    echo "already running."
+  else
+    su - $MDB_USER -c "/usr/bin/mongod $ARGS --pidfilepath /var/run/mongodb.pid &> /dev/null" &&
+    echo -e $RESULT_OK || echo -e $RESULT_FAIL
+  fi
+}
+
+stop()
+{
+  echo -n "Stopping mongodb: "
+  if [ -z "$MDBPID" ]; then
+    echo "not running."
+  else
+    kill $MDBPID &&
+    echo -e $RESULT_OK || echo -e $RESULT_FAIL
+  fi
+}
+
+restart()
+{
+  $0 stop
+  sleep 1
+  $0 start
+}
+. /lib/lsb/init-functions
diff --git a/sql/mongodb/logrotade.d/mongodb b/sql/mongodb/logrotade.d/mongodb
new file mode 100644
index 0000000..4803786
--- /dev/null
+++ b/sql/mongodb/logrotade.d/mongodb
@@ -0,0 +1,10 @@
+/var/log/mongodb/*.log {
+        weekly
+        missingok
+        rotate 10
+        copytruncate
+        compress
+        delaycompress
+        notifempty
+}
+


More information about the Lunar-commits mailing list