unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: iyzsong@member.fsf.org (宋文武)
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] services: Add opensmtpd-service.
Date: Thu, 24 Nov 2016 22:10:25 +0800	[thread overview]
Message-ID: <87r3616ka6.fsf@member.fsf.org> (raw)
In-Reply-To: <8760nd4yxw.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 23 Nov 2016 23:24:27 +0100")

ludo@gnu.org (Ludovic Courtès) writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> * gnu/services/mail.scm (<opensmtpd-configuration>): New record type.
>> (%default-opensmtpd-config-file, %opensmtpd-accounts): New variables.
>> (opensmtpd-shepherd-service, opensmtpd-activation): New procedures.
>> (opensmtpd-service-type): New variable.
>> (opensmtpd-service): New procedure.
>> * doc/guix.texi (Mail Services): Document it.
>
> Nice!
>
>> --- a/doc/guix.texi
>> +++ b/doc/guix.texi
>> @@ -9996,16 +9996,9 @@ For MariaDB, the root password is empty.
>>  @cindex mail
>>  @cindex email
>>  The @code{(gnu services mail)} module provides Guix service definitions
>> -for mail services.  Currently the only implemented service is Dovecot,
>> -an IMAP, POP3, and LMTP server.
>> +for following mail services:
>
> I think we shouldn’t put a colon just before an @subsubheading.  How
> about something like this instead:
>
>   The @code{(gnu services mail)} module provides Guix service
>   definitions for email services: IMAP, POP3, and LMTP servers, as well
>   as mail transport agents (MTAs).  Lots of acronyms!  These services
>   are detailed in the subsections below.
>

Sure!

>> +@subsubheading OpenSMTPD Service
>> +
>> +@deffn {Scheme Procedure} opensmtpd-service [#:config (opensmtpd-configuration)]
>> +Return a service that runs the @command{smtpd} daemon of OpenSMTPD
>> +package, an implementation of SMTP server as defined by RFC 5321.
>
> s/OpenSMTP package/@uref{https://www.opensmtpd.org, OpenSMTPD}/
>
> However, as discussed elsewhere, I prefer that we document
> ‘opensmtpd-service-type’ and not provide an ‘opensmtpd-service’
> procedure at all.

Ah, OK, I was unaware of this.

>> +(define opensmtpd-activation
>> +  (match-lambda
>> +    (($ <opensmtpd-configuration> package config-file)
>> +     (let ((smtpd (file-append package "/sbin/smtpd")))
>> +       #~(begin
>> +           ;; Create the mbox directory.
>> +           (mkdir-p "/var/mail")
>> +           ;; Check the configuration file for validity.
>> +           (system* #$smtpd "-n" "-f" #$config-file))))))
>
> I think the configuration check belongs in the ‘start’ function of the
> service rather than here.

Right…  I find it always reports ‘lo’ is not a valid interface here.

(Now I think it’s not necessary to do an addition check, since it will
fail to start anyway.)

> Otherwise looks fine.
>
> Could you send an updated patch?

Sure.


> Of course, bonus point if you can get a system test.  :-)

Will look into it later :-)

Also, I find that my slow box is unable start this opensmtpd service
during a fresh boot.  ‘smtpd’ has a timeout of 10s hardcoded, I patched
that to 60s to make it fully start.  But it turns out that
‘read-pid-file’ of shepherd has a timeout of 5s, so I guess that’s why
the service is marked as stop when it actually running…



Thanks for the review!

  reply	other threads:[~2016-11-24 14:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-19  7:29 [PATCH] services: Add opensmtpd-service 宋文武
2016-11-23 22:24 ` Ludovic Courtès
2016-11-24 14:10   ` 宋文武 [this message]
2016-11-26 18:33     ` Ludovic Courtès
2016-11-27  2:22       ` 宋文武

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3616ka6.fsf@member.fsf.org \
    --to=iyzsong@member.fsf.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).