Subject: Re: [bug#37083] [PATCH 0/1] (Help needed!) machine: Implement 'digital-ocean-environment-type'.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 23 Sep 2019 10:24:07 +0200

Hi Jakob!

[email-masked] (Jakob L. Kreuze) skribis:

> Ludovic Courtès <[email-masked]> writes:
>
>> Presumably there’s more than one service of type
>> ‘shepherd-root-service-type’ in the ‘services’ field? Let me know if I
>> can help.
>
> Sorry about how long this has been taking, I've been plucking away at it
> on the weekends, but I've reached the point where I have to admit that
> I'm stuck and I really need help if I'm ever going to finish this.
>
> I have this procedure to create a static networking service for the
> Digital Ocean droplet based on an API response:
>
> (define (add-static-networking target network)
>   "Return an <operating-system> based on TARGET with a static networking
> configuration for the public IPv4 network described by the alist NETWORK."
>   (operating-system
>     (inherit (machine-operating-system target))
>     (services (cons (static-networking-service "eth0"
>                         (assoc-ref network "ip_address")
>                         #:netmask (assoc-ref network "netmask")
>                         #:gateway (assoc-ref network "gateway")
>                         #:name-servers '("84.200.69.80" "84.200.70.40"))
>                     (operating-system-services
>                      (machine-operating-system target))))))

Oooh, got it: right above, you should call
‘operating-system-user-services’, not ‘operating-system-services’.

The latter includes “essential” services like ‘etc’ and ‘shepherd-root’,
which is why we’d end up with two copies of each of these.

Admittedly quite error-prone!

Let me know if there are other stumbling blocks.  I look forward to
seeing Digital Ocean support in ‘guix deploy’!

Thanks,
Ludo’.