[PATCH] Add MongoDB package and service.

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Christopher Baines
  • Roel Janssen
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal

Debbugs page

Christopher Baines wrote 8 years ago
(address . guix-patches@gnu.org)
20170823101831.72c11e2f@cbaines.net
This is a work in progress issue for supporting MongoDB in Guix.

Back in March 2016, Roel Janssen sent a working package patch to
guix-devel, but there was concern from those reviewing about the
security implications of the amount of third party code that is
included with the MongoDB source.

I've taken that original patch, and started to try and get MongoDB to
build using libraries and tools from Guix. In addition, I've added a
very basic service definition and system test.

This isn't ready to be merged yet, but I think it's good to work on in
public. Patches to follow...
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlmdSGdfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9Xc6+BAAhYcUDijtO7kwA10+pt063u4WAxw+GSE3X0Nwnji1QC7VGGtTYzUl83kO
z5TLemJc/BJlzioQbU87EHB0JnBf0K3s+YtwZ8og+NBgfvYEPRfekC3mt6Va+mpg
MnRivrBetp8DRlP2P/3hDOp1gUC3imwgz+n9a8025R2LhXtEKR+zfcprQWoWWJHt
l0sx4u9VL9+V4oqbiye0J2PWnnE+eec/KuxYS9o0vRWM4XRolGa1ySwRmtbt7Dzx
vbWE2rJXmDTrgnqgSVrygtyhtkZoaIINkeb8lKtTtdXisP8T6CGJi8jOTT/D2pO8
hUS4zxsoIUuxZoRCosix6ljhChyyY7DOeRRdzfHCtuAeIt28Yzu1FuIGbvoid+el
ulMuTdCmToXbW+Dxj2pwBammEu7pf9oQGkx50Sb+ixtov8miwsNLpqBBTOk5plZ5
k33wYjxzRBx7ljP0NIH3ShVjgyWjOG82DUUDjo2iBME9BTM/OWenUpPKS0wTr30s
27DjKJcPWNAeTPNeQSvXBvUnfgMNttDGpK882iqFYD36fYIz5UUwjheZAUVlaKYy
HnZpUpqokEfN7J7Fk5xEAKVDhErwSW21OMKFITvCubVAD1WgiSoOiuUgpPAXtE94
uFY2hici7yuYHf0cQsM8qXnxjGgjKF4na2sVZV7dABTzrNpOmoE=
=aVFg
-----END PGP SIGNATURE-----


Christopher Baines wrote 8 years ago
[PATCH 1/4] vm: Add disk-image-size to <virtual-machine>.
(address . 28198@debbugs.gnu.org)
20170823092516.6846-1-mail@cbaines.net
* gnu/system/vm.scm (<virtual-machine>): Add
disk-image-size.
(port-forwardings->qemu-options): Use disk-image-size from
<virtual-machine>.
---
gnu/system/vm.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Toggle diff (43 lines)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 4494af003..45a14ef67 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -653,6 +653,8 @@ it is mostly useful when FULL-BOOT? is true."
(default #f))
(memory-size virtual-machine-memory-size ;integer (MiB)
(default 256))
+ (disk-image-size virtual-machine-disk-image-size ;integer (bytes)
+ (default (* 70 (expt 2 20))))
(port-forwardings virtual-machine-port-forwardings ;list of integer pairs
(default '())))
@@ -681,12 +683,15 @@ FORWARDINGS is a list of host-port/guest-port pairs."
system target)
;; XXX: SYSTEM and TARGET are ignored.
(match vm
- (($ <virtual-machine> os qemu graphic? memory-size ())
+ (($ <virtual-machine> os qemu graphic? disk-image-size memory-size ())
(system-qemu-image/shared-store-script os
#:qemu qemu
#:graphic? graphic?
- #:memory-size memory-size))
- (($ <virtual-machine> os qemu graphic? memory-size forwardings)
+ #:memory-size memory-size
+ #:disk-image-size
+ disk-image-size))
+ (($ <virtual-machine> os qemu graphic? memory-size disk-image-size
+ forwardings)
(let ((options
`("-net" ,(string-append
"user,"
@@ -695,6 +700,8 @@ FORWARDINGS is a list of host-port/guest-port pairs."
#:qemu qemu
#:graphic? graphic?
#:memory-size memory-size
+ #:disk-image-size
+ disk-image-size
#:options options)))))
;;; vm.scm ends here
--
2.14.1
Christopher Baines wrote 8 years ago
[PATCH 3/4] services: Add MongoDB.
(address . 28198@debbugs.gnu.org)
20170823092516.6846-3-mail@cbaines.net
* ...
---
gnu/services/databases.scm | 87 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)

Toggle diff (107 lines)
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index de1f6b841..107bb2d09 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -44,6 +44,10 @@
memcached-configuration-udp-port
memcached-configuration-additional-options
+ mongodb-configuration
+ mongodb-configuration?
+ mongodb-service-type
+
mysql-service
mysql-service-type
mysql-configuration
@@ -263,6 +267,89 @@ and stores the database cluster in @var{data-directory}."
(default-value (memcached-configuration))))
+;;;
+;;; MongoDB
+;;;
+
+(define %default-mongodb-configuration-file
+ (plain-file
+ "mongodb.yaml"
+ "# GNU Guix: MongoDB default configuration file
+processManagement:
+ pidFilePath: /var/run/mongodb/pid
+storage:
+ dbPath: /var/lib/mongodb
+"))
+
+
+(define-record-type* <mongodb-configuration>
+ mongodb-configuration make-mongodb-configuration
+ mongodb-configuration?
+ (mongodb mongodb-configuration-mongodb
+ (default mongodb))
+ (port mongodb-congiguration-port
+ (default 27017))
+ (configuration-file mongodb-configuration-file
+ (default %default-mongodb-configuration-file))
+ (data-directory mongodb-configuration-data-directory
+ (default "/var/lib/mongodb")))
+
+(define %mongodb-accounts
+ (list (user-group (name "mongodb") (system? #t))
+ (user-account
+ (name "mongodb")
+ (group "mongodb")
+ (system? #t)
+ (comment "Mongodb server user")
+ (home-directory "/var/lib/mongodb")
+ (shell (file-append shadow "/sbin/nologin")))))
+
+(define mongodb-activation
+ (match-lambda
+ (($ <mongodb-configuration> mongodb port config-file data-directory)
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((user (getpwnam "mongodb")))
+ (for-each
+ (lambda (directory)
+ (mkdir-p directory)
+ (chown directory
+ (passwd:uid user) (passwd:gid user)))
+ '("/var/run/mongodb" #$data-directory)))))))
+
+(define mongodb-shepherd-service
+ (match-lambda
+ (($ <mongodb-configuration> mongodb port config-file data-directory)
+ (shepherd-service
+ (provision '(mongodb))
+ (documentation "Run the Mongodb daemon.")
+ (requirement '(user-processes loopback))
+ (start #~(make-forkexec-constructor
+ `(,(string-append #$mongodb "/bin/mongod")
+ "--config"
+ ,#$config-file)
+ #:user "mongodb"
+ #:group "mongodb"
+ #:pid-file "/var/run/mongodb/pid"
+ ;#:log-file "/var/log/mongodb.log"
+ ))
+ (stop #~(make-kill-destructor))))))
+
+(define mongodb-service-type
+ (service-type
+ (name 'mongodb)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ (compose list
+ mongodb-shepherd-service))
+ (service-extension activation-service-type
+ mongodb-activation)
+ (service-extension account-service-type
+ (const %mongodb-accounts))))
+ (default-value
+ (mongodb-configuration))))
+
+
;;;
;;; MySQL.
;;;
--
2.14.1
Christopher Baines wrote 8 years ago
[PATCH 2/4] gnu: Add mongodb.
(address . 28198@debbugs.gnu.org)
20170823092516.6846-2-mail@cbaines.net
* gnu/packages/databases.scm (mongodb): New variable.
---
gnu/packages/databases.scm | 86 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

Toggle diff (108 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 77abed691..9d98da3c0 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -66,8 +66,10 @@
#:use-module (gnu packages python)
#:use-module (gnu packages rdf)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages serialization)
#:use-module (gnu packages tcl)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages valgrind)
#:use-module (gnu packages xml)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
@@ -314,6 +316,90 @@ and generic API, and was originally intended for use with dynamic web
applications.")
(license license:bsd-3)))
+(define-public mongodb
+ (package
+ (name "mongodb")
+ (version "3.4.4")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/mongodb/mongo/archive/r"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32 "1ccd6azplqpi9pp3l6fsi8240kkgagq5j6c2dksppjn7slk1kdy8"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("scons" ,scons)
+ ("python" ,python-2)
+ ("openssl" ,openssl)
+ ("boost" ,boost)
+ ("snappy" ,snappy)
+ ("zlib" ,zlib)
+ ("pcre" ,pcre)
+ ("valgrind" ,valgrind)
+ ("yaml-cpp" ,yaml-cpp)
+ ("perl" ,perl)))
+ (arguments
+ `(#:tests? #f ;; TODO: Check phase currently fails
+ #:phases
+ (let ((common-options
+ `(;; "--use-system-tcmalloc" TODO: Missing gperftools
+ "--use-system-pcre"
+ ;; TODO
+ ;; build/opt/mongo/db/fts/unicode/string.o failed: Error 1
+ ;; "--use-system-boost"
+ "--use-system-snappy"
+ "--use-system-zlib"
+ "--use-system-valgrind"
+ ;; "--use-system-stemmer" TODO: Missing relevant package
+ "--use-system-yaml"
+ "--disable-warnings-as-errors"
+ ,(format #f "--jobs=~a" (parallel-job-count))
+ "--ssl")))
+ (modify-phases %standard-phases
+ (delete 'configure) ; There is no configure phase
+ (add-after 'unpack 'scons-propagate-environment
+ (lambda _
+ ;; Modify the SConstruct file to arrange for
+ ;; environment variables to be propagated.
+ (substitute* "SConstruct"
+ (("^env = Environment\\(")
+ "env = Environment(ENV=os.environ, "))))
+ (add-after 'unpack 'create-version-file
+ (lambda _
+ (call-with-output-file "version.json"
+ (lambda (port)
+ (display ,(simple-format #f "{
+ \"version\": \"~A\"
+}" version) port)))))
+ (replace 'build
+ (lambda _
+ (zero? (apply system*
+ `("scons"
+ ,@common-options
+ "mongod" "mongo" "mongos")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (or (not tests?)
+ (zero? (apply system*
+ `("scons"
+ ,@common-options
+ "dbtest" "unittests"))))))
+ (replace 'install
+ (lambda _
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin")))
+ (install-file "mongod" bin)
+ (install-file "mongos" bin)
+ (install-file "mongo" bin))))))))
+ (home-page "https://www.mongodb.org/")
+ (synopsis "High performance and high availability document database")
+ (description
+ "Mongo is a high-performance, high availability, schema-free
+document-oriented database. A key goal of MongoDB is to bridge the gap
+between key/value stores (which are fast and highly scalable) and traditional
+RDBMS systems (which are deep in functionality).")
+ (license (list license:agpl3 license:asl2.0))))
+
(define-public mysql
(package
(name "mysql")
--
2.14.1
Christopher Baines wrote 8 years ago
[PATCH 4/4] tests: databases: Add MongoDB test.
(address . 28198@debbugs.gnu.org)
20170823092516.6846-4-mail@cbaines.net
* gnu/tests/databases.scm (%test-mongodb): New variable.
---
gnu/tests/databases.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 76 insertions(+), 1 deletion(-)

Toggle diff (96 lines)
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index 9d9a75374..1dbb8a12a 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -25,9 +25,11 @@
#:use-module (gnu services)
#:use-module (gnu services databases)
#:use-module (gnu services networking)
+ #:use-module (gnu packages databases)
#:use-module (guix gexp)
#:use-module (guix store)
- #:export (%test-memcached))
+ #:export (%test-memcached
+ %test-mongodb))
(define %memcached-os
(simple-operating-system
@@ -121,3 +123,76 @@
(name "memcached")
(description "Connect to a running MEMCACHED server.")
(value (run-memcached-test))))
+
+(define %mongodb-os
+ (operating-system
+ (inherit
+ (simple-operating-system
+ (dhcp-client-service)
+ (service mongodb-service-type)
+ (extra-special-file "/etc/os-release"
+ (plain-file "os-release" "guix\n"))))
+ (packages (cons* mongodb
+ %base-packages))))
+
+(define* (run-mongodb-test #:optional (port 27017))
+ "Run tests in %MONGODB-OS, forwarding PORT."
+ (define os
+ (marionette-operating-system
+ %mongodb-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (memory-size 1024)
+ (disk-image-size (* 1024 (expt 2 20)))
+ (port-forwardings `((27017 . ,port)))))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-11) (srfi srfi-64)
+ (gnu build marionette)
+ (ice-9 rdelim))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "mongodb")
+
+ ;; Wait for mongodb to be up and running.
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'mongodb)
+ (#f #f)
+ (('service response-parts ...)
+ (match (assq-ref response-parts 'running)
+ ((pid) (number? pid))))))
+ marionette))
+
+ (test-eq "can connect"
+ 0
+ (system* (string-append #$mongodb "/bin/mongo")
+ "test"
+ "--eval"
+ "help"))
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "mongodb-test" test))
+
+(define %test-mongodb
+ (system-test
+ (name "mongodb")
+ (description "Connect to a running MONGODB server.")
+ (value (run-mongodb-test))))
+
+%mongodb-os
--
2.14.1
Christopher Baines wrote 8 years ago
Re: [PATCH] gnu: Add mongodb.
(address . guix-devel@gnu.org)
20170823103006.4b751414@cbaines.net
On Thu, 17 Mar 2016 16:08:24 +0100
Roel Janssen <roel@gnu.org> wrote:

Toggle quote (6 lines)
> Dear Guix,
>
> This is a patch to add MongoDB (server and client) tools. I used a
> three-line patch to fix the build process's reliance on Git and the
> .git/ directory.

Hey,

I've now created bug #28198 with a slightly modified version of this
patch.

I've started the process of trying to build MongoDB without using the
third party source code that's included. It's going quite slowly,
mostly because the package takes a while to build.

The patches I've sent to #28198 also include a very basic service and
system test. The system test currently fails, as the mongo client
attempts to determine a "distroName", and fails. I haven't worked out
what to do about this yet...

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlmdSx5fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XfXEQ//aGzEYvhjJ0kV8q63SIwyMxvnn8/pWrJth+oDU0KY4LzbVXi707hx/46a
jaOBx5hwEMy/pQDBjKAy8ZbXcl38gqesflXBnmEn3b/+E1CxlfZL2DdfCxPSIp5c
U/lvcf1XifWtI+osyMDefNeyfOlPxCRkE6HhHu7RPbNtc93zxrE7KA9CB8JMiUBc
Z/kR4/UYaOQuf8B1SLHKt52YpVAecS2tuDMh5kWkLQAnBD0S6ryEanTQMvbOwwdz
z1S3w8cN6bjer5RVdIhoZz1aXmw09cEizpRFq+Jiw3zkIqS4k80uHsWGyTYy3CZG
9eNBBQkMDekTx1SNx/T/uvAn24cnxqW//7OgIhyo5aRL0grArsbd5twJjW1Q49Kq
XvqcnwY2w/Qz5gW+cRbFFQ9uhYch+80dam8Q5RSoGB9fXEWjlnBlCSSZA9kYz4f0
hol36Bbx/OzVhqlstVCI7iO3lTOBqFWTJYNGhn3i5+djyiT51BYMtyf/961XY7T8
Aj1xTFBpnxN2WAYoD8Uozq1iZlsv3CwRIbkJVZe+ikbh4LqWRWebysPA1oBbaydC
+hknpCTviXSKQ0idUTvD9bLEmSfI4DrLZmGHyo68vwj8PihakGRrQxpjILBVJh0Z
IOkrRP6FuiX3CoenBKzeVwr7z0lhqCXx26ZCOY+AD5Cl5iQGh2s=
=ju2R
-----END PGP SIGNATURE-----


Roel Janssen wrote 8 years ago
Re: [bug#28198] [PATCH] Add MongoDB package and service.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87fucevu1o.fsf@gnu.org
Christopher Baines writes:

Toggle quote (14 lines)
> This is a work in progress issue for supporting MongoDB in Guix.
>
> Back in March 2016, Roel Janssen sent a working package patch to
> guix-devel, but there was concern from those reviewing about the
> security implications of the amount of third party code that is
> included with the MongoDB source.
>
> I've taken that original patch, and started to try and get MongoDB to
> build using libraries and tools from Guix. In addition, I've added a
> very basic service definition and system test.
>
> This isn't ready to be merged yet, but I think it's good to work on in
> public. Patches to follow...

Hello Chris,

Sorry for the late reaction and thanks for picking this up. I haven't
built mongodb with your patches, but I hope to find the time for this at
some point next week.

I believe I ran into a licensing issue with mongodb's third party stuff.
I cannot find the problematic library so quickly, but we should verify
the licenses of each library in the "third_party" folder:

So, at least the list of licenses for the mongodb package should be
made complete.

Kind regards,
Roel Janssen
Christopher Baines wrote 8 years ago
(name . Roel Janssen)(address . roel@gnu.org)(address . 28198@debbugs.gnu.org)
20170827233010.19ff6ce2@cbaines.net
On Sun, 27 Aug 2017 00:33:07 +0200
Roel Janssen <roel@gnu.org> wrote:

Toggle quote (30 lines)
> Christopher Baines writes:
>
> > This is a work in progress issue for supporting MongoDB in Guix.
> >
> > Back in March 2016, Roel Janssen sent a working package patch to
> > guix-devel, but there was concern from those reviewing about the
> > security implications of the amount of third party code that is
> > included with the MongoDB source.
> >
> > I've taken that original patch, and started to try and get MongoDB
> > to build using libraries and tools from Guix. In addition, I've
> > added a very basic service definition and system test.
> >
> > This isn't ready to be merged yet, but I think it's good to work on
> > in public. Patches to follow...
>
> Hello Chris,
>
> Sorry for the late reaction and thanks for picking this up. I haven't
> built mongodb with your patches, but I hope to find the time for this
> at some point next week.
>
> I believe I ran into a licensing issue with mongodb's third party
> stuff. I cannot find the problematic library so quickly, but we
> should verify the licenses of each library in the "third_party"
> folder: https://github.com/mongodb/mongo/tree/master/src/third_party
>
> So, at least the list of licenses for the mongodb package should be
> made complete.

Sounds good. Note that I don't think we need to check all the
libraries, as we can hopefully remove the libraries where a
--use-system-... flag is present, which is 5 of them at the moment.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlmjR/JfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XdBDRAAk5ryds3JC/SrjJ5aiJ0sHVQG6bWG6yWBvXp4ttgbOSAlGgF6pNRg+Gs5
mcKZirAMWTyDDJKwFnYa4UH2HxpPOUYa6gG6S57DdkQ1fhOnZuMpXHB1MrPPH0FJ
KPkhUOcYp4+pzhljtd/19fDBrTwddV3/ogZzAivvu/UU4VR2iaIGj768RL9/H0ZJ
u9O4LTqs7y6XFeXuVw+kiAERpkfa6+ZqaP9CMxrzIB97siVyGCJRFpHVtiYxTa7n
avLvE2dhPOOe7zAyjH/brlYR8I/N9jmvpWst42ghbia7AtcIlXYIIz+6/aLWHTqS
w9KWrN0p0hVhg7qv15AykNt6XopfW63rSQLpRLp6jVT3MKShAlfnrxByoaZgshHh
QqiP+Tv3tskSn1jcaDhZ8rnRzFKLjNfU0oUmoZ9C3a5rO0NiqzCY+hK2SgVmkLTL
umxThQ2UOzbX2E4SYN6/JS44LWvfIjrD1+NdOM9nBPcvrC3PWFuStRPWmPPO1SvP
C8TtQoH6wxwNcBzxS0tPh694MypIKctmvs8QJrkEVPWvVm4s1PaJo9ig1ttmPN09
W6gaS/B0UnuhlaOkrJopaSKnt0mZqq844FLK2dN7RDJuOAF35lOAWeyDliqqyhUJ
0jdIl9Ise/x0NfIpyq5E6vxhmtZvZdq6l9SBNjBHoVlFnfymEoM=
=ICjs
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 8 years ago
Re: [bug#28198] [PATCH 1/4] vm: Add disk-image-size to <virtual-machine>.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87y3pzudh7.fsf@gnu.org
Hi Chris,

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (5 lines)
> * gnu/system/vm.scm (<virtual-machine>): Add
> disk-image-size.
> (port-forwardings->qemu-options): Use disk-image-size from
> <virtual-machine>.

In which case is it useful? Perhaps if you want to create lots of data
on the root file system in the MongoDB test?

Currently <virtual-machine> builds a shared-store VM (like ‘guix system
vm’) in which the root file system has a fixed size that’s usually good
enough.

Toggle quote (9 lines)
> --- a/gnu/system/vm.scm
> +++ b/gnu/system/vm.scm
> @@ -653,6 +653,8 @@ it is mostly useful when FULL-BOOT? is true."
> (default #f))
> (memory-size virtual-machine-memory-size ;integer (MiB)
> (default 256))
> + (disk-image-size virtual-machine-disk-image-size ;integer (bytes)
> + (default (* 70 (expt 2 20))))

I think we can use 'guess here as the default value (and we should do
the same in places where #:disk-image-size has an arbitrary default.)

Ludo’.
Ludovic Courtès wrote 8 years ago
Re: [bug#28198] [PATCH 2/4] gnu: Add mongodb.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87shg7udc5.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/databases.scm (mongodb): New variable.

[...]

Toggle quote (13 lines)
> + (build-system gnu-build-system)
> + (native-inputs
> + `(("scons" ,scons)
> + ("python" ,python-2)
> + ("openssl" ,openssl)
> + ("boost" ,boost)
> + ("snappy" ,snappy)
> + ("zlib" ,zlib)
> + ("pcre" ,pcre)
> + ("valgrind" ,valgrind)
> + ("yaml-cpp" ,yaml-cpp)
> + ("perl" ,perl)))

Seems like some of these should rather go to ‘inputs’, no?

Toggle quote (3 lines)
> + (arguments
> + `(#:tests? #f ;; TODO: Check phase currently fails

Maybe leave a few details on why this is failing.

Toggle quote (7 lines)
> + (replace 'install
> + (lambda _
> + (let ((bin (string-append (assoc-ref %outputs "out") "/bin")))
> + (install-file "mongod" bin)
> + (install-file "mongos" bin)
> + (install-file "mongo" bin))))))))

Return #t.

Toggle quote (9 lines)
> + (synopsis "High performance and high availability document database")
> + (description
> + "Mongo is a high-performance, high availability, schema-free
> +document-oriented database. A key goal of MongoDB is to bridge the gap
> +between key/value stores (which are fast and highly scalable) and traditional
> +RDBMS systems (which are deep in functionality).")
> + (license (list license:agpl3 license:asl2.0))))

AGPL version 3 only? Also please add a comment stating whether it’s
dual-licensed or something else.

OK with these changes, thank you!

Ludo’.
Ludovic Courtès wrote 8 years ago
Re: [bug#28198] [PATCH 3/4] services: Add MongoDB.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87o9qvud9u.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (2 lines)
> * ...

Fill in the dots. :-)

With a few lines in the manual it would be perfect!

Ludo’.
Ludovic Courtès wrote 8 years ago
Re: [bug#28198] [PATCH 4/4] tests: databases: Add MongoDB test.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87h8wnud46.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (2 lines)
> * gnu/tests/databases.scm (%test-mongodb): New variable.

FWIW I’d suggest squashing it with the patch that adds the MongoDB
service, since they really go together.

Toggle quote (9 lines)
> +(define %mongodb-os
> + (operating-system
> + (inherit
> + (simple-operating-system
> + (dhcp-client-service)
> + (service mongodb-service-type)
> + (extra-special-file "/etc/os-release"
> + (plain-file "os-release" "guix\n"))))

Does it require that ‘os-release’ file? If so, should the service add
it? That would probably intrusive though, so it’s even better if
MongoDB does not require it.

Toggle quote (7 lines)
> + (test-eq "can connect"
> + 0
> + (system* (string-append #$mongodb "/bin/mongo")
> + "test"
> + "--eval"
> + "help"))

If it’s easy to do through the CLI, it might be worth trying insert an
element and query it.

Toggle quote (2 lines)
> +%mongodb-os

Leftover.

Otherwise LGTM, thank you!

Ludo’.
Christopher Baines wrote 7 years ago
Re: [bug#28198] [PATCH] gnu: Add mongodb.
(address . 28198@debbugs.gnu.org)
20170915182440.5294611c@cbaines.net
On Wed, 23 Aug 2017 10:30:06 +0100
Christopher Baines <mail@cbaines.net> wrote:

Toggle quote (5 lines)
> The patches I've sent to #28198 also include a very basic service and
> system test. The system test currently fails, as the mongo client
> attempts to determine a "distroName", and fails. I haven't worked out
> what to do about this yet...

I started a thread about the issue with the mongo client failing on the
mongodb-user mailing list [1], and I've now also got around to creating
a ticket on the MongoDB issue tracker about it [2].

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlm8DNhfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9Xd+Qw/8Dwnw781hADBFOasMz17MSPwbkDij+FGZoDY6643PpE/JbkR51NXrxz5w
6mf5MvswmEsQSmQX5v676gZxrPM8jg4GrE/cun3DKY0TJM82Ug7yWF1XLOkVv5kF
N9rfcHUwbwHRbHEI5LF0a464bEWyeWLWNNVQ30KD0fKHjVjKsuvdzNHnrK5Ieqm7
ZGVB/0Tl5QaTLg3jMIGAGJcGLrfdLog09McH8DXC/+sT5cMRG48kuz+Lce389+tc
YXygHkTVBxQzuOCN/5biQ6yoGpFRSf/FW2xbz6iVTV74qk48k/69KLy7f5TwlWjh
2BFRjTqjMdM9TRFsodq9D4/ESRce+tMJhfTeg4p/xViEMH8w0iTwGIwHR5klt7JX
AfJ/uh0cw1IwVasvrkdb3bMthsV0onfeqikvB3E58uPpPZBuVHvwVfJt7vq2c6eA
MirUn8KfyN9N3KL3MAEAK66suav+X9eYDPE/nanEefaSZ9wcwy8KxuBHUxBUbyNO
ZxEfnE4Vs6WCdKQ3fDb/uAhIDJw68A/4G9qOfHc+aQFeYFlwcTnNAe8IYyb3o488
xIYhM5VTf8KvEQq5i4XZZXrpZ+Mf0w9jNPUkWFFgPuEeV9zh/XEPsaAYi0EQPC9q
LnSiZhG3mhEOBqxX519im1ePO9CphvoyUaXIRPX8eMIU3Kqs0Ug=
=etO6
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 7 years ago
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
878thejs6q.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (15 lines)
> On Wed, 23 Aug 2017 10:30:06 +0100
> Christopher Baines <mail@cbaines.net> wrote:
>
>> The patches I've sent to #28198 also include a very basic service and
>> system test. The system test currently fails, as the mongo client
>> attempts to determine a "distroName", and fails. I haven't worked out
>> what to do about this yet...
>
> I started a thread about the issue with the mongo client failing on the
> mongodb-user mailing list [1], and I've now also got around to creating
> a ticket on the MongoDB issue tracker about it [2].
>
> 1: https://groups.google.com/d/msg/mongodb-user/jmv1dzc0Kp4/ixvXwyVIBgAJ
> 2: https://jira.mongodb.org/browse/SERVER-31105

Given that it’s purely for statistics, IIUC the thread above, I think
the client should have an option to *not* send that information (and it
should be opt-in IMO.)

In the meantime we could patch the code to have a hard-coded
“distroName”.

Ludo’.
Christopher Baines wrote 7 years ago
Re: [bug#28198] [PATCH 1/4] vm: Add disk-image-size to <virtual-machine>.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28198@debbugs.gnu.org)
20170925213648.25ef5dd1@cbaines.net
On Thu, 31 Aug 2017 14:29:56 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (2 lines)
> Hi Chris,

Thanks for reviewing these patches Ludo, unfortunately its taken me
nearly a month to get around to replying.

Thankfully, I've made some progress in that time.

Toggle quote (14 lines)
> Christopher Baines <mail@cbaines.net> skribis:
>
> > * gnu/system/vm.scm (<virtual-machine>): Add
> > disk-image-size.
> > (port-forwardings->qemu-options): Use disk-image-size from
> > <virtual-machine>.
>
> In which case is it useful? Perhaps if you want to create lots of
> data on the root file system in the MongoDB test?
>
> Currently <virtual-machine> builds a shared-store VM (like ‘guix
> system vm’) in which the root file system has a fixed size that’s
> usually good enough.

The best answer I have at the moment is that I think MongoDB creates a
rather large file, even if it has no data to store in it. I'll do some
more investigation to confirm this though.

Toggle quote (13 lines)
> > --- a/gnu/system/vm.scm
> > +++ b/gnu/system/vm.scm
> > @@ -653,6 +653,8 @@ it is mostly useful when FULL-BOOT? is true."
> > (default #f))
> > (memory-size virtual-machine-memory-size ;integer (MiB)
> > (default 256))
> > + (disk-image-size virtual-machine-disk-image-size ;integer
> > (bytes)
> > + (default (* 70 (expt 2 20))))
>
> I think we can use 'guess here as the default value (and we should do
> the same in places where #:disk-image-size has an arbitrary default.)

I've been looking at this in the last few days. Making 'guess the
default value here does mean something, and I think it's a good idea.

As far as I can tell, for this specific test, these are the 3 functions
that are called on the way to using the actual size, and the defaults
they have:

system-qemu-image/shared-store-script default:
(* (if full-boot? 500 70)
(expt 2 20)))

system-qemu-image/shared-store default:
(* (if full-boot? 500 30)
(expt 2 20)))

qemu-image default:
'guess

From my tests, if the default in the <virtual-machine> is set to
'guess, then for the mongodb test the guess seems to be 0 MiB at the
moment, which doesn't work. I've started looking at setting a sensible
default in qemu-image, so that the root filesystem size isn't 0 MiB.

While testing with the system tests, I noticed that the ones I was
testing with didn't pass without my changes, so I've started looking in
to that now. So far, I've got one patch that helps [1], but I think
there are other issues.

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnJaOBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XdZCw/9HUxDzHqWgoE3phxoppE/TUjUufp2rzkCd121meZpm/139UWRDiQdv9Eg
icHvsq6iFS46xLyWYndtHoDCTeWwl7/079uRFZjekodmsNxC6YK9JuvgJeXLolwU
Kat+1l7ajvG/N46sSbCUHlAIb1obwJLx2jxDariDN/Gnt0/cgAurLIDkuAIYTG+I
p3OKGL71J8CmKFY9lQZG1pw/gsCCISSwV6ZHHN6W32AsSRT8fuL4ITwFKXGIGZAz
rlT7WPHgD1CE/5UWLkkbC63QTYaOPT0Lz90zJQR6yH2pa1+gqlSdz4T2Pn51tXq6
3V6e7Gk1Okz6Mi8lwvgWBcrrFm6Dc8bU57wCxpsoW7TU/mm9CzrZOcq11BY1wk0L
ylYyzA/leMskbRv4hQUQSdjHIaZ3lyHv2myYeXn7FrfYdoVDJme68rNhDxl+iCZO
kVJpBpKB9bzpJpnbc4DFzoZ0EphX/SLiYf/yapThns+40C8oAjIvw5Vuz/OYs5zb
nXu6awdYb62KUAvjPLS+kRnbZ83cqwXVyEVlgbmxTuwmVStpOxPAahGAEFJqkASy
5L64k2FRNZjGusfaidEH3jX7dg70Q5N0eDc11S1fL0xcYqqETGRyHRT6IXSDAAw/
TUp3nDWdPCRQ3VJ/lrubgBlCpymrKqwIWUY3XbWHlAkNofKLGjo=
=Xzkb
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 7 years ago
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87y3p22ap7.fsf@gnu.org
Hi Chris!

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (28 lines)
> On Thu, 31 Aug 2017 14:29:56 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Hi Chris,
>
> Thanks for reviewing these patches Ludo, unfortunately its taken me
> nearly a month to get around to replying.
>
> Thankfully, I've made some progress in that time.
>
>> Christopher Baines <mail@cbaines.net> skribis:
>>
>> > * gnu/system/vm.scm (<virtual-machine>): Add
>> > disk-image-size.
>> > (port-forwardings->qemu-options): Use disk-image-size from
>> > <virtual-machine>.
>>
>> In which case is it useful? Perhaps if you want to create lots of
>> data on the root file system in the MongoDB test?
>>
>> Currently <virtual-machine> builds a shared-store VM (like ‘guix
>> system vm’) in which the root file system has a fixed size that’s
>> usually good enough.
>
> The best answer I have at the moment is that I think MongoDB creates a
> rather large file, even if it has no data to store in it. I'll do some
> more investigation to confirm this though.

OK, that’s a good reason anyway. :-)

Toggle quote (36 lines)
>> > --- a/gnu/system/vm.scm
>> > +++ b/gnu/system/vm.scm
>> > @@ -653,6 +653,8 @@ it is mostly useful when FULL-BOOT? is true."
>> > (default #f))
>> > (memory-size virtual-machine-memory-size ;integer (MiB)
>> > (default 256))
>> > + (disk-image-size virtual-machine-disk-image-size ;integer
>> > (bytes)
>> > + (default (* 70 (expt 2 20))))
>>
>> I think we can use 'guess here as the default value (and we should do
>> the same in places where #:disk-image-size has an arbitrary default.)
>
> I've been looking at this in the last few days. Making 'guess the
> default value here does mean something, and I think it's a good idea.
>
> As far as I can tell, for this specific test, these are the 3 functions
> that are called on the way to using the actual size, and the defaults
> they have:
>
> system-qemu-image/shared-store-script default:
> (* (if full-boot? 500 70)
> (expt 2 20)))
>
> system-qemu-image/shared-store default:
> (* (if full-boot? 500 30)
> (expt 2 20)))
>
> qemu-image default:
> 'guess
>
> From my tests, if the default in the <virtual-machine> is set to
> 'guess, then for the mongodb test the guess seems to be 0 MiB at the
> moment, which doesn't work. I've started looking at setting a sensible
> default in qemu-image, so that the root filesystem size isn't 0 MiB.

Indeed. Maybe we can go with your patch as-is and investigate the
problem with 'guess separately. Thoughts?

(I’ll comment on the other issue separately.)

Thanks,
Ludo’.
Christopher Baines wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)
20170929074821.06100e60@cbaines.net
On Tue, 26 Sep 2017 09:14:28 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (76 lines)
> Hi Chris!
>
> Christopher Baines <mail@cbaines.net> skribis:
>
> > On Thu, 31 Aug 2017 14:29:56 +0200
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >
> >> Hi Chris,
> >
> > Thanks for reviewing these patches Ludo, unfortunately its taken me
> > nearly a month to get around to replying.
> >
> > Thankfully, I've made some progress in that time.
> >
> >> Christopher Baines <mail@cbaines.net> skribis:
> >>
> >> > * gnu/system/vm.scm (<virtual-machine>): Add
> >> > disk-image-size.
> >> > (port-forwardings->qemu-options): Use disk-image-size from
> >> > <virtual-machine>.
> >>
> >> In which case is it useful? Perhaps if you want to create lots of
> >> data on the root file system in the MongoDB test?
> >>
> >> Currently <virtual-machine> builds a shared-store VM (like ‘guix
> >> system vm’) in which the root file system has a fixed size that’s
> >> usually good enough.
> >
> > The best answer I have at the moment is that I think MongoDB
> > creates a rather large file, even if it has no data to store in it.
> > I'll do some more investigation to confirm this though.
>
> OK, that’s a good reason anyway. :-)
>
> >> > --- a/gnu/system/vm.scm
> >> > +++ b/gnu/system/vm.scm
> >> > @@ -653,6 +653,8 @@ it is mostly useful when FULL-BOOT? is
> >> > true." (default #f))
> >> > (memory-size virtual-machine-memory-size ;integer (MiB)
> >> > (default 256))
> >> > + (disk-image-size virtual-machine-disk-image-size ;integer
> >> > (bytes)
> >> > + (default (* 70 (expt 2 20))))
> >>
> >> I think we can use 'guess here as the default value (and we should
> >> do the same in places where #:disk-image-size has an arbitrary
> >> default.)
> >
> > I've been looking at this in the last few days. Making 'guess the
> > default value here does mean something, and I think it's a good
> > idea.
> >
> > As far as I can tell, for this specific test, these are the 3
> > functions that are called on the way to using the actual size, and
> > the defaults they have:
> >
> > system-qemu-image/shared-store-script default:
> > (* (if full-boot? 500 70)
> > (expt 2 20)))
> >
> > system-qemu-image/shared-store default:
> > (* (if full-boot? 500 30)
> > (expt 2 20)))
> >
> > qemu-image default:
> > 'guess
> >
> > From my tests, if the default in the <virtual-machine> is set to
> > 'guess, then for the mongodb test the guess seems to be 0 MiB at the
> > moment, which doesn't work. I've started looking at setting a
> > sensible default in qemu-image, so that the root filesystem size
> > isn't 0 MiB.
>
> Indeed. Maybe we can go with your patch as-is and investigate the
> problem with 'guess separately. Thoughts?

That's fine with me. I've also now created a separate bug with this
patch, and another to add a default value [1].

I tested it with the memcached system test, and the disk image size was
the same plus the test still passed. I haven't checked the other tests
yet.

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnN7LVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9Xd47g//RZ3W1CeY1S72/5ZVwSi1panfjnE8f3ZxPfnWWi5Xsu9BA8NW2fWvsoxG
A7bpzIyK09aqOhinKgAZDsS7TdNXGQOvyfs7zmF00OKppAh+ntixyqdaa8uMitS0
aV2JSFAbg6/b+wTqMPrfH+RWPsuW4e+ADx+VGSRCCbeUyBLluN+gL+D/rI3cAUSr
yfwypHDS1YF0wmX48Kcmk2SpV2JB6CLyTlLrm/hrwMlXdKPDAhTqce89zmBlF1uI
RWegm5s7n9Ii+sp++BDUhUShetadoK89oSYmt1l+08FkXdAU8kMntqJwDTzLJznS
+X/Q+16bm1fInt88BpxonzBI1nrdl90UUsLRWDfo/N+AMNWfTkR/P3X5R2Q1NYPG
Vi9/loTvymuck+HnhyfDLoLu1f4NPVzW8iuVNNjQBgrFkQDhOaQhm2wNjJDJ+ZY+
doGekWiQu+FUF63vLohboWVSriVJsIoyUhYFoK2US7W3BemvExfZHSiSv7lpVPu7
M5tHKTA8JNqC+ISgFT4ue6HySKSW7MmrR7HuTwYiK7xx0c+RcsZUwUauqYoWZBl2
u0sJ+TyYF6RuqlMaVzPKd8CesvnTa7vW1J+MUY37syAnbHfodEf/6xQsfPYAfdHb
RnyJKbbet+l5VdC84KHLufkwTwn5z6Es3R4h8RzT02ImbQy2DRM=
=+o3L
-----END PGP SIGNATURE-----


Christopher Baines wrote 7 years ago
[PATCH 1/3] vm: Add disk-image-size to <virtual-machine>.
(address . 28198@debbugs.gnu.org)
20170930075942.31332-1-mail@cbaines.net
* gnu/system/vm.scm (<virtual-machine>): Add
disk-image-size.
(port-forwardings->qemu-options): Use disk-image-size from
<virtual-machine>.
---
gnu/system/vm.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Toggle diff (43 lines)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 78143e4f7..61fc5c347 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -706,6 +706,8 @@ it is mostly useful when FULL-BOOT? is true."
(default #f))
(memory-size virtual-machine-memory-size ;integer (MiB)
(default 256))
+ (disk-image-size virtual-machine-disk-image-size ;integer (bytes)
+ (default (* 70 (expt 2 20))))
(port-forwardings virtual-machine-port-forwardings ;list of integer pairs
(default '())))
@@ -734,12 +736,15 @@ FORWARDINGS is a list of host-port/guest-port pairs."
system target)
;; XXX: SYSTEM and TARGET are ignored.
(match vm
- (($ <virtual-machine> os qemu graphic? memory-size ())
+ (($ <virtual-machine> os qemu graphic? disk-image-size memory-size ())
(system-qemu-image/shared-store-script os
#:qemu qemu
#:graphic? graphic?
- #:memory-size memory-size))
- (($ <virtual-machine> os qemu graphic? memory-size forwardings)
+ #:memory-size memory-size
+ #:disk-image-size
+ disk-image-size))
+ (($ <virtual-machine> os qemu graphic? memory-size disk-image-size
+ forwardings)
(let ((options
`("-net" ,(string-append
"user,"
@@ -748,6 +753,8 @@ FORWARDINGS is a list of host-port/guest-port pairs."
#:qemu qemu
#:graphic? graphic?
#:memory-size memory-size
+ #:disk-image-size
+ disk-image-size
#:options options)))))
;;; vm.scm ends here
--
2.14.1
Christopher Baines wrote 7 years ago
[PATCH 3/3] services: Add MongoDB.
(address . 28198@debbugs.gnu.org)
20170930075942.31332-3-mail@cbaines.net
* gnu/services/databases.scm (%default-mongodb-configuration-file,
%mongodb-accounts, mongodb-service-type): New variables.
(<mongodb-configuration>): New record type.
(mongodb-activation, mongodb-shepherd-service): New procedures.
* gnu/tests/databases.scm (%test-mongodb): New variable.
* doc/guix.text (Database Services): Add MongoDB documentation.
---
doc/guix.texi | 26 ++++++++++++++
gnu/services/databases.scm | 88 ++++++++++++++++++++++++++++++++++++++++++++++
gnu/tests/databases.scm | 86 +++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 199 insertions(+), 1 deletion(-)

Toggle diff (248 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index dd0a46a63..5be427ebd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12112,6 +12112,32 @@ Additional command line options to pass to @code{memcached}.
@end table
@end deftp
+@defvr {Scheme Variable} mongodb-service-type
+This is the service type for @uref{https://www.mongodb.com/, MongoDB}.
+The value for the service type is a @code{mongodb-configuration} object.
+@end defvr
+
+@example
+(service mongodb-service-type)
+@end example
+
+@deftp {Data Type} mongodb-configuration
+Data type representing the configuration of mongodb.
+
+@table @asis
+@item @code{mongodb} (default: @code{mongodb})
+The MongoDB package to use.
+
+@item @code{config-file} (default: @code{%default-mongodb-configuration-file})
+The configuration file for MongoDB.
+
+@item @code{data-directory} (default: @code{"/var/lib/mongodb"})
+This value is used to create the directory, so that it exists and is
+owned by the mongodb user. It should match the data-directory which
+MongoDB is configured to use through the configuration file.
+@end table
+@end deftp
+
@defvr {Scheme Variable} redis-service-type
This is the service type for the @uref{https://redis.io/, Redis}
key/value store, whose value is a @code{redis-configuration} object.
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index de1f6b841..251dbde3d 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -44,6 +44,14 @@
memcached-configuration-udp-port
memcached-configuration-additional-options
+ <mongodb-configuration>
+ mongodb-configuration
+ mongodb-configuration?
+ mongodb-configuration-mongodb
+ mongodb-configuration-config-file
+ mongodb-configuration-data-directory
+ mongodb-service-type
+
mysql-service
mysql-service-type
mysql-configuration
@@ -263,6 +271,86 @@ and stores the database cluster in @var{data-directory}."
(default-value (memcached-configuration))))
+;;;
+;;; MongoDB
+;;;
+
+(define %default-mongodb-configuration-file
+ (plain-file
+ "mongodb.yaml"
+ "# GNU Guix: MongoDB default configuration file
+processManagement:
+ pidFilePath: /var/run/mongodb/pid
+storage:
+ dbPath: /var/lib/mongodb
+"))
+
+
+(define-record-type* <mongodb-configuration>
+ mongodb-configuration make-mongodb-configuration
+ mongodb-configuration?
+ (mongodb mongodb-configuration-mongodb
+ (default mongodb))
+ (config-file mongodb-configuration-config-file
+ (default %default-mongodb-configuration-file))
+ (data-directory mongodb-configuration-data-directory
+ (default "/var/lib/mongodb")))
+
+(define %mongodb-accounts
+ (list (user-group (name "mongodb") (system? #t))
+ (user-account
+ (name "mongodb")
+ (group "mongodb")
+ (system? #t)
+ (comment "Mongodb server user")
+ (home-directory "/var/lib/mongodb")
+ (shell (file-append shadow "/sbin/nologin")))))
+
+(define mongodb-activation
+ (match-lambda
+ (($ <mongodb-configuration> mongodb config-file data-directory)
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((user (getpwnam "mongodb")))
+ (for-each
+ (lambda (directory)
+ (mkdir-p directory)
+ (chown directory
+ (passwd:uid user) (passwd:gid user)))
+ '("/var/run/mongodb" #$data-directory)))))))
+
+(define mongodb-shepherd-service
+ (match-lambda
+ (($ <mongodb-configuration> mongodb config-file data-directory)
+ (shepherd-service
+ (provision '(mongodb))
+ (documentation "Run the Mongodb daemon.")
+ (requirement '(user-processes loopback))
+ (start #~(make-forkexec-constructor
+ `(,(string-append #$mongodb "/bin/mongod")
+ "--config"
+ ,#$config-file)
+ #:user "mongodb"
+ #:group "mongodb"
+ #:pid-file "/var/run/mongodb/pid"
+ #:log-file "/var/log/mongodb.log"))
+ (stop #~(make-kill-destructor))))))
+
+(define mongodb-service-type
+ (service-type
+ (name 'mongodb)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ (compose list
+ mongodb-shepherd-service))
+ (service-extension activation-service-type
+ mongodb-activation)
+ (service-extension account-service-type
+ (const %mongodb-accounts))))
+ (default-value
+ (mongodb-configuration))))
+
+
;;;
;;; MySQL.
;;;
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index 9d9a75374..9e335b27c 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -25,9 +25,11 @@
#:use-module (gnu services)
#:use-module (gnu services databases)
#:use-module (gnu services networking)
+ #:use-module (gnu packages databases)
#:use-module (guix gexp)
#:use-module (guix store)
- #:export (%test-memcached))
+ #:export (%test-memcached
+ %test-mongodb))
(define %memcached-os
(simple-operating-system
@@ -121,3 +123,85 @@
(name "memcached")
(description "Connect to a running MEMCACHED server.")
(value (run-memcached-test))))
+
+(define %mongodb-os
+ (operating-system
+ (inherit
+ (simple-operating-system
+ (dhcp-client-service)
+ (service mongodb-service-type)))
+ (packages (cons* mongodb
+ %base-packages))))
+
+(define* (run-mongodb-test #:optional (port 27017))
+ "Run tests in %MONGODB-OS, forwarding PORT."
+ (define os
+ (marionette-operating-system
+ %mongodb-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (memory-size 1024)
+ (disk-image-size (* 1024 (expt 2 20)))
+ (port-forwardings `((27017 . ,port)))))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-11) (srfi srfi-64)
+ (gnu build marionette)
+ (ice-9 popen)
+ (ice-9 rdelim))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "mongodb")
+
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'mongodb)
+ (#f #f)
+ (('service response-parts ...)
+ (match (assq-ref response-parts 'running)
+ ((pid) (number? pid))))))
+ marionette))
+
+ (test-eq "test insert"
+ 0
+ (system* (string-append #$mongodb "/bin/mongo")
+ "test"
+ "--eval"
+ "db.testCollection.insert({data: 'test-data'})"))
+
+ (test-equal "test find"
+ "test-data"
+ (let* ((port (open-pipe*
+ OPEN_READ
+ (string-append #$mongodb "/bin/mongo")
+ "test"
+ "--quiet"
+ "--eval"
+ "db.testCollection.findOne().data"))
+ (output (read-line port))
+ (status (close-pipe port)))
+ output))
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "mongodb-test" test))
+
+(define %test-mongodb
+ (system-test
+ (name "mongodb")
+ (description "Connect to a running MONGODB server.")
+ (value (run-mongodb-test))))
--
2.14.1
Christopher Baines wrote 7 years ago
[PATCH 2/3] gnu: Add mongodb.
(address . 28198@debbugs.gnu.org)
20170930075942.31332-2-mail@cbaines.net
* gnu/packages/databases.scm (mongodb): New variable.
---
gnu/packages/databases.scm | 92 ++++++++++++++++++++++
...ngodb-support-unknown-linux-distributions.patch | 55 +++++++++++++
2 files changed, 147 insertions(+)
create mode 100644 gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch

Toggle diff (175 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 6ce58985e..4ccbe6deb 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -68,8 +68,10 @@
#:use-module (gnu packages python)
#:use-module (gnu packages rdf)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages serialization)
#:use-module (gnu packages tcl)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages valgrind)
#:use-module (gnu packages xml)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
@@ -316,6 +318,96 @@ and generic API, and was originally intended for use with dynamic web
applications.")
(license license:bsd-3)))
+(define-public mongodb
+ (package
+ (name "mongodb")
+ (version "3.4.9")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/mongodb/mongo/archive/r"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32 "0gidwyvh3bdwmk2pccgkqkaln4ysgn8iwa7ihjzllsq0rdg95045"))
+ (patches
+ (list
+ (search-patch "mongodb-support-unknown-linux-distributions.patch")))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("openssl" ,openssl)
+ ("pcre" ,pcre)
+ ("yaml-cpp" ,yaml-cpp)
+ ("zlib" ,zlib)
+ ("snappy" ,snappy)
+ ("boost" ,boost)))
+ (native-inputs
+ `(("scons" ,scons)
+ ("python" ,python-2)
+ ("valgrind" ,valgrind)
+ ("perl" ,perl)))
+ (arguments
+ `(#:phases
+ (let ((common-options
+ `(;; "--use-system-tcmalloc" TODO: Missing gperftools
+ "--use-system-pcre"
+ ;; TODO
+ ;; build/opt/mongo/db/fts/unicode/string.o failed: Error 1
+ ;; --use-system-boost
+ "--use-system-snappy"
+ "--use-system-zlib"
+ "--use-system-valgrind"
+ ;; "--use-system-stemmer" TODO: Missing relevant package
+ "--use-system-yaml"
+ "--disable-warnings-as-errors"
+ ,(format #f "--jobs=~a" (parallel-job-count))
+ "--ssl")))
+ (modify-phases %standard-phases
+ (delete 'configure) ; There is no configure phase
+ (add-after 'unpack 'scons-propagate-environment
+ (lambda _
+ ;; Modify the SConstruct file to arrange for
+ ;; environment variables to be propagated.
+ (substitute* "SConstruct"
+ (("^env = Environment\\(")
+ "env = Environment(ENV=os.environ, "))))
+ (add-after 'unpack 'create-version-file
+ (lambda _
+ (call-with-output-file "version.json"
+ (lambda (port)
+ (display ,(simple-format #f "{
+ \"version\": \"~A\"
+}" version) port)))))
+ (replace 'build
+ (lambda _
+ (zero? (apply system*
+ `("scons"
+ ,@common-options
+ "mongod" "mongo" "mongos")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (or (not tests?)
+ (zero? (apply system*
+ `("scons"
+ ,@common-options
+ "dbtest" "unittests"))))))
+ (replace 'install
+ (lambda _
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin")))
+ (install-file "mongod" bin)
+ (install-file "mongos" bin)
+ (install-file "mongo" bin))
+ #t))))))
+ (home-page "https://www.mongodb.org/")
+ (synopsis "High performance and high availability document database")
+ (description
+ "Mongo is a high-performance, high availability, schema-free
+document-oriented database. A key goal of MongoDB is to bridge the gap
+between key/value stores (which are fast and highly scalable) and traditional
+RDBMS systems (which are deep in functionality).")
+ (license (list license:agpl3
+ ;; Some parts are licensed under the Apache License
+ license:asl2.0))))
+
(define-public mysql
(package
(name "mysql")
diff --git a/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch b/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch
new file mode 100644
index 000000000..6057ebeb0
--- /dev/null
+++ b/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch
@@ -0,0 +1,55 @@
+From e724bb7018a482640c4f194f88b554af2c59d76e Mon Sep 17 00:00:00 2001
+From: Mark Benvenuto <mark.benvenuto@mongodb.com>
+Date: Wed, 20 Sep 2017 11:50:02 -0400
+Subject: [PATCH] SERVER-30857 Support unknown Linux distributions
+
+---
+ src/mongo/rpc/metadata/client_metadata.cpp | 6 ------
+ src/mongo/util/processinfo_linux.cpp | 9 ++++++---
+ 2 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/src/mongo/rpc/metadata/client_metadata.cpp b/src/mongo/rpc/metadata/client_metadata.cpp
+index 845a315dd74..a959a4e31e9 100644
+--- a/src/mongo/rpc/metadata/client_metadata.cpp
++++ b/src/mongo/rpc/metadata/client_metadata.cpp
+@@ -302,9 +302,6 @@ void ClientMetadata::serializePrivate(StringData driverName,
+ StringData osArchitecture,
+ StringData osVersion,
+ BSONObjBuilder* builder) {
+- invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
+- !osArchitecture.empty() && !osVersion.empty());
+-
+ BSONObjBuilder metaObjBuilder(builder->subobjStart(kMetadataDocumentName));
+
+ {
+@@ -347,9 +344,6 @@ Status ClientMetadata::serializePrivate(StringData driverName,
+ StringData osVersion,
+ StringData appName,
+ BSONObjBuilder* builder) {
+- invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
+- !osArchitecture.empty() && !osVersion.empty());
+-
+ if (appName.size() > kMaxApplicationNameByteLength) {
+ return Status(ErrorCodes::ClientMetadataAppNameTooLarge,
+ str::stream() << "The '" << kApplication << "." << kName
+diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
+index c3debf377bd..c2813b026b0 100644
+--- a/src/mongo/util/processinfo_linux.cpp
++++ b/src/mongo/util/processinfo_linux.cpp
+@@ -376,10 +376,13 @@ class LinuxSysHelper {
+ if ((nl = name.find('\n', nl)) != string::npos)
+ // stop at first newline
+ name.erase(nl);
+- // no standard format for name and version. use kernel version
+- version = "Kernel ";
+- version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
++ } else {
++ name = "unknown";
+ }
++
++ // There is no standard format for name and version so use the kernel version.
++ version = "Kernel ";
++ version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
+ }
+
+ /**
--
2.14.1
Christopher Baines wrote 7 years ago
Re: [bug#28198] [PATCH 2/4] gnu: Add mongodb.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28198@debbugs.gnu.org)
20170930090420.7a29807b@cbaines.net
On Thu, 31 Aug 2017 14:32:58 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (21 lines)
> Christopher Baines <mail@cbaines.net> skribis:
>
> > * gnu/packages/databases.scm (mongodb): New variable.
>
> [...]
>
> > + (build-system gnu-build-system)
> > + (native-inputs
> > + `(("scons" ,scons)
> > + ("python" ,python-2)
> > + ("openssl" ,openssl)
> > + ("boost" ,boost)
> > + ("snappy" ,snappy)
> > + ("zlib" ,zlib)
> > + ("pcre" ,pcre)
> > + ("valgrind" ,valgrind)
> > + ("yaml-cpp" ,yaml-cpp)
> > + ("perl" ,perl)))
>
> Seems like some of these should rather go to ‘inputs’, no?

Indeed. I've now sent an updated set of patches, and I've moved some of
these to inputs.

Toggle quote (5 lines)
> > + (arguments
> > + `(#:tests? #f ;; TODO: Check phase currently fails
>
> Maybe leave a few details on why this is failing.

I tried to check, and the tests passed, which seems good :)

Toggle quote (10 lines)
> > + (replace 'install
> > + (lambda _
> > + (let ((bin (string-append (assoc-ref %outputs
> > "out") "/bin")))
> > + (install-file "mongod" bin)
> > + (install-file "mongos" bin)
> > + (install-file "mongo" bin))))))))
>
> Return #t.

Good spot, this should be fixed in the latest patch.

Toggle quote (14 lines)
> > + (home-page "https://www.mongodb.org/")
> > + (synopsis "High performance and high availability document
> > database")
> > + (description
> > + "Mongo is a high-performance, high availability, schema-free
> > +document-oriented database. A key goal of MongoDB is to bridge
> > the gap +between key/value stores (which are fast and highly
> > scalable) and traditional +RDBMS systems (which are deep in
> > functionality).")
> > + (license (list license:agpl3 license:asl2.0))))
>
> AGPL version 3 only? Also please add a comment stating whether it’s
> dual-licensed or something else.

I've added a comment stating that the Apache license applies to parts
of the source code. I don't believe it's dual licensed.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnPUARfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9Xdx9Q/+OACjfYbVhOfp4vg80Gurwf7hTmvd7BUQf/PLX7eMrVeOnjvDTFgV07JA
Y2J6JF1KAme16SDyrnJaDSe4HQPU+hBaT/a6SkMtqQ0nkC8X9oNyogM6Gc8g7ZEt
O4TBoTV1eTVowmv9gBKUP8KllVO1z/UAv4Kl5sb4AZX5rTkN2OZ5oHNh6t67C2IZ
+coBTvMAEapw44bqfDJVQpci56M3Y4BjLm65TW7RTyS289Dx7N9iHfACl1lZm5ck
/kCeZKMKVnwOfExM8bnaGYVyq1PZTABo91HrayMJjZqLZktyYEEnbLSMzJfhRiEl
QZP9iRs1REIlLCyuNNMhk8nDjurEAmf/6ty1xkGhquluvAHJ2sCwlz3zSOj9beZW
HEn4Yt+jnbZ/LDy5r+PYpnQGjb6g1kzYdBZ9X/MjamXvWdIrMaZNFXRE6Lp1SKby
7Cu/44E906/08dogenaR74ulssSmwp2s+1bDE+nlnPic9a+wVA/aqPiqRLbPHuWA
PpgwrmwKdml3d8QE2dqeVRXuUtpxfDkCiI0kXJvNz4swSEXzft0k/zdyt7BLDz0V
hVI8SX2o4PSWfURbDm8GXV4F1KLlV5dXSC2JNtbrdXALTJFDcE8TXo2i6m04boT3
SvEC2s+CicDvuYooaQHLWcMx92tTkdBpYH2WzdoVXBj2SWBP/gQ=
=a+DQ
-----END PGP SIGNATURE-----


Christopher Baines wrote 7 years ago
Re: [bug#28198] [PATCH 3/4] services: Add MongoDB.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28198@debbugs.gnu.org)
20170930090504.13919e39@cbaines.net
On Thu, 31 Aug 2017 14:34:21 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (8 lines)
> Christopher Baines <mail@cbaines.net> skribis:
>
> > * ...
>
> Fill in the dots. :-)
>
> With a few lines in the manual it would be perfect!

This should be done. I think I've updated the commit message, and added
some documentation to the manual.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnPUDBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XeyBg//bOXtBKf1M+nKnWE+eE6SzhVPB0t/KNtjeaW0qXerH9dkx0kiUp5Iic5p
jJtCZMAAWRSbI3DutyKzz5wmvUBg94P1zkf9t3u+yv5qar9ypQW3BgrDMYGT+xOY
ne52Ox3DfCRmnPpyTWl+5YDZvb56gIMHtyHDhJwaD2irhT7d7P6MwnuresNl3Wwx
tZvS9zO/NydCVmZUI2knvktIEQhRKKciHJIJ3VKWCaRvkjGnKapYMISH4bg/Ieuw
Ozj4sxqc+ElB90Mde2rM422kayRm5tCHV5Dh8YZ2aaZJCLX87ZG825QsMszD8Z/F
4xzKz+UjH6jUfmFKqyq9hPQX02mvkWVNlAFLmpvE8qEWkEgbA3zDXqZsXQTR5vOd
yG249D6wM884GU+zdGOK/MvbYnZ/sM1mud0GuFo2pRMfJ6Mzd1MNvQ6xnXh8/LHu
Ai3gPw2JnMLkJLfQO9LY/YBCaaEe0WEWwKsAQRuxfosdFq+/yx5yP/82qWxC1ZVn
kRBayMgQ39EYtKjjl/vXF/nchelYkYIJ5dI2h2dbzZTB/RsPaSawNvkRwZZPbUrm
5DpPS7VKSm2nCNxwlgAgL30zkCO1gzUd4RVjpumlJ2NwowysDEEP0xA4epZpsvQG
wd9XURSN1VawAY7SytuIpZ1DYi29z1Nr/2TEZS3YuqGGJhKywmU=
=0zUg
-----END PGP SIGNATURE-----


Christopher Baines wrote 7 years ago
Re: [bug#28198] [PATCH 4/4] tests: databases: Add MongoDB test.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28198@debbugs.gnu.org)
20170930090941.2dbb0543@cbaines.net
On Thu, 31 Aug 2017 14:37:45 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (7 lines)
> Christopher Baines <mail@cbaines.net> skribis:
>
> > * gnu/tests/databases.scm (%test-mongodb): New variable.
>
> FWIW I’d suggest squashing it with the patch that adds the MongoDB
> service, since they really go together.

Ok, I've merged these patches together now.
Toggle quote (13 lines)
> > +(define %mongodb-os
> > + (operating-system
> > + (inherit
> > + (simple-operating-system
> > + (dhcp-client-service)
> > + (service mongodb-service-type)
> > + (extra-special-file "/etc/os-release"
> > + (plain-file "os-release" "guix\n"))))
>
> Does it require that ‘os-release’ file? If so, should the service add
> it? That would probably intrusive though, so it’s even better if
> MongoDB does not require it.

I think this was me trying to get the tests to pass, but it didn't
help, as the mongo client was running outside of the test system. I've
now removed it.

Toggle quote (10 lines)
> > + (test-eq "can connect"
> > + 0
> > + (system* (string-append #$mongodb "/bin/mongo")
> > + "test"
> > + "--eval"
> > + "help"))
>
> If it’s easy to do through the CLI, it might be worth trying insert an
> element and query it.

I've done this now. Also, I've included a patch from upstream that
fixes the crash in the client that was causing the system test to fail,
so the test should now pass.

Toggle quote (4 lines)
> > +%mongodb-os
>
> Leftover.

I've removed this now.

Toggle quote (2 lines)
> Otherwise LGTM, thank you!

Great, thanks for reviewing Ludo :)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnPUUVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XfqSg//V+/xBwehlUIBFgtEJloVnsWrlx1ylqk5pRkYJLzrCDdvT1DnVMjbhMwU
AU0yV7A4fpWli81NXjtK5PI3W/DwAcr41MqC2dsQcB1TJGvE4hgKKyxFprnmUo2D
/ku+3M/PWuDxr3TKjZPsO7Imnxr0mpaPcnHf5FZ0BKqS/rHe14aExfKNCT1qBfI6
3b/0SE5WPu0kQ/qUZ9DPsIGikixnOaZbJBuK49pO5x3jP9EodFF6dGWbAyoV50AG
WcMtIC6neG4nZd1wIb3ihkLyRD8It2xWwz8TofK1IIdoDdFO2Jo/3gAm6hzovWO8
ZuOvDcLpsvsyP0fNdLY4s3vL0mZu4aL28LF6Ef2mxX5GvvqZBAz3DMiDMRzV6bvl
/P5Al7NEy/yzyCdo1SX0lgZtiroyb5lvRim+p5xgzseuypB7n46k0QFpGef934lk
Gs0ngWXv8Lxk77MzX80fz2ZSkJAzkofslXgip8abc747D5G+kaaSWoXHnL8vH3k5
bcyTZVMqf6Xko5e4r4LUqgge03jHphGcrW840dzt1S+XHcQu//BCWxQBAd0A7jhW
iQj+879stl+A9E8TiyjtiMmGYLnFwfVfFDbJTaF1MN7z1pdOrwHhC8Pmsn3wrWy6
VSvfsIWJvL8wQQJwyKtDq0eAG/o7V4nFdk3YxLhw+Ua+qdh+dNc=
=YNGk
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 7 years ago
Re: [bug#28198] [PATCH 2/3] gnu: Add mongodb.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87k20b6knh.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/databases.scm (mongodb): New variable.

[...]

Toggle quote (15 lines)
> + (add-after 'unpack 'scons-propagate-environment
> + (lambda _
> + ;; Modify the SConstruct file to arrange for
> + ;; environment variables to be propagated.
> + (substitute* "SConstruct"
> + (("^env = Environment\\(")
> + "env = Environment(ENV=os.environ, "))))
> + (add-after 'unpack 'create-version-file
> + (lambda _
> + (call-with-output-file "version.json"
> + (lambda (port)
> + (display ,(simple-format #f "{
> + \"version\": \"~A\"
> +}" version) port)))))

These two should explicitly return #t.

OK with this change, thank you!

Ludo’.
Ludovic Courtès wrote 7 years ago
Re: [bug#28198] [PATCH 3/3] services: Add MongoDB.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 28198@debbugs.gnu.org)
87efqj6khm.fsf@gnu.org
Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (6 lines)
> * gnu/services/databases.scm (%default-mongodb-configuration-file,
> %mongodb-accounts, mongodb-service-type): New variables.
> (<mongodb-configuration>): New record type.
> (mongodb-activation, mongodb-shepherd-service): New procedures.
> * gnu/tests/databases.scm (%test-mongodb): New variable.
> * doc/guix.text (Database Services): Add MongoDB documentation.
^

texi :-)

[...]

Toggle quote (14 lines)
> +(define mongodb-service-type
> + (service-type
> + (name 'mongodb)
> + (extensions
> + (list (service-extension shepherd-root-service-type
> + (compose list
> + mongodb-shepherd-service))
> + (service-extension activation-service-type
> + mongodb-activation)
> + (service-extension account-service-type
> + (const %mongodb-accounts))))
> + (default-value
> + (mongodb-configuration))))

Could you add a ‘description’ field? :-)

Like “Run the MongoDB document database server.”

Apart from that it looks great.

Thank you!

Ludo’.
Christopher Baines wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28198-done@debbugs.gnu.org)
20171006212952.20336912@cbaines.net
On Wed, 04 Oct 2017 16:44:21 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (34 lines)
> Christopher Baines <mail@cbaines.net> skribis:
>
> > * gnu/services/databases.scm (%default-mongodb-configuration-file,
> > %mongodb-accounts, mongodb-service-type): New variables.
> > (<mongodb-configuration>): New record type.
> > (mongodb-activation, mongodb-shepherd-service): New procedures.
> > * gnu/tests/databases.scm (%test-mongodb): New variable.
> > * doc/guix.text (Database Services): Add MongoDB documentation.
> ^
>
> texi :-)
>
> [...]
>
> > +(define mongodb-service-type
> > + (service-type
> > + (name 'mongodb)
> > + (extensions
> > + (list (service-extension shepherd-root-service-type
> > + (compose list
> > + mongodb-shepherd-service))
> > + (service-extension activation-service-type
> > + mongodb-activation)
> > + (service-extension account-service-type
> > + (const %mongodb-accounts))))
> > + (default-value
> > + (mongodb-configuration))))
>
> Could you add a ‘description’ field? :-)
>
> Like “Run the MongoDB document database server.”
>
> Apart from that it looks great.

I've added the explicit #t values to the two phases, fixed the texi
typo, and added the description, and now pushed.

Thanks again for reviewing Ludo :)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlnX58BfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XegOg/9FzC9dvIjr+odFzanCIDgwdZydzWYeUvBMBF+1uEb1/4j7MZoQnSadSSG
Ott/njYHBFJLLgUNZc4a7khG7zPN5FT3UfEcv/o92P4foUJe5kN3LdtCtaZa0KJd
6+WkEUPUy+ORn1WOj4w2QFlgd8gEkyZu1kuX1uLYXcfn99bmDGrkUXQTcRWDa599
W/G+NmRxpq4tqY7pTznit78INB6zdlueMKaTZopadWsJcQfEU4wS0EdD0pBRQ+Xn
1t9xkvWVkCXoExleCZQ4hHb9/tUDYcCYjL1x5efOXuOW6H+UCSV5QKPVuR/xDO2w
hspFEWQ1+nbeWeUtGFhXsuwP1sTHuOI8MepcBJ1Bqt2zE7y/rdqFKkbf879gQc1c
xXHK7LYs5UIe07/EdAAJWIeorPpi4hV0zdDC915qvWINwPRBKJwxKcSNLw32N09N
Syy0BsNkOI0XlIdlRI1gRc+XrZn4oZ7ucEnD6NAOjQMKtdS+OS2AD3lyclcSgqBR
9MHkSwX53DyhZSFE+1s36T2EhIjg1mEloiGhmOea5F9X3HXzefEjfXjWzosxm5jn
IljYimLMLHtjhYtp5buYQh0SZqHO7qhPsb0rsqT7EU74OFm0OpHYTBWAj9XrHJFf
NnEVuOAHTWvglrus9Vgt6SVZsT297zl9fsG7HtJoRYMkB6osaYs=
=AYvC
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 28198@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 28198
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help