[PATCH] services: Add murmur.

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • nee
  • ng0
Owner
unassigned
Submitted by
nee
Severity
normal
N
(address . guix-patches@gnu.org)
750375c6-8bc2-3e63-05d3-fd94635aa88c@cock.li
Hello, this patch adds a murmur service.
Murmur is the biggest implementation of a mumble voice chat server. The
murmur executable is already packaged in the mumble package.

I added most of the available options to the configuration.
I consciously did not include the following settings:
-settings for changing the .ini at runtime through "ZeroC Ice" or "dbus"
-settings for different databases, because the wiki mentions problems
with other databases and strongly recommends using the default sqlite¹.

N
(name . nee)(address . nee@cock.li)(address . 28960@debbugs.gnu.org)
20171024043258.sax6hsorucf4uzno@abyayala
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEqIyK3RKYKNfqwC5S4i+bv+40hYgFAlnuwnoACgkQ4i+bv+40
hYgZ0RAAreaz/k8x9kGwvIp7GlYDN55e9I1Hm0dwliw2wSEy0psC82YnpE8RGZ3R
+yHAwRWa+pg7J4NYgWcaeypXrlzPVYmFm1ISSA+WWWy24bMgLKKqYqPRPTlqgN6m
6cvdTJDMD/J+mlkzQ6yAtotxz+OoUPkN8eK3ZDqKFQMwc/D45IWSwYNTS0pdQd1B
dXOWNMS3rV26OItAKm4QnAkiNveEqgOGqMwqqjc4rCimokTJ59Pxa6wzMlffhMt/
cYhIGOG8TTnY2xHkUvBbcmw1yikhTFqK1CnaXSK1dzSVdrpVnd3aYsCi0TrVfbkB
ffnva/+PIitS5FP+u41wrY0NOiOHRYiKOjpaidHVOkYi4ia3+XfxuF12iBhgfZ3T
d1+DRXuaIqES9uPsj6I3vj4D8ZiLHQOssj/LU9eij78je1aTnKDjcRbQrdoJgDam
aEhaaBXgeBr0Nf5t71T7cZ5r632+cFzYOwBTvfAa1cULOgsY2D6EDuorOva8BKdR
QnniMXfa5L0apJY9FrsZH7eWRDS1toBT7cX6L6JDWExY5IRS9FW21gkb0pBi1/Kj
7uBWzubs006DbNgqlhl3j5/As6VX0cvPCAWWzqvH573FdhYOD8rAKCbd888i67ys
SN9ZXR14/8NdMwVzeUCiLB31xQdO1eszlerJOkapjijlN8x45AI=
=pmYs
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 24 Oct 2017 07:04
(name . nee)(address . nee@cock.li)(address . 28960@debbugs.gnu.org)
873769qgq6.fsf@gnu.org
Hi nee,

nee <nee@cock.li> skribis:

Toggle quote (4 lines)
> Hello, this patch adds a murmur service.
> Murmur is the biggest implementation of a mumble voice chat server. The
> murmur executable is already packaged in the mumble package.

Neat!

Toggle quote (9 lines)
> From 74618e5a39198077327f14362d8d98538f4d39ab Mon Sep 17 00:00:00 2001
> From: nee <nee.git@cock.li>
> Date: Sat, 14 Oct 2017 11:27:50 +0200
> Subject: [PATCH] services: Add murmur.
>
> * gnu/services/telephony.scm: New file.
> * gnu/local.mk: Add it.
> * doc/guix.texi: Document it.

You can write:

* doc/guix.texi (Telephony Services): New node.

Toggle quote (11 lines)
> +@deftp {Data Type} murmur-configuration
> +The service type for the murmur server. An example configuration can look like this:
> +@example
> +(service murmur-service-type
> + (murmur-configuration
> + (welcome-text "Welcome to this mumble server running on GuixSD!")
> + (cert-required #t) ; disallow text password logins
> + (ssl-cert "/etc/letsencrypt/live/mumble.example.com/fullchain.pem")
> + (ssl-key "/etc/letsencrypt/live/mumble.example.com/privkey.pem")))
> +@end example

Please don’t use tabs.

Toggle quote (3 lines)
> +After reconfiguring your system, you have to manually set the
> +SuperUser password with the command that is printed during the activation phase.

That sounds quite unusual. Perhaps you need @code{SuperUser}, if you
literally mean the “SuperUser” account in Mumble?

Toggle quote (4 lines)
> +Then you can use the @code{mumble} client to
> +login as new user, register, and logout.
> +For the next step login with the name "SuperUser" and the SuperUser password

Same here.

Toggle quote (12 lines)
> +(define-record-type* <murmur-configuration> murmur-configuration
> + make-murmur-configuration
> + murmur-configuration?
> + (package murmur-configuration-package ;<package>
> + (default mumble))
> + (user murmur-configuration-user
> + (default "murmur"))
> + (group murmur-configuration-group
> + (default "murmur"))
> + (port murmur-configuration-port
> + (default 64738))

[...]

Toggle quote (5 lines)
> + (allow-html murmur-configuration-allow-html
> + (default #f))
> + (allow-ping murmur-configuration-allow-ping
> + (default #f))

Add a question mark since these are Boolean options. So ‘allow-html?’
and ‘allow-ping?’.

Toggle quote (10 lines)
> +(define (default-murmur-config
> + package user group port welcome-text server-password
> + max-users max-user-bandwidth database-file log-file pid-file
> + autoban-attempts autoban-timeframe autoban-time
> + opus-threshold channel-nesting-limit channelname-regex username-regex
> + text-message-length image-message-length cert-required
> + remember-channel allow-html allow-ping bonjour send-version log-days
> + obfuscate-ips ssl-cert ssl-key ssl-dh-params ssl-ciphers
> + public-registration)

This many positional parameters is not reasonable. :-) Just pass a
<murmur-configuration> directly, and use the accessor procedures.

Toggle quote (11 lines)
> +(define murmur-activation
> + (match-lambda
> + (($ <murmur-configuration>
> + package user group port welcome-text server-password
> + max-users max-user-bandwidth database-file log-file pid-file
> + autoban-attempts autoban-timeframe autoban-time
> + opus-threshold channel-nesting-limit channelname-regex username-regex
> + text-message-length image-message-length cert-required remember-channel
> + allow-html allow-ping bonjour send-version log-days obfuscate-ips
> + ssl-cert ssl-key ssl-dh-params ssl-ciphers public-registration file)

Likewise: use the accessor procedures instead of this.

Toggle quote (19 lines)
> +(define murmur-accounts
> + (match-lambda
> + (($ <murmur-configuration> _ user group)
> + (filter identity
> + (list
> + (and (equal? group "murmur")
> + (user-group
> + (name "murmur")
> + (system? #t)))
> + (and (equal? user "murmur")
> + (user-account
> + (name "murmur")
> + (group group)
> + (system? #t)
> + (comment "Murmur Daemon")
> + (home-directory "/var/empty")
> + (shell (file-append shadow "/sbin/nologin")))))))))


Why not just

(match-lambda
(($ <murmur-configuration> _ user group)
(list (user-group (name group) (system? #t))
(user-account
(name user)
(group group)
(system? #t)
))))

?

Toggle quote (11 lines)
> +(define murmur-shepherd-service
> + (match-lambda
> + (($ <murmur-configuration>
> + package user group port welcome-text server-password
> + max-users max-user-bandwidth database-file log-file pid-file
> + autoban-attempts autoban-timeframe autoban-time
> + opus-threshold channel-nesting-limit channelname-regex username-regex
> + text-message-length image-message-length cert-required remember-channel
> + allow-html allow-ping bonjour send-version log-days obfuscate-ips
> + ssl-cert ssl-key ssl-dh-params ssl-ciphers public-registration file)

Use the accessors instead.

Could you send an updated patch?

Thanks,
Ludo’.’
N
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28960@debbugs.gnu.org)
f1d9f3c9-dd8e-b1ac-f19a-15e683de6194@cock.li
Hello,
thanks to both ludo and ng0 looking at my patch.

24.10.2017 07:04 Ludovic Courtès:
Toggle quote (13 lines)
>> From 74618e5a39198077327f14362d8d98538f4d39ab Mon Sep 17 00:00:00 2001
>> From: nee <nee.git@cock.li>
>> Date: Sat, 14 Oct 2017 11:27:50 +0200
>> Subject: [PATCH] services: Add murmur.
>>
>> * gnu/services/telephony.scm: New file.
>> * gnu/local.mk: Add it.
>> * doc/guix.texi: Document it.
>
> You can write:
>
> * doc/guix.texi (Telephony Services): New node.
>
Okay, I changed this line in the commit message.
Toggle quote (13 lines)
>> +@deftp {Data Type} murmur-configuration
>> +The service type for the murmur server. An example configuration can look like this:
>> +@example
>> +(service murmur-service-type
>> + (murmur-configuration
>> + (welcome-text "Welcome to this mumble server running on GuixSD!")
>> + (cert-required #t) ; disallow text password logins
>> + (ssl-cert "/etc/letsencrypt/live/mumble.example.com/fullchain.pem")
>> + (ssl-key "/etc/letsencrypt/live/mumble.example.com/privkey.pem")))
>> +@end example
>
> Please don’t use tabs.
>
Whoops, I untabified it.

Toggle quote (12 lines)
>> +After reconfiguring your system, you have to manually set the
>> +SuperUser password with the command that is printed during the activation phase.
>
> That sounds quite unusual. Perhaps you need @code{SuperUser}, if you
> literally mean the “SuperUser” account in Mumble?
>
>> +Then you can use the @code{mumble} client to
>> +login as new user, register, and logout.
>> +For the next step login with the name "SuperUser" and the SuperUser password
>
> Same here.
>
I reworded that part a little. It's about the mumble "SuperUser" who can
create channels and do moderator stuff like muting, banning, and
promoting users.

Toggle quote (22 lines)
>> +(define-record-type* <murmur-configuration> murmur-configuration
>> + make-murmur-configuration
>> + murmur-configuration?
>> + (package murmur-configuration-package ;<package>
>> + (default mumble))
>> + (user murmur-configuration-user
>> + (default "murmur"))
>> + (group murmur-configuration-group
>> + (default "murmur"))
>> + (port murmur-configuration-port
>> + (default 64738))
>
> [...]
>
>> + (allow-html murmur-configuration-allow-html
>> + (default #f))
>> + (allow-ping murmur-configuration-allow-ping
>> + (default #f))
>
> Add a question mark since these are Boolean options. So ‘allow-html?’
> and ‘allow-ping?’.
>
Okay, I'm just slightly confused whether the question mark is only used
for predicate procedures or everything that related to booleans.
I think there was discussion on the guile list about this, I'll read up
on it later.

Toggle quote (22 lines)
>> +(define (default-murmur-config
>> + package user group port welcome-text server-password
>> + max-users max-user-bandwidth database-file log-file pid-file
>> + autoban-attempts autoban-timeframe autoban-time
>> + opus-threshold channel-nesting-limit channelname-regex username-regex
>> + text-message-length image-message-length cert-required
>> + remember-channel allow-html allow-ping bonjour send-version log-days
>> + obfuscate-ips ssl-cert ssl-key ssl-dh-params ssl-ciphers
>> + public-registration)
>
> This many positional parameters is not reasonable. :-) Just pass a
> <murmur-configuration> directly, and use the accessor procedures.
>
>> +(define murmur-activation
>> …
>
> Likewise: use the accessor procedures instead of this.
>
>> +(define murmur-shepherd-service
>> …
> Use the accessors instead.
>
Right, that grew way too big. I removed most of the match blocks.
I like having the short names when it comes to stitching together the
actual config though, so I kept that one.
If that's still a no-go I'll make another update with accessors.

If the main problem here is the positional binding, is there a function
to match record fields by name that I could use instead?
It doesn't seem like it would be too complicated to write a macro for
this with the record-accessor procedure from srfi-9.

Toggle quote (33 lines)
>> +(define murmur-accounts
>> + (match-lambda
>> + (($ <murmur-configuration> _ user group)
>> + (filter identity
>> + (list
>> + (and (equal? group "murmur")
>> + (user-group
>> + (name "murmur")
>> + (system? #t)))
>> + (and (equal? user "murmur")
>> + (user-account
>> + (name "murmur")
>> + (group group)
>> + (system? #t)
>> + (comment "Murmur Daemon")
>> + (home-directory "/var/empty")
>> + (shell (file-append shadow "/sbin/nologin")))))))))
>
>
> Why not just
>
> (match-lambda
> (($ <murmur-configuration> _ user group)
> (list (user-group (name group) (system? #t))
> (user-account
> (name user)
> (group group)
> (system? #t)
> …
> ))))
>
> ?
>
Okay I changed it. I had copied this from the fcgiwrap service.

Toggle quote (1 lines)
> Could you send an updated patch?
Here it is :-)

I also noticed a missing equal sign after rememberchannel in the
defaultconfig and added that.
L
L
Ludovic Courtès wrote on 24 Oct 2017 23:34
(name . nee)(address . nee@cock.li)(address . 28960@debbugs.gnu.org)
87wp3kmdr4.fsf@gnu.org
Hi nee,

nee <nee@cock.li> skribis:

Toggle quote (12 lines)
>>> +(define murmur-shepherd-service
>>> …
>> Use the accessors instead.
>>
> Right, that grew way too big. I removed most of the match blocks.
> I like having the short names when it comes to stitching together the
> actual config though, so I kept that one.
> If that's still a no-go I'll make another update with accessors.
>
> If the main problem here is the positional binding, is there a function
> to match record fields by name that I could use instead?

Unfortunately no.

Toggle quote (3 lines)
> It doesn't seem like it would be too complicated to write a macro for
> this with the record-accessor procedure from srfi-9.

Indeed. I figured something like this works:

Toggle snippet (15 lines)
scheme@(guile-user)> (define-syntax match-record
(syntax-rules ()
((_ record type (field fields ...) body ...)
(if (eq? (struct-vtable record) type)
(let ((field ((record-accessor type 'field) record)))
(match-record record type (fields ...) body ...))
(throw 'wrong-type-arg record)))
((_ record type () body ...)
(begin body ...))))
scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>) (home-page) home-page)
$6 = "https://www.gnu.org/software/coreutils/"
scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>) (home-page synopsis) (list synopsis home-page))
$7 = ("Core GNU utilities (file, text, shell)" "https://www.gnu.org/software/coreutils/")

We could use that for now.

Eventually though, we should have something better in (guix records)
that (1) computes indices and report wrong-field-name errors at
expansion time, and (2) accounts for thunked/delayed fields.

WDYT?

If the above macro is good enough, we can add it to (guix records) with
a TODO comment. That would already be better than the other options.

Toggle quote (3 lines)
> I also noticed a missing equal sign after rememberchannel in the
> defaultconfig and added that.

I noticed a couple of obvious mistakes:
Toggle diff (22 lines)
diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm
index 0c30b409f..a305a1be8 100644
--- a/gnu/services/telephony.scm
+++ b/gnu/services/telephony.scm
@@ -240,7 +240,7 @@ Or set public-registration to #f")))))))))
(define (murmur-activation config)
#~(begin
(use-modules (guix build utils))
- (let ((log-dir (dirname #$(murmur-configuration-log-file config)))
+ (let* ((log-dir (dirname #$(murmur-configuration-log-file config)))
(pid-dir (dirname #$(murmur-configuration-pid-file config)))
(db-dir (dirname #$(murmur-configuration-database-file config)))
(user (getpwnam #$(murmur-configuration-user config)))
@@ -283,7 +283,7 @@ Or set public-registration to #f")))))))))
(documentation "Run the murmur mumble-server.")
(requirement '(networking))
(start #~(make-forkexec-constructor
- '(#$(file-append (murmur-configuration-package)
+ '(#$(file-append (murmur-configuration-package config)
"/bin/murmurd")
"-ini"
#$(or (murmur-configuration-file config)
This makes me think that it would be good to have a unit test. Would
you like to try writing one now (see the examples in gnu/tests/*.scm),
or do you prefer to leave it for later?

In the latter case, please test the system to make sure it actually
works (that can be done in a VM.)

Thank you!

Ludo’.
N
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28960@debbugs.gnu.org)
7d7f4e40-c12b-e9a6-b84d-9e6d1fc9fdf1@cock.li
Am 24.10.2017 um 23:34 schrieb Ludovic Courtès:
Toggle quote (18 lines)
> Indeed. I figured something like this works:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (define-syntax match-record
> (syntax-rules ()
> ((_ record type (field fields ...) body ...)
> (if (eq? (struct-vtable record) type)
> (let ((field ((record-accessor type 'field) record)))
> (match-record record type (fields ...) body ...))
> (throw 'wrong-type-arg record)))
> ((_ record type () body ...)
> (begin body ...))))
> scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>) (home-page) home-page)
> $6 = "https://www.gnu.org/software/coreutils/"
> scheme@(guile-user)> (match-record coreutils (@@ (guix packages) <package>) (home-page synopsis) (list synopsis home-page))
> $7 = ("Core GNU utilities (file, text, shell)" "https://www.gnu.org/software/coreutils/")
> --8<---------------cut here---------------end--------------->8---

Great!

Toggle quote (9 lines)
>
> We could use that for now.
>
> Eventually though, we should have something better in (guix records)
> that (1) computes indices and report wrong-field-name errors at
> expansion time, and (2) accounts for thunked/delayed fields.
>
> WDYT?

I didn't even know guix records had those features :)

Toggle quote (5 lines)
>
> If the above macro is good enough, we can add it to (guix records) with
> a TODO comment. That would already be better than the other options.
>

I added it for now. Personally I don't like having functions with big
TODOs like this. What would be the solution for thunked delayed fields?
Force them as they are bound in the let?


Toggle quote (20 lines)
>> I also noticed a missing equal sign after rememberchannel in the
>> defaultconfig and added that.
>
> I noticed a couple of obvious mistakes:
>
>
>
> diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm
> index 0c30b409f..a305a1be8 100644
> --- a/gnu/services/telephony.scm
> +++ b/gnu/services/telephony.scm
> @@ -240,7 +240,7 @@ Or set public-registration to #f")))))))))
> (define (murmur-activation config)
> #~(begin
> (use-modules (guix build utils))
> - (let ((log-dir (dirname #$(murmur-configuration-log-file config)))
> + (let* ((log-dir (dirname #$(murmur-configuration-log-file config)))
> (pid-dir (dirname #$(murmur-configuration-pid-file config)))
> (db-dir (dirname #$(murmur-configuration-database-file config)))
> (user (getpwnam #$(murmur-configuration-user config)))
I think there was no mistake here the init-dir function took the user as
argument, but I changed it into the let* form and removed the argument now.

Toggle quote (10 lines)
> @@ -283,7 +283,7 @@ Or set public-registration to #f")))))))))
> (documentation "Run the murmur mumble-server.")
> (requirement '(networking))
> (start #~(make-forkexec-constructor
> - '(#$(file-append (murmur-configuration-package)
> + '(#$(file-append (murmur-configuration-package config)
> "/bin/murmurd")
> "-ini"
> #$(or (murmur-configuration-file config)
>
Ouch, so much about me thinking that I could just make a quick change.

Toggle quote (4 lines)
>
> This makes me think that it would be good to have a unit test. Would
> you like to try writing one now (see the examples in gnu/tests/*.scm),
> or do you prefer to leave it for later?
I would like to write some tests, but right now I need to setup my guix
development environment on a different computer first. On my current
setup I have 15 gigabytes of free hard drive space and when I run `make
check-system` it fails with some 'no space left on device' message.

Toggle quote (3 lines)
>
> In the latter case, please test the system to make sure it actually
> works (that can be done in a VM.)
For this patch:
I ran make and got no warnings.
I deployed it on my server and connected with mumble from my computer
and it worked.
From 07c47b5acc22589d466b5008ba42a191bbc33c11 Mon Sep 17 00:00:00 2001
From: nee <nee.git@cock.li>
Date: Wed, 25 Oct 2017 20:44:54 +0200
Subject: [PATCH 1/2] guix: records: Add match-record.

* guix/records.scm: New syntax-rule.
---
guix/records.scm | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

Toggle diff (36 lines)
diff --git a/guix/records.scm b/guix/records.scm
index 7de5fccef..1f00e1660 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -26,7 +26,8 @@
#:export (define-record-type*
alist->record
object->fields
- recutils->alist))
+ recutils->alist
+ match-record))
;;; Commentary:
;;;
@@ -375,4 +376,19 @@ pairs. Stop upon an empty line (after consuming it) or EOF."
(else
(error "unmatched line" line))))))))
+(define-syntax match-record
+ (syntax-rules ()
+ "Bind each FIELD of a RECORD of the given TYPE to it's FIELD name.
+The current implementation does not support thunked and delayed fields."
+ ((_ record type (field fields ...) body ...)
+ (if (eq? (struct-vtable record) type)
+ ;; TODO compute indices and report wrong-field-name errors at
+ ;; expansion time
+ ;; TODO support thunked and delayed fields
+ (let ((field ((record-accessor type 'field) record)))
+ (match-record record type (fields ...) body ...))
+ (throw 'wrong-type-arg record)))
+ ((_ record type () body ...)
+ (begin body ...))))
+
;;; records.scm ends here
--
2.14.1
L
L
Ludovic Courtès wrote on 31 Oct 2017 01:02
(name . nee)(address . nee@cock.li)(address . 28960@debbugs.gnu.org)
87k1zcyykh.fsf@gnu.org
Heya!

nee <nee@cock.li> skribis:

Toggle quote (2 lines)
> Am 24.10.2017 um 23:34 schrieb Ludovic Courtès:

[...]

Toggle quote (8 lines)
>> If the above macro is good enough, we can add it to (guix records) with
>> a TODO comment. That would already be better than the other options.
>>
>
> I added it for now. Personally I don't like having functions with big
> TODOs like this. What would be the solution for thunked delayed fields?
> Force them as they are bound in the let?

The solution would be to do what the accessors do, which is to
transparently force the promise or call the thunk. Well, for later!

Toggle quote (8 lines)
>> This makes me think that it would be good to have a unit test. Would
>> you like to try writing one now (see the examples in gnu/tests/*.scm),
>> or do you prefer to leave it for later?
> I would like to write some tests, but right now I need to setup my guix
> development environment on a different computer first. On my current
> setup I have 15 gigabytes of free hard drive space and when I run `make
> check-system` it fails with some 'no space left on device' message.

You should probably just run the test you want, as in:

make check-system TESTS=basic

This is much more reasonable in terms of disk space usage. See

I’ll take another look soonish and apply the patches if everything’s
alright!

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 5 Nov 2017 11:42
(name . nee)(address . nee@cock.li)(address . 28960-done@debbugs.gnu.org)
87zi81ropw.fsf@gnu.org
Hi nee,

nee <nee@cock.li> skribis:

Toggle quote (9 lines)
> From 2836d82378ccd9ac4fd3678230d0daa2c5f1601d Mon Sep 17 00:00:00 2001
> From: nee <nee.git@cock.li>
> Date: Sat, 14 Oct 2017 11:27:50 +0200
> Subject: [PATCH 2/2] services: Add murmur.
>
> * gnu/services/telephony.scm: New file.
> * gnu/local.mk: Add it.
> * doc/guix.texi (Telephony Services): New node.

Sorry for the delay, I’ve been MIA. I’ve applied both patches with the
attached cosmetic changes to the second one, mostly so that the manual
would be correctly typeset and so that “guix system search voip” turns
up the Murmur service. I hope that’s fine with you.

Thank you!

Ludo’.
Attachment: file
Closed
?