From 6d7b77df0a400648112e1dc04c6b55c3f9450117 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Tue, 13 Sep 2016 16:18:46 +0100 Subject: [PATCH 1/2] mongodb: Fix default storage engine on i686 MongoDB will refuse to start on i686 because the default database engine "wiredTiger" doesn't support it. To reduce user annoyance, the default engine should be changed to the pre-3.0 engine "mmapv1". Fedora have also patched it: http://pkgs.fedoraproject.org/cgit/rpms/mongodb.git/commit/?id=b64d6b3337bffdeea0b7fa530ea02b977c364e08 --- pkgs/servers/nosql/mongodb/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/servers/nosql/mongodb/default.nix b/pkgs/servers/nosql/mongodb/default.nix index ab4524e69593..ee1987bd7e33 100644 --- a/pkgs/servers/nosql/mongodb/default.nix +++ b/pkgs/servers/nosql/mongodb/default.nix @@ -80,6 +80,11 @@ in stdenv.mkDerivation rec { substituteInPlace src/third_party/s2/s2cap.cc --replace drem remainder substituteInPlace src/third_party/s2/s2latlng.cc --replace drem remainder substituteInPlace src/third_party/s2/s2latlngrect.cc --replace drem remainder + '' + stdenv.lib.optionalString stdenv.isi686 '' + + # don't fail by default on i686 + substituteInPlace src/mongo/db/storage/storage_options.h \ + --replace 'engine("wiredTiger")' 'engine("mmapv1")' ''; buildPhase = '' From 795a6e7610c5242d68cbc37247e0cef6a263e76d Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Tue, 13 Sep 2016 16:38:45 +0100 Subject: [PATCH 2/2] mongodb service: add test case --- nixos/release.nix | 1 + nixos/tests/mongodb.nix | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nixos/tests/mongodb.nix diff --git a/nixos/release.nix b/nixos/release.nix index d66ebd7cb15c..7fcff78f6b95 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -260,6 +260,7 @@ in rec { #tests.logstash = callTest tests/logstash.nix {}; tests.mathics = callTest tests/mathics.nix {}; tests.misc = callTest tests/misc.nix {}; + tests.mongodb = callTest tests/mongodb.nix {}; tests.mumble = callTest tests/mumble.nix {}; tests.munin = callTest tests/munin.nix {}; tests.mysql = callTest tests/mysql.nix {}; diff --git a/nixos/tests/mongodb.nix b/nixos/tests/mongodb.nix new file mode 100644 index 000000000000..18535f51af9b --- /dev/null +++ b/nixos/tests/mongodb.nix @@ -0,0 +1,34 @@ +# This test start mongodb, runs a query using mongo shell + +import ./make-test.nix ({ pkgs, ...} : let + testQuery = pkgs.writeScript "nixtest.js" '' + db.greetings.insert({ "greeting": "hello" }); + print(db.greetings.findOne().greeting); + ''; +in { + name = "mongodb"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ bluescreen303 offline wkennington cstrahan rvl ]; + }; + + nodes = { + one = + { config, pkgs, ... }: + { + services = { + mongodb.enable = true; + mongodb.extraConfig = '' + # Allow starting engine with only a small virtual disk + storage.journal.enabled: false + storage.mmapv1.smallFiles: true + ''; + }; + }; + }; + + testScript = '' + startAll; + $one->waitForUnit("mongodb.service"); + $one->succeed("mongo nixtest ${testQuery}") =~ /hello/ or die; + ''; +})