Support cloud-init bootstrapping via API #3

Open
opened 2021-09-18 07:31:46 +00:00 by j3s · 1 comment
Owner

Idk if this is already possible, just trying to map out some things that'd be awesome to have via the API.

As mentioned in the #91, we need abra to bootstrap the VM.

A handy way to do this is the cloud-init thing that Hetzner and co. are doing.

It is a YAML payload you send in an API request on VM creation and it is run on the VM creation side.

So you can apt install docker and so on in this YAML file and the machine will run those commands automatically after booting up.

Hetzner handle it like so, a key in your payload which is the YAML file.

"user_data": "#cloud-config\nruncmd:\n- [touch, /root/cloud-init-worked]\n"

More on the Hetzner docs.

Idk if this is already possible, just trying to map out some things that'd be awesome to have via the API. As mentioned in the [#91](https://todo.cyberia.club/~cyberia/services/91https://todo.cyberia.club/~cyberia/services/91), we need `abra` to bootstrap the VM. A handy way to do this is the cloud-init thing that Hetzner and co. are doing. It is a YAML payload you send in an API request on VM creation and it is run on the VM creation side. So you can `apt install docker` and so on in this YAML file and the machine will run those commands automatically after booting up. Hetzner handle it like so, a key in your payload which is the YAML file. ```json "user_data": "#cloud-config\nruncmd:\n- [touch, /root/cloud-init-worked]\n" ``` More on the [Hetzner docs](https://docs.hetzner.cloud/#servers-create-a-server).
Author
Owner

~threewordchanta month ago* · edit
I think Hetzner can probably support providing a whole cloud-init file because they build all their own images, with some snazzy method for defining a root password or SSH key on set-up.

Capsul already uses cloud-init to do that key insertion, install default packages, and set the username.

So, maybe a way of merging the user-supplied file with the standard one? Or templateing some variables (for e.g. additional packages) into the file, and making those as separate options in the API (and the UI, maybe)?

~foresta month ago · edit
Yes, absolutely, we should support user data

~threewordchanta month ago* · edit I think Hetzner can probably support providing a whole cloud-init file because they build all their own images, with some snazzy method for defining a root password or SSH key on set-up. Capsul already uses cloud-init to do that key insertion, install default packages, and set the username. So, maybe a way of merging the user-supplied file with the standard one? Or templateing some variables (for e.g. additional packages) into the file, and making those as separate options in the API (and the UI, maybe)? ~foresta month ago · edit Yes, absolutely, we should support user data
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cyberia/capsul-flask#3
No description provided.