From 1734db425b009e29a2c8ee5d8a2cc0084f09681e Mon Sep 17 00:00:00 2001 From: Matt Van Dijk Date: Thu, 8 Oct 2015 10:41:09 -0400 Subject: [PATCH] Add MongoDB mongos upstart script to elements The custom upstart script should be a part of the elements, as it is OS specific. This requires 2 parts - add the code to the elements (here), and remove the code from trove (follow-up). Partial-Bug: 1493515 Change-Id: I0ae98f173058cae6b9e0eee440318f0277972503 --- .../ubuntu-mongodb/install.d/10-mongodb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/files/elements/ubuntu-mongodb/install.d/10-mongodb b/scripts/files/elements/ubuntu-mongodb/install.d/10-mongodb index 12e5712e..184d0ae3 100755 --- a/scripts/files/elements/ubuntu-mongodb/install.d/10-mongodb +++ b/scripts/files/elements/ubuntu-mongodb/install.d/10-mongodb @@ -35,3 +35,31 @@ apt-get install -y mongodb-org sed -i '/bindIp/d' /etc/mongod.conf # need to use smallFiles until the device is mounted sed -i 's/# mmapv1:/ mmapv1:\n smallFiles: true/' /etc/mongod.conf + +cat > "/etc/init/mongos.conf" << '_EOF_' +limit fsize unlimited unlimited # (file size) +limit cpu unlimited unlimited # (cpu time) +limit as unlimited unlimited # (virtual memory size) +limit nofile 64000 64000 # (open files) +limit nproc 64000 64000 # (processes/threads) + +pre-start script + mkdir -p /var/log/mongodb/ +end script + +start on runlevel [2345] +stop on runlevel [06] + +script + ENABLE_MONGOS="yes" + if [ -f /etc/default/mongos ] + then + . /etc/default/mongos + fi + if [ "x$ENABLE_MONGOS" = "xyes" ] + then + exec start-stop-daemon --start --quiet --chuid mongodb \ + --exec /usr/bin/mongos -- --config /etc/mongod.conf + fi +end script +_EOF_