unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: guix-devel@gnu.org
Subject: Re: “Towards Guix for DevOps”
Date: Sat, 27 Jul 2019 12:47:30 +0200	[thread overview]
Message-ID: <874l37eou5.fsf@gnu.org> (raw)
In-Reply-To: <871ryvgow6.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 12 Jul 2019 19:10:17 +0200")

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

Ludovic Courtès writes:

> Jakob wrote a lovely post about the ongoing work implementing ‘guix
> deploy’ as part of GSoC:
>
>   https://gnu.org/s/guix/blog/2019/towards-guix-for-devops/
>
> Check it out!

Yes, this is excellent.  I started playing with it using a deploy-vm.sh
script (see attached).  It took me a few iterations to get all bits
right; I mistook the host's signing-key's error message for an ssh
authentication problem, e.g.

This works great so I am already using it now; together with channels it
simplifies my deployments a lot.

I found that I cannot deploy to older machines, running 0.16 or earlier.
Not really a problem but it should at least be documented, I think.

Here's what deploying to a 0.16 machine gives me

--8<---------------cut here---------------start------------->8---
+ guix deploy deploy-vm.scm
substitute: updating substitutes from 'http://guix1.oban.verum.com:8181'... 100.0%
substitute: updating substitutes from 'http://guix3.oban.verum.com:8181'... 100.0%
substitute: updating substitutes from 'http://janneke.lilypond.org:8080'... 100.0%
sending 142 store items (745 MiB) to 'localhost'...
sending 3 store items (0 MiB) to 'localhost'...
Backtrace:
           7 (primitive-load "/gnu/store/rl2fvwwdj9n82yjhc8v1yygy5c0zwnkb-profile/bin/guix")
In guix/ui.scm:
  1659:12  6 (run-guix-command _ . _)
In guix/store.scm:
   623:10  5 (call-with-store _)
In srfi/srfi-1.scm:
    640:9  4 (for-each #<procedure 19c9020 at guix/scripts/deploy.scm:81:16 (machine)> (#<<machine> system: #…>))
In guix/store.scm:
  1803:24  3 (run-with-store #<store-connection 256.99 10e3a80> _ #:guile-for-build _ #:system _ #:target _)
In gnu/machine/ssh.scm:
    339:2  2 (_ _)
In guix/remote.scm:
   122:20  1 (_ _)
    66:17  0 (%remote-eval _ _)

guix/remote.scm:66:17: In procedure %remote-eval:
Throw to key `srfi-34' with args `(#<inferior-object #<condition &action-exception-error [service: user-homes action: start key: match-error args: ("match" "no matching pattern" "#<<user-account> name: \"root\" password: \"\" uid: 0 group: \"root\" supplementary-groups: () comment: \"System administrator\" home-directory: #<procedure home-directory (x)> create-home-directory?: #t shell: \"/gnu/store/qn1ax1fkj16x280m1rv7mcimfmn9l2pf-bash-4.4.23/bin/bash\" system?: #f>")] 716f00>>)'.
+ ssh -i id_rsa -p 10022 root@localhost guix system list-generations
--8<---------------cut here---------------end--------------->8---

After manually reconfiguring the machine to 1.0 it works, but that
already starts to feel clumsy :)

Anyway, very impressive and a big thank you Jakob!

Greetings,
janneke

I've also put this up on https://gitlab/janneke/deploy


[-- Attachment #2: deploy-vm.sh --]
[-- Type: application/x-sh, Size: 900 bytes --]

[-- Attachment #3: bare-bones.scm --]
[-- Type: application/octet-stream, Size: 1395 bytes --]

(define-module (bare-bones)
  #:use-module (ice-9 rdelim)
  #:use-module (gnu)
  #:use-module (gnu services networking)
  #:use-module (gnu services ssh)
  #:export (%bare-bones))

(define %bare-bones
  (operating-system
    (host-name "baar")
    (timezone "Europe/Amsterdam")
    (bootloader (bootloader-configuration
                 (bootloader grub-bootloader)
                 (target "/dev/vda")))
    (file-systems (cons (file-system
                          ;; after reboot: no such device: guix
                          ;; (device (file-system-label "guix"))
                          (device "/dev/vda1")
                          (mount-point "/")
                          (type "ext4"))
                        %base-file-systems))
    (services
     (cons*
      (service dhcp-client-service-type)
      (service openssh-service-type
               (openssh-configuration
                (permit-root-login #t)
                (authorized-keys
                 `(("root" ,(local-file "id_rsa.pub"))))
                (port-number 22)))
      (modify-services %base-services
        (guix-service-type
         config => (guix-configuration
                    (inherit config)
                    (authorized-keys
                     (cons
                      (local-file "/etc/guix/signing-key.pub")
                      %default-authorized-guix-keys)))))))))

%bare-bones

[-- Attachment #4: deploy-vm.scm --]
[-- Type: application/octet-stream, Size: 913 bytes --]

(use-modules (gnu))
(use-modules (bare-bones))
(use-service-modules shepherd)

(define %system
  (operating-system
    (inherit %bare-bones)
    (host-name "deployable")

    (packages (cons* hello %base-packages))

    (services
     (cons* (service (shepherd-service-type
                      'hello
                      (lambda _
                        (shepherd-service
                         (provision '(hello))
                         (start '(lambda _ (display "hello\n")))
                         (stop '(lambda _ (display "goodbye\n"))))))
                     #t)
            (operating-system-user-services %bare-bones)))))

(list (machine
       (system %system)
       (environment managed-host-environment-type)
       (configuration (machine-ssh-configuration
                       (host-name "localhost")
                       (identity "id_rsa")
                       (port 10022)))))

[-- Attachment #5: channels.scm --]
[-- Type: application/octet-stream, Size: 139 bytes --]

(list
 (channel
  (name 'guix)
  (url "https://git.savannah.gnu.org/git/guix.git")
  (commit "53f21642729e4786141c072dd835b04cb85dfe28")))

[-- Attachment #6: Type: text/plain, Size: 152 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

  parent reply	other threads:[~2019-07-27 10:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 17:10 “Towards Guix for DevOps” Ludovic Courtès
2019-07-13  5:29 ` Pierre Neidhardt
2019-07-13 17:11   ` Jakob L. Kreuze
2019-07-13 20:58     ` Pierre Neidhardt
2019-07-16 12:55 ` zimoun
2019-07-16 15:46   ` Jakob L. Kreuze
2019-07-24 18:59     ` Ricardo Wurmus
2019-07-24 19:19       ` Jakob L. Kreuze
2019-07-24 17:11   ` Ludovic Courtès
2019-07-24 18:37     ` zimoun
2019-07-24 19:19     ` Jakob L. Kreuze
2019-07-26  9:10 ` Alex Sassmannshausen
2019-07-26 14:17   ` Jakob L. Kreuze
2019-07-27 10:47 ` Jan Nieuwenhuizen [this message]
2019-07-27 15:00   ` Jakob L. Kreuze
2019-07-27 17:23     ` Jan Nieuwenhuizen

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=874l37eou5.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=guix-devel@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).