diff options
Diffstat (limited to 'testing/mongodb')
-rw-r--r-- | testing/mongodb/10-fix-poll-h.patch | 11 | ||||
-rw-r--r-- | testing/mongodb/20-fix-libc-version.patch | 37 | ||||
-rw-r--r-- | testing/mongodb/30-fix-backtrace.patch | 24 | ||||
-rw-r--r-- | testing/mongodb/40-fix-elf-native-class.patch | 12 | ||||
-rw-r--r-- | testing/mongodb/APKBUILD | 112 | ||||
-rw-r--r-- | testing/mongodb/mongodb.confd | 14 | ||||
-rw-r--r-- | testing/mongodb/mongodb.initd | 40 | ||||
-rw-r--r-- | testing/mongodb/mongodb.logrotate | 13 | ||||
-rw-r--r-- | testing/mongodb/mongodb.pre-install | 4 | ||||
-rw-r--r-- | testing/mongodb/mongos.confd | 16 | ||||
-rw-r--r-- | testing/mongodb/mongos.initd | 45 |
11 files changed, 328 insertions, 0 deletions
diff --git a/testing/mongodb/10-fix-poll-h.patch b/testing/mongodb/10-fix-poll-h.patch new file mode 100644 index 0000000000..0ef14f4fed --- /dev/null +++ b/testing/mongodb/10-fix-poll-h.patch @@ -0,0 +1,11 @@ +--- orig/mongodb-src-r3.0.2/src/mongo/util/net/socket_poll.h ++++ mongodb-src-r3.0.2/src/mongo/util/net/socket_poll.h +@@ -29,7 +29,7 @@ + #pragma once + + #ifndef _WIN32 +-# include <sys/poll.h> ++# include <poll.h> + #else + # if defined(NTDDI_VERSION) && ( !defined(NTDDI_VISTA) || ( NTDDI_VERSION < NTDDI_VISTA ) ) + // These are only defined in winsock2.h on newer windows but we need them everywhere. diff --git a/testing/mongodb/20-fix-libc-version.patch b/testing/mongodb/20-fix-libc-version.patch new file mode 100644 index 0000000000..bf1aba081a --- /dev/null +++ b/testing/mongodb/20-fix-libc-version.patch @@ -0,0 +1,37 @@ +--- orig/mongodb-src-r3.0.2/src/mongo/util/processinfo_linux2.cpp ++++ mongodb-src-r3.0.2/src/mongo/util/processinfo_linux2.cpp +@@ -34,7 +34,11 @@ + #include <stdio.h> + #include <unistd.h> + #include <sys/mman.h> +-#include <gnu/libc-version.h> ++#ifdef __GLIBC__ ++# include <gnu/libc-version.h> ++#else ++# define gnu_get_libc_version(x) "unknown" ++#endif + #include <sys/utsname.h> + + #include "processinfo.h" +@@ -314,6 +318,7 @@ + paths.push_back( "/etc/slackware-version" ); + paths.push_back( "/etc/centos-release" ); + paths.push_back( "/etc/os-release" ); ++ paths.push_back( "/etc/alpine-release" ); + + for ( i = paths.begin(); i != paths.end(); ++i ) { + // for each path +@@ -398,8 +403,11 @@ + + void ProcessInfo::getExtraInfo( BSONObjBuilder& info ) { + // [dm] i don't think mallinfo works. (64 bit.) ?? +- struct mallinfo malloc_info = mallinfo(); // structure has same name as function that returns it. (see malloc.h) +- info.append("heap_usage_bytes", malloc_info.uordblks/*main arena*/ + malloc_info.hblkhd/*mmap blocks*/); ++ //struct mallinfo malloc_info = mallinfo(); // structure has same name as function that returns it. (see malloc.h) ++ // info.append("heap_usage_bytes", malloc_info.uordblks/*main arena*/ + malloc_info.hblkhd/*mmap blocks*/); ++ ++ // TODO: Fix for TC_malloc instance().getStats() ++ info.append("heap_usage_bytes", 0); + //docs claim hblkhd is included in uordblks but it isn't + + LinuxProc p(_pid); diff --git a/testing/mongodb/30-fix-backtrace.patch b/testing/mongodb/30-fix-backtrace.patch new file mode 100644 index 0000000000..bf576e2415 --- /dev/null +++ b/testing/mongodb/30-fix-backtrace.patch @@ -0,0 +1,24 @@ +--- orig/mongodb-src-r3.0.2/src/mongo/platform/backtrace.cpp ++++ mongodb-src-r3.0.2/src/mongo/platform/backtrace.cpp +@@ -28,6 +28,12 @@ + #if !defined(_WIN32) + #if defined(__sunos__) || !defined(MONGO_HAVE_EXECINFO_BACKTRACE) + ++// dlfcn.h requires _GNU_SOURCE to be defined in order to export ++// Dl_* structures. Issue gonna be addressed in 3.1.3, see SERVER-17199 ++#ifndef _GNU_SOURCE ++# define _GNU_SOURCE ++#endif ++ + #include "mongo/platform/backtrace.h" + + #include <boost/smart_ptr/scoped_array.hpp> +@@ -42,6 +48,8 @@ + + using std::string; + using std::vector; ++ ++typedef Dl_info Dl_info_t; + + namespace mongo { + namespace pal { diff --git a/testing/mongodb/40-fix-elf-native-class.patch b/testing/mongodb/40-fix-elf-native-class.patch new file mode 100644 index 0000000000..badb712d8e --- /dev/null +++ b/testing/mongodb/40-fix-elf-native-class.patch @@ -0,0 +1,12 @@ +--- orig/mongodb-src-r3.0.2/src/mongo/util/stacktrace_posix.cpp ++++ mongodb-src-r3.0.2/src/mongo/util/stacktrace_posix.cpp +@@ -209,6 +209,9 @@ + #include <elf.h> + #include <link.h> + ++// AlpineTODO: Better option?? ++#define __ELF_NATIVE_CLASS 64 ++ + namespace mongo { + namespace { + diff --git a/testing/mongodb/APKBUILD b/testing/mongodb/APKBUILD new file mode 100644 index 0000000000..96d7a7c6b3 --- /dev/null +++ b/testing/mongodb/APKBUILD @@ -0,0 +1,112 @@ +# Maintainer: Filipp Andronov <filipp.andronov@gmail.com> + +pkgname=mongodb +pkgver=3.0.2 +pkgrel=0 +pkgdesc='A high-performance, open source, schema-free document-oriented database' +url='http://www.mongodb.org' +arch='x86_64' +license='AGPL3' +pkgusers="mongodb" +depends= +depends_dev="scons openssl-dev libexecinfo-dev pcre-dev wiredtiger-dev" +makedepends="$depends_dev" +install="$pkgname.pre-install" +source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz + 10-fix-poll-h.patch + 20-fix-libc-version.patch + 30-fix-backtrace.patch + 40-fix-elf-native-class.patch + + mongodb.confd + mongodb.initd + mongodb.logrotate + mongos.confd + mongos.initd + " +# +# 1. Force 64bits because of 40-fix-elf-native-class.patch +# 2. Use system allocator as tc-malloc doesn't build +# 2. Use as much system libs as possible, boost doesn't compile foe example +# +# TODO: proper elf-netive-class fix +# TODO: check if there are more libs could be replaced by system counterparts (see libpcap does't use, for example) +# TODO: proper fix for heap usage +# Right now code patched to always return 0 for heap usage statistics. That is necessary because musl malloc info +# doesn't compatible with glibc and breaks build. It is _possible_ to patch code to return 0 +# because on 64bit platform statistics is broken and returns wrong numbers, see SERVER-9168 mongo bug. +# +# There is a way to return propper value when tc-malloc used, but it doesn't compile for libmusl. Work is in progress, +# contribution strongly welcome :D +# +_builddir="$srcdir"/$pkgname-src-r$pkgver +_buildops="--variant-dir=build --64 --allocator=system --use-system-pcre \ + --use-system-wiredtiger --extralib=libexecinfo --disable-warnings-as-errors" + +prepare() { + cd "$_builddir" + + local i + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + + export SCONSFLAGS="$MAKEFLAGS" + scons $_buildops --prefix=$pkgdir/usr core +} + +package() { + cd "$_builddir" + + # install mongo targets + scons $_buildops --prefix=$pkgdir/usr install + + # install alpine specific files + install -dm700 "$pkgdir/var/lib/mongodb" + install -dm755 "$pkgdir/var/log/mongodb" + chown mongodb:daemon "$pkgdir/var/lib/mongodb" "$pkgdir/var/log/mongodb" + + install -Dm755 "$srcdir/mongodb.initd" "$pkgdir/etc/init.d/mongodb" + install -Dm644 "$srcdir/mongodb.confd" "$pkgdir/etc/conf.d/mongodb" + install -Dm644 "$srcdir/mongodb.logrotate" "$pkgdir/etc/logrotate.d/mongodb" + + install -Dm755 "$srcdir/mongos.initd" "$pkgdir/etc/init.d/mongos" + install -Dm644 "$srcdir/mongos.confd" "$pkgdir/etc/conf.d/mongos" +} + +md5sums="d9fe75f9bc88f34194d823f1d288e4d9 mongodb-src-r3.0.2.tar.gz +b37ef33a58cbfddd7272b2e3e7c29d18 10-fix-poll-h.patch +c30067f1f39707371db5897dbd46012f 20-fix-libc-version.patch +4b27b6c9d0216234ac6a24106b624381 30-fix-backtrace.patch +04a348397be8ca7471d404056d8a1490 40-fix-elf-native-class.patch +7d2f94bed7bfacd32fcd52dfd931f077 mongodb.confd +7bfbe9bd5da9254ab4981c7c3b8ac2bc mongodb.initd +49df78833de4cb6e2b9b1ab9da52c3ac mongodb.logrotate +33b23ee722f6e5d15eb6d9c2723a346f mongos.confd +e2e7904c561364545a48077ba4e84dc3 mongos.initd" +sha256sums="010522203cdb9bbff52fbd9fe299b67686bb1256e2e55eb78abf35444f668399 mongodb-src-r3.0.2.tar.gz +7eff5c3f9d0119c19b9144d0933f2cd60db0490e096d4b34c1578101ad06ba33 10-fix-poll-h.patch +1cc23b97d2c0fcec0c67418c9d3fe842fd121fd7e0596ef4ae77b1b992919631 20-fix-libc-version.patch +7630b7b55cd2b3e836c441e5ac13b4a111ef3552a9576433a58bd839a1b9259b 30-fix-backtrace.patch +3a863660113d29728d7a852b3fba73926697b496848f8ccc4d8e73e6614cfdfc 40-fix-elf-native-class.patch +a4ca29c577428c02cd0b0a8b46756df5f53a05519c9d13c270533cf99b9b819d mongodb.confd +ee590071ade60cffdd28ce5bd1e685bcfb49878fb88a21adea0cf30867587ade mongodb.initd +76994c32d999def5c925bd7be3f96687b3406f1d67b89aa6a4df8053025b1e01 mongodb.logrotate +2afd582564623da0e928ca667d37bef467334c82d08b49301f1f6c16ba177767 mongos.confd +0b7dafba846962f473c406e09d80923e07cf03bb8ba727b3e0408fbef28b23da mongos.initd" +sha512sums="ec14529f39459835644dd681a98133c276bb96c676ce3ad91c20dff1ce96aeda3e14f08c05019a72a6f8eaadfed7e176944b42187a273b3e82001946126931d7 mongodb-src-r3.0.2.tar.gz +73427e35edaf6e6c3b9b2fc16ef4560fc3765084d840bdbec729445fa24ca87394798db16366e0ec320312b3c3b6e1fe58db013e902a2b1413c36b8e66c6bce8 10-fix-poll-h.patch +b9c9f5dbefe765b3cd1043c259dda027721bf66e75024ec70c0d84fe6a1039065b133c3ea838e01538535d07e308c8629920b11fff51a304d0bf59d04ee3ad9b 20-fix-libc-version.patch +914c896c7736330834a2a66b60615656b67df5348c65b8ba48478e98044d1fae781082aa510263a7f7a3cb13fa2c019747600250e5b584a12870553cf9fe1f99 30-fix-backtrace.patch +56db8f43afc94713ac65b174189e2dd903b5e1eff0b65f1bdac159e52ad4de6606c449865d73bd47bffad6a8fc339777e2b11395596e9a476867d94a219c7925 40-fix-elf-native-class.patch +9bcd870742c31bf25f34188ddc3c414de1103e9860dea9f54eee276b89bc2cf1226abab1749c5cda6a6fb0880e541373754e5e83d63cc7189d4b9c274fd555c3 mongodb.confd +c0634af4653a3b3ca1a72671460e8ea11cce99b84a48782c5cdcc27453d7ead1e89a61d0ce225febda68913dd04e972b4d6a911060b1e5c4ecfbfc1e991e7b12 mongodb.initd +8c089b1a11f494e4148fb4646265964c925bf937633a65e395ee1361d42facf837871dd493a9a2e0f480ae0e0829dbd3ed60794c5334e2716332e131fc5c2c51 mongodb.logrotate +61d8734cef644187eeadc821c89e63a3fbf61860fe2db6e74557b1c6760fe83ba7549cb04f9e3aacea4d8e7e4d81a3b1bc0d5e29715eca33c4761adb17ea9ab7 mongos.confd +28b54e19efd977721549b95e23d34b070c1af0648d5ae60e2457c86a3c18e5cbb6a56fa147d13a38ac540cf9315ac8f74cddaa3c7baafc56c8c6e5596ebef0c0 mongos.initd" diff --git a/testing/mongodb/mongodb.confd b/testing/mongodb/mongodb.confd new file mode 100644 index 0000000000..4f76c5a79f --- /dev/null +++ b/testing/mongodb/mongodb.confd @@ -0,0 +1,14 @@ +# Mongodb essentials +MONGODB_EXEC="/usr/bin/mongod" +MONGODB_RUN="/var/run/mongodb" +MONGODB_DATA="/var/lib/mongodb" +MONGODB_USER="mongodb" + +# Listen to specified IP, comment this to listen to all +MONGODB_IP="127.0.0.1" + +# Listen to specified port +MONGODB_PORT="27017" + +# Set extra options here, such as disabling the admin web server +MONGODB_OPTIONS="--journal" diff --git a/testing/mongodb/mongodb.initd b/testing/mongodb/mongodb.initd new file mode 100644 index 0000000000..5b7b77eebf --- /dev/null +++ b/testing/mongodb/mongodb.initd @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/mongodb/files/mongodb.initd,v 1.5 2013/01/18 11:19:27 ultrabug Exp $ + +depend() { + need net +} + +start() { + checkpath -d -m 0750 -o "${MONGODB_USER}":mongodb "${MONGODB_RUN}" + + # Listen to MONGODB_IP if configured + [ -z "${MONGODB_IP}" ] || MONGODB_OPTIONS="--bind_ip ${MONGODB_IP} ${MONGODB_OPTIONS}" + + # Baselayout-1 user should use --chuid instead of --user + local USEROPT="--user" + if [ ! -f /etc/init.d/sysfs ]; then + USEROPT="--chuid" + fi + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --background --start --make-pidfile \ + --pidfile ${MONGODB_RUN:-/var/run/mongodb}/${SVCNAME}.pid \ + ${USEROPT} ${MONGODB_USER:-mongodb} \ + --exec ${MONGODB_EXEC:-/usr/bin/mongod} \ + -- \ + --port ${MONGODB_PORT:-27017} \ + --dbpath ${MONGODB_DATA:-/var/lib/mongodb} \ + --unixSocketPrefix ${MONGODB_RUN:-/var/run/mongodb} \ + --logappend --logpath /var/log/mongodb/${SVCNAME}.log \ + ${MONGODB_OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --pidfile ${MONGODB_RUN:-/var/run/mongodb}/${SVCNAME}.pid + eend $? +} diff --git a/testing/mongodb/mongodb.logrotate b/testing/mongodb/mongodb.logrotate new file mode 100644 index 0000000000..f95a438b5b --- /dev/null +++ b/testing/mongodb/mongodb.logrotate @@ -0,0 +1,13 @@ +# Default log rotation / compression keeps 1 year of logs. +/var/log/mongodb/*.log { + daily + rotate 365 + dateext + copytruncate + delaycompress + compress + notifempty + extension gz + sharedscripts + missingok +} diff --git a/testing/mongodb/mongodb.pre-install b/testing/mongodb/mongodb.pre-install new file mode 100644 index 0000000000..e02453f7b9 --- /dev/null +++ b/testing/mongodb/mongodb.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh + +adduser -D -G daemon -h /var/lib/mongodb -s /sbin/nologin mongodb +exit 0 diff --git a/testing/mongodb/mongos.confd b/testing/mongodb/mongos.confd new file mode 100644 index 0000000000..644cd0a252 --- /dev/null +++ b/testing/mongodb/mongos.confd @@ -0,0 +1,16 @@ +# Mongos essentials +MONGOS_EXEC="/usr/bin/mongos" +MONGOS_RUN="/var/run/mongodb" +MONGOS_USER="mongodb" + +# Listen to specified IP, comment this to listen to all +MONGOS_IP="127.0.0.1" + +# Listen to specified port +MONGOS_PORT="27018" + +# 1 to 3 comma separated config servers (mandatory) +MONGOS_CONFIGDB="" + +# Set extra options here +MONGOS_OPTIONS="" diff --git a/testing/mongodb/mongos.initd b/testing/mongodb/mongos.initd new file mode 100644 index 0000000000..2f9bd9a6ea --- /dev/null +++ b/testing/mongodb/mongos.initd @@ -0,0 +1,45 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/mongodb/files/mongos.initd,v 1.3 2013/01/18 11:19:27 ultrabug Exp $ + +depend() { + need net +} + +checkconfig() { + if [ -z "${MONGOS_CONFIGDB}" ]; then + eerror "MONGOS_CONFIGDB is not defined, check your configuration file !" + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + + checkpath -d -m 0750 -o "${MONGOS_USER}":mongodb "${MONGOS_RUN}" + + # Listen to MONGOS_IP if configured + [ -z "${MONGOS_IP}" ] || MONGOS_OPTIONS="--bind_ip ${MONGOS_IP} ${MONGOS_OPTIONS}" + + local USEROPT="--user" + ebegin "Starting ${SVCNAME}" + start-stop-daemon --background --start --make-pidfile \ + --pidfile ${MONGOS_RUN:-/var/run/mongodb}/${SVCNAME}.pid \ + ${USEROPT} ${MONGOS_USER:-mongodb} \ + --exec ${MONGOS_EXEC:-/usr/bin/mongos} \ + -- \ + --port ${MONGOS_PORT:-27018} \ + --unixSocketPrefix ${MONGOS_RUN:-/var/run/mongodb} \ + --logappend --logpath /var/log/mongodb/${SVCNAME}.log \ + --configdb ${MONGOS_CONFIGDB} \ + ${MONGOS_OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --pidfile ${MONGOS_RUN:-/var/run/mongodb}/${SVCNAME}.pid + eend $? +} |