unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <alex@infiniteadaptability.org>
To: "74389@debbugs.gnu.org" <74389@debbugs.gnu.org>
Subject: [bug#74389] [PATCH] services: add cloud-init service
Date: Fri, 22 Nov 2024 19:20:13 +0000	[thread overview]
Message-ID: <bATnGQtQhBzofETx9zjy9A8gqJwfjZAFRLjh4x1zhKmNFUjDQLqzBuEcja-YyB7bkl3esUJDMuGwmRS16QTCGNhXVLueI4BKNKHz-qU_Vmg=@infiniteadaptability.org> (raw)
In-Reply-To: <c907e459d6898df885e3aac67c8446a1c15d62b2.1731824739.git.alex@infiniteadaptability.org>

Ricardo,

This patch is just a MVP for implementing a cloud-init service. The goal primarily was to get the networking, disk and filesystem mounts, and ssh authentication working properly.

From a high level this patch implements a cloud-init-service which uses cloud-init functionality to gather information from it's run-time environment and then run cloud-init modules in order to properly configure the vm. It provides a configuration interface for choosing which modules to run as well as a mechanism to add extra configuration files.

I took a few major shortcuts in order to get a working image.

The first is that instead of writing guix specific functionality for cloud-init modules, I decided to attempt to use the ubuntu (which I believe is the default) tools. This is why the cloud-utils package as well as the network-manager-service-type are included in the vm image template I created as part of this patch.

The second shortcut is that I didn't see a good way to guix-ify the cloud-init service definitions/runtime environment (i.e. I used the /etc/cloud directory to handle most of the configuration files). I'd prefer if configuration lives in the store, but the configuration files and the gathered data live in locations which I didn't see a way to overwrite easily. I'm sure this exists, but would require more digging into the cloud-init source code and/or patches that would need to be pushed upstream.

The final shortcut is the actual running of the cloud-init-service. I didn't see a good way to *wait* for a process to complete, i.e. to block other services until the current service completes. It looks to me that running a long-running one-shot service (each stage of cloud-init typically takes a few seconds to run) doesn't block any service which requires it's provisions. Maybe there's some shepherd nuances that I'm not aware of. I ended up creating a computed file which produces a shell script which runs each cloud-init stage in sequence as a workaround to a more robust solution.

I added some extra comments with instructions on how to add extra cloud-init configuration files. This is required for cloud-init to run properly on DigitalOcean (the order of the data sources needs to be changed from the default). It might be necessary for other p

I've tested this on digital ocean and gotten it work properly (and then used guix deploy to update the configuration of the image). 

NOTE: there are some comments in the template file that would need to be uncommented to build the exact image I used.

Using this patch it should be easy to create an image for testing using:

./pre-inst-env guix system image -t qcow2 gnu/system/examples/cloud-init-image.tmpl

I would appreciate further testers and any suggestions for improvement.

Thanks!

Alex




      parent reply	other threads:[~2024-11-23  1:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17  6:26 [bug#74389] [PATCH] services: add cloud-init service Alexander Joss
2024-11-21 18:25 ` Ricardo Wurmus
2024-11-22 19:20 ` Alex [this message]

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='bATnGQtQhBzofETx9zjy9A8gqJwfjZAFRLjh4x1zhKmNFUjDQLqzBuEcja-YyB7bkl3esUJDMuGwmRS16QTCGNhXVLueI4BKNKHz-qU_Vmg=@infiniteadaptability.org' \
    --to=alex@infiniteadaptability.org \
    --cc=74389@debbugs.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).