summaryrefslogtreecommitdiff
path: root/databases
diff options
context:
space:
mode:
authorgdt <gdt@pkgsrc.org>2019-06-30 13:48:06 +0000
committergdt <gdt@pkgsrc.org>2019-06-30 13:48:06 +0000
commit14821f8196e81a7bba4276e8664fac09948b4d6e (patch)
treebebb15cd0801c064d9cc6ba3923b5ae0ed531ace /databases
parentb1eb589cf574f36f60004420feb52eaa37f6a3aa (diff)
downloadpkgsrc-14821f8196e81a7bba4276e8664fac09948b4d6e.tar.gz
databases/mongodb3: Belatedly add files/
For no good reason, I didn't add the files/ directory from the pre-4 version of mongodb. Pointed out by Oskar.
Diffstat (limited to 'databases')
-rw-r--r--databases/mongodb3/files/mongodb.sh37
-rw-r--r--databases/mongodb3/files/smf/manifest.xml40
-rw-r--r--databases/mongodb3/files/smf/mongodb.sh33
3 files changed, 110 insertions, 0 deletions
diff --git a/databases/mongodb3/files/mongodb.sh b/databases/mongodb3/files/mongodb.sh
new file mode 100644
index 00000000000..67e690fe600
--- /dev/null
+++ b/databases/mongodb3/files/mongodb.sh
@@ -0,0 +1,37 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: mongodb.sh,v 1.1 2019/06/30 13:48:06 gdt Exp $
+#
+# PROVIDE: mongodb
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MongoDB:
+#
+# mongodb=YES
+#
+# The following variables are optional:
+#
+# mongodb_user="@MONGODB_USER@" # user to run mongod as
+# mongodb_group="@MONGODB_GROUP@" # group to run mongod as
+# mongodb_dbpath="@MONGODB_DBPATH@" # path to MongoDB database directory
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="mongodb"
+rcvar=${name}
+command="@PREFIX@/bin/mongod"
+: ${mongodb_user:=@MONGODB_USER@}
+: ${mongodb_group:=@MONGODB_GROUP@}
+: ${mongodb_dbpath:=@MONGODB_DBPATH@}
+pidfile="${mongodb_dbpath}/mongod.pid"
+logfile="${mongodb_dbpath}/mongod.log"
+required_dirs="${mongodb_dbpath}"
+
+command_args="--fork --logpath ${logfile} --logappend --pidfilepath ${pidfile} --dbpath ${mongodb_dbpath} --smallfiles"
+
+load_rc_config ${name}
+run_rc_command "$1"
diff --git a/databases/mongodb3/files/smf/manifest.xml b/databases/mongodb3/files/smf/manifest.xml
new file mode 100644
index 00000000000..442a1ccb505
--- /dev/null
+++ b/databases/mongodb3/files/smf/manifest.xml
@@ -0,0 +1,40 @@
+<?xml version='1.0'?>
+<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
+<service_bundle type='manifest' name='export'>
+ <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='0'>
+ <create_default_instance enabled='false'/>
+ <single_instance/>
+ <dependency name='fs' grouping='require_all' restart_on='none' type='service'>
+ <service_fmri value='svc:/system/filesystem/local'/>
+ </dependency>
+ <dependency name='net' grouping='require_all' restart_on='none' type='service'>
+ <service_fmri value='svc:/network/loopback'/>
+ </dependency>
+ <dependency name='config' grouping='require_all' restart_on='none' type='path'>
+ <service_fmri value='file://@PKG_SYSCONFDIR@/mongod.conf'/>
+ </dependency>
+ <method_context working_directory='@MONGODB_DBPATH@'>
+ <method_credential group='@MONGODB_USER@' user='@MONGODB_GROUP@'/>
+ <method_environment>
+ <envvar name='PATH' value='@PREFIX@/bin:@PREFIX@/gnu/bin:@PREFIX@/sbin:/usr/bin:/usr/sbin'/>
+ </method_environment>
+ </method_context>
+ <exec_method name='start' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.mongodb@ start' timeout_seconds='18446744073709551615'/>
+ <exec_method name='stop' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.mongodb@ stop' timeout_seconds='18446744073709551615'/>
+ <exec_method name='restart' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.mongodb@ restart' timeout_seconds='18446744073709551615'/>
+ <property_group name='replication' type='application'>
+ <propval name='name' type='astring' value=''/>
+ <propval name='key' type='astring' value=''/>
+ <propval name='members' type='astring' value=''/>
+ </property_group>
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>MongoDB Database</loctext>
+ </common_name>
+ <documentation>
+ <doc_link name='wiki.joyent.com' uri='http://wiki.joyent.com/display/jpc2/Joyent+MongoDB+SmartMachine'/>
+ </documentation>
+ </template>
+ </service>
+</service_bundle>
+
diff --git a/databases/mongodb3/files/smf/mongodb.sh b/databases/mongodb3/files/smf/mongodb.sh
new file mode 100644
index 00000000000..df97f6b9e4d
--- /dev/null
+++ b/databases/mongodb3/files/smf/mongodb.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# SMF method for svc:/pkgsrc/mongodb:default
+
+. /lib/svc/share/smf_include.sh
+
+# mongodb doesn't really work with anything else but C locale
+export LANG=C
+
+PATH="@PREFIX@/bin:@PREFIX@/gnu/bin:@PREFIX@/sbin:/usr/bin:/usr/sbin";
+MONGO_DBPATH="@MONGODB_DBPATH@";
+MONGO_CONF="@PKG_SYSCONFDIR@/mongod.conf";
+MONGO_PID="${MONGO_DBPATH}/mongod.pid";
+
+case "$1" in
+ 'start')
+ mongod --fork -f ${MONGO_CONF} --pidfilepath ${MONGO_PID}
+ ;;
+
+ 'stop')
+ [[ -s ${MONGO_PID} ]] && kill $(cat ${MONGO_PID}) 2>/dev/null
+ ;;
+
+ 'restart')
+ [[ -s ${MONGO_PID} ]] && kill $(cat ${MONGO_PID}) 2>/dev/null
+ sleep 3;
+ mongod --fork -f ${MONGO_CONF} --pidfilepath ${MONGO_PID}
+ ;;
+ *)
+ echo "usage: $0 { start | stop | restart }"
+ exit 1;
+ ;;
+esac