all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* not a patch.. yet. git-daemon-service
@ 2016-06-17 23:10 ng0
  2016-06-20  8:26 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: ng0 @ 2016-06-17 23:10 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 5583 bytes --]

I've been working on understanding and applying to my first shepherd service.
There are maybe syntax errors, I did not look at it yet this way nor did
I run it.
I have some general questions which I will write into the code, not code
related questions. I will clean up, check up and fix and then ask about
the code.

Well coming back to it, I only have one question, but with this I can
give you a view on what I intend to do (and which I will fix).

> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> ;;; GNU Guix is free software; you can redistribute it and/or modify it
> ;;; under the terms of the GNU General Public License as published by
> ;;; the Free Software Foundation; either version 3 of the License, or (at
> ;;; your option) any later version.
> ;;;
> ;;; GNU Guix is distributed in the hope that it will be useful, but
> ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;;; GNU General Public License for more details.
> ;;;
> ;;; You should have received a copy of the GNU General Public License
> ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

> (define-module (gnu services version-control)
>   #:use-module (gnu services)
>   #:use-module (gnu services base)
>   #:use-module (gnu services shepherd)
>   #:use-module (gnu system shadow)
>   #:use-module (gnu packages version-control)
>   #:use-module (gnu packages admin)
>   #:use-module (guix records)
>   #:use-module (guix gexp)
>   #:export (git-daemon-service
>             git-daemon-service-type))

> ;;; Commentary:
> ;;;
> ;;; Version Control related services.
> ;;;
> ;;; Code:

> \f
> ;;;
> ;;; Git.
> ;;;

> (define-record-type* <git-daemon-configuration>
>   git-daemon-configuration make-git-daemon-configuration
>   git-daemon-configuration?
>   (git-daemon     git-daemon-configuration-git
>                   (default git))
>   (base-path      git-daemon-configuration-base-path) ; string
>   (port           git-daemon-configuration-port) ; string (default: 9418)
>   (extra-settings git-daemon-configuration-extra-settings))
>   ;;(export-all              git-daemon-configuration-export-all?) ;; those are switches I need to add differently
>   ;;(informative-errors      git-daemon-configuration-informative-errors?) ;; same.
>   ;;(verbose                 git-daemon-configuration-verbose?)) ;; same.

There are many settings. The ones I think are the very basic ones which can
be used for a start for this service are:
port, base-path, a forced --syslog --informative-errors and finally the option
to add whatever you want to add when you read the man page.
There are more we can add later, but those are the very basic in my opinion.
What's your opinion?

> ;; todo?: create repo folders and include them in the system generations?
> (define %git-daemon-activation
>   ;; Activation gexp.
>   #~(begin
>       (use-modules (guix build utils))
>       (mkdir-p "/var/run/git-daemon")))

> (define git-daemon-shepherd-service
>   (match-lambda
>    (($ <git-daemon-configuration> git-daemon base-path port extra-settings)
>     (let ((conf (string-append "
> --base-path="base-path"
> --port="(number->string port)"
> " extra-settings))))
>     (list (shepherd-service
>            (provision '(git-daemon))
>            (requirement '(networking loopback syslog)) ;; syslog?
>            (documentation "Run the git daemon server for git repositories.")
>            (start #~(make-forkexec-constructor
>                      (list (string-append #$git-daemon "/bin/git")
>                            "daemon" "--syslog" "--informative-errors"
>                            #$conf)))
>            (stop #~(make-kill-destructor)))))))

> (define %git-daemon-accounts
>   ;; User account and groups for git-daemon.
>   (list (user-group (name "git") (system? #t))
>         (user-account
>          (name "git")
>          (group "git")
>          (system? #t)
>          (comment "git daemon user")
>          (home-directory "/var/empty")
>          (shell #~(string-append #$shadow "/sbin/nologin")))))

> (define git-daemon-service-type
>   (service-type (name 'git-daemon)
>                 (extensions
>                  (list (service-extension shepherd-root-service-type
>                                           git-daemon-shepherd-service)
>                        (service-extension activation-service-type
>                                           (const %git-daemon-activation))
>                        ;; Add git-daemon to the global profile.
>                        (service-extension profile-service-type list)))))

> (define* (git-daemon-service #:key (git git)
>                              (extra-settings "")
>                              base-path
>                              (port 9418))
>   "Return a service that runs @url{https://git-scm.org,git} as a daemon,
> etc...

> The daemon will listen on the port specified in @var{port}.

> In addition, @var{extra-settings} specifies a string to append to the
> daemon parameters."
>   (service git-daemon-service-type
>            (git-daemon-configuration
>             (git git) (base-path base-path)
>             (port port) (extra-settings extra-settings))))

--
♥Ⓐ ng0
For non-prism friendly talk find me on
psyced.org / loupsycedyglgamf.onion

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: not a patch.. yet. git-daemon-service
  2016-06-17 23:10 not a patch.. yet. git-daemon-service ng0
@ 2016-06-20  8:26 ` Ludovic Courtès
  2016-07-04  7:37   ` ng0
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2016-06-20  8:26 UTC (permalink / raw)
  To: guix-devel

ng0 <ng0@we.make.ritual.n0.is> skribis:

>> (define-record-type* <git-daemon-configuration>
>>   git-daemon-configuration make-git-daemon-configuration
>>   git-daemon-configuration?
>>   (git-daemon     git-daemon-configuration-git
>>                   (default git))
>>   (base-path      git-daemon-configuration-base-path) ; string
>>   (port           git-daemon-configuration-port) ; string (default: 9418)
>>   (extra-settings git-daemon-configuration-extra-settings))
>>   ;;(export-all              git-daemon-configuration-export-all?) ;; those are switches I need to add differently
>>   ;;(informative-errors      git-daemon-configuration-informative-errors?) ;; same.
>>   ;;(verbose                 git-daemon-configuration-verbose?)) ;; same.
>
> There are many settings. The ones I think are the very basic ones which can
> be used for a start for this service are:
> port, base-path, a forced --syslog --informative-errors and finally the option
> to add whatever you want to add when you read the man page.
> There are more we can add later, but those are the very basic in my opinion.
> What's your opinion?

I think it’s OK to restrict yourself to the most common options at
first.  We can always add more options eventually.

Thanks for working on it!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: not a patch.. yet. git-daemon-service
  2016-06-20  8:26 ` Ludovic Courtès
@ 2016-07-04  7:37   ` ng0
  2016-07-04  8:31     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: ng0 @ 2016-07-04  7:37 UTC (permalink / raw)
  To: guix-devel

Ludovic Courtès writes:

> ng0 <ng0@we.make.ritual.n0.is> skribis:
>
>>> (define-record-type* <git-daemon-configuration>
>>>   git-daemon-configuration make-git-daemon-configuration
>>>   git-daemon-configuration?
>>>   (git-daemon     git-daemon-configuration-git
>>>                   (default git))
>>>   (base-path      git-daemon-configuration-base-path) ; string
>>>   (port           git-daemon-configuration-port) ; string (default: 9418)
>>>   (extra-settings git-daemon-configuration-extra-settings))
>>>   ;;(export-all              git-daemon-configuration-export-all?) ;; those are switches I need to add differently
>>>   ;;(informative-errors      git-daemon-configuration-informative-errors?) ;; same.
>>>   ;;(verbose                 git-daemon-configuration-verbose?)) ;; same.
>>
>> There are many settings. The ones I think are the very basic ones which can
>> be used for a start for this service are:
>> port, base-path, a forced --syslog --informative-errors and finally the option
>> to add whatever you want to add when you read the man page.
>> There are more we can add later, but those are the very basic in my opinion.
>> What's your opinion?
>
> I think it’s OK to restrict yourself to the most common options at
> first.  We can always add more options eventually.
>
> Thanks for working on it!
>
> Ludo’.

How would I test run this service?
Is it documented in the manual somwhere?

-- 
♥Ⓐ  ng0
For non-prism friendly talk find me on
psyced.org / loupsycedyglgamf.onion

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: not a patch.. yet. git-daemon-service
  2016-07-04  7:37   ` ng0
@ 2016-07-04  8:31     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2016-07-04  8:31 UTC (permalink / raw)
  To: ng0; +Cc: guix-devel

ng0 <ng0@we.make.ritual.n0.is> skribis:

> Ludovic Courtès writes:
>
>> ng0 <ng0@we.make.ritual.n0.is> skribis:
>>
>>>> (define-record-type* <git-daemon-configuration>
>>>>   git-daemon-configuration make-git-daemon-configuration
>>>>   git-daemon-configuration?
>>>>   (git-daemon     git-daemon-configuration-git
>>>>                   (default git))
>>>>   (base-path      git-daemon-configuration-base-path) ; string
>>>>   (port           git-daemon-configuration-port) ; string (default: 9418)
>>>>   (extra-settings git-daemon-configuration-extra-settings))
>>>>   ;;(export-all              git-daemon-configuration-export-all?) ;; those are switches I need to add differently
>>>>   ;;(informative-errors      git-daemon-configuration-informative-errors?) ;; same.
>>>>   ;;(verbose                 git-daemon-configuration-verbose?)) ;; same.
>>>
>>> There are many settings. The ones I think are the very basic ones which can
>>> be used for a start for this service are:
>>> port, base-path, a forced --syslog --informative-errors and finally the option
>>> to add whatever you want to add when you read the man page.
>>> There are more we can add later, but those are the very basic in my opinion.
>>> What's your opinion?
>>
>> I think it’s OK to restrict yourself to the most common options at
>> first.  We can always add more options eventually.
>>
>> Thanks for working on it!
>>
>> Ludo’.
>
> How would I test run this service?

You can test it manually by creating an OS config that uses it and
instantiating it in a VM, with ‘guix system vm’.  In the VM you can
check whether git-daemon is running and working as expected.

Writing an automated test would be very valuable, but it’s a bit more
work.  The (gnu tests base) module has examples, and
<https://savannah.gnu.org/forum/forum.php?forum_id=8605> gives an
overview.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-04  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17 23:10 not a patch.. yet. git-daemon-service ng0
2016-06-20  8:26 ` Ludovic Courtès
2016-07-04  7:37   ` ng0
2016-07-04  8:31     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.