godarch / darch

A tool for building and booting stateless and immutable images, bare metal.
https://godarch.com/
MIT License
832 stars 32 forks source link

Couple more questions #42

Open phunni opened 4 years ago

phunni commented 4 years ago

Having played with darch for a few days now and (possibly) actually got a working machine up and running on darch - I have a couple more questions:

1) Once a machine is running a darch image, is there any reason to keep the original root partition if I don't intend to ever boot that machine into the original OS again? I installed a basic version of arch simply to initially build my first darch images and then, once I was running a darch image, this server would simply become my build server. I now have a partition that was used for root in the original arch OS that, as far as I can tell, isn't being used for anything. 2) I'm having real trouble with hooks. Specifically the format of the .config files. I looked at the examples given at godarch.com and, while trying to create an fstab.config for an image called build_server I initially tried creating a file that contained something like:

build_server:latest=build_server_fstab

which referred to an existing file in /etc/darch/hooks. This resulted in the following error:

darch: No matching entries
readlink: missing operand
Try 'readlink --help' for more information.
exit status 1

I then tried all the variations I could think of before the = sign - including just the name of the image and the only thing that worked was a simple *:

*=build_server_fstab

which, given I currently only have one image, is fine - but it won't be once I want to create other images for other machines...

Sorry to be a pain and keep asking all these questions, but I'm keen to make progress with darch and I think it could be really useful for me.

Edit: removed a minor typo.

phunni commented 4 years ago

Bump - any ideas/thoughts?

pauldotknopf commented 4 years ago

Sorry for the delay, I'm responding now, give me a sec.

pauldotknopf commented 4 years ago

Once a machine is running a darch image, is there any reason to keep the original root partition if I don't intend to ever boot that machine into the original OS again? I installed a basic version of arch simply to initially build my first darch images and then, once I was running a darch image, this server would simply become my build server. I now have a partition that was used for root in the original arch OS that, as far as I can tell, isn't being used for anything.

You could, but it's dangerous. As long as you always have a good image to boot into, maybe you'll be fine, but I wouldn't risk it. I've actually never needed to boot into mine. I'm just scared.

Maybe this would help with your hooks.

Here is my /etc/darch/hooks/fstab.config:

*=default_fstab

The * matches all images.

My /etc/darch/hooks/default_fstab is a standard fstab.

After making any changes, run darch to update your hooks in your already staged images.

phunni commented 4 years ago

It seems like the fstab.config (and possibly the other hooks) only actually run when there is a default option in there as well. I got it working with a specific example:

image_name:tag_name=image_name_fstab
only when there was also something like: *=default_fstab