cua icon indicating copy to clipboard operation
cua copied to clipboard

Document how to publish a lume VM image to a custom GHCR registry

Open f-trycua opened this issue 9 months ago • 12 comments

Document the process on how to publish a lume VM image to a custom GHCR registry

f-trycua avatar Feb 08 '25 11:02 f-trycua

This would be amazing! Have you folks considered something like Dockerfile but for Lume images?

pepicrft avatar Feb 09 '25 11:02 pepicrft

We’ve run some initial tests and have an internal prototype already. The concept is very feasible with the current setup, but there are a few challenges to address:

  • Layering: VM images (disk.img) are currently chunked (default size of 500MB) during push on a registry. Due to the nature of .img files, this causes more cache misses than hits when pushing layers after the VM has been used.
  • macOS VM Limitations: macOS VMs cannot leverage Linux’s cgroup and namespace process isolation mechanisms, which limits process isolation options /cc @changhoon-sung (issue #10)
  • Ephemeral vs. Persistent Storage: We need to decide how to handle storage since containers are typically ephemeral. The Dockur-like Dockerfile approach, where VM storage is mounted from a directory, seems reasonable to me. However, we’ll need to allow for more flexible storage locations for this to work (see issue #14)

Open to feedback on all points!

f-trycua avatar Feb 09 '25 14:02 f-trycua

Layering: VM images (disk.img) are currently chunked (default size of 500MB) during push on a registry. Due to the nature of .img files, this causes more cache misses than hits when pushing layers after the VM has been used.

I'm not entirely familiar works with Docker, but I remember reading somewhere that they use OverlayFS, which AFAIK is not available in Linux. What do you have in mind? You might be able to draw some inspiration from geranos

macOS VM Limitations: macOS VMs cannot leverage Linux’s cgroup and namespace process isolation mechanisms, which limits process isolation options /cc @changhoon-sung (issue https://github.com/trycua/lume/issues/10)

Sorry for the dumb question, but how does isolation relate to the idea of using Dockerfiles?

pepicrft avatar Feb 09 '25 16:02 pepicrft

It would be great if lume could have a packer builder approach for building the images. packer is a great tool for building VM images. tart have a builder as well here: https://developer.hashicorp.com/packer/integrations/cirruslabs/tart/latest/components/builder/tart

PrashantRaj18198 avatar Mar 04 '25 06:03 PrashantRaj18198

It would be great if lume could have a packer builder approach for building the images. packer is a great tool for building VM images. tart have a builder as well here: https://developer.hashicorp.com/packer/integrations/cirruslabs/tart/latest/components/builder/tart

Why not using Packer instead? Where do you think a Lume-maintaned solution could bring value?

pepicrft avatar Mar 04 '25 11:03 pepicrft

Sorry for the confusion. I'm talking about using packer, it's just that a custom packer builder needs to be created for lume so that packer can manage the image build process for it.

Ref: https://github.com/cirruslabs/packer-plugin-tart

PrashantRaj18198 avatar Mar 05 '25 03:03 PrashantRaj18198

Yeah, I think that makes sense. What do you think @f-trycua? We can start with a documentation, and leave some pointers for anyone interested to contribute the improvement.

pepicrft avatar Mar 05 '25 15:03 pepicrft

Btw we are looking at using lume internally and might like to contribute back with this packer plugin. The plugin would likely be a different repo itself, do you have any guidelines for this case? I’ll leave updates here as I have them.

PrashantRaj18198 avatar Mar 05 '25 15:03 PrashantRaj18198

Love the idea @PrashantRaj18198 @pepicrft. I guess we'll have to start from the packer plugin scaffolding here to generate such repo? https://github.com/hashicorp/packer-plugin-scaffolding

@PrashantRaj18198 If you're not on our Discord yet, happy to set up a channel there to discuss: https://discord.com/invite/mVnXXpdE85

f-trycua avatar Mar 05 '25 15:03 f-trycua

Love the idea @PrashantRaj18198 @pepicrft. I guess we'll have to start from the packer plugin scaffolding here to generate such repo? https://github.com/hashicorp/packer-plugin-scaffolding

Yup that’s correct 👍

@PrashantRaj18198 If you're not on our Discord yet, happy to set up a channel there to discuss: https://discord.com/invite/mVnXXpdE85

👌 Joined the discord. My name there is same as the github username here.

PrashantRaj18198 avatar Mar 05 '25 15:03 PrashantRaj18198

@all-contributors please add @PrashantRaj18198 for code.

f-trycua avatar Mar 28 '25 18:03 f-trycua

@f-trycua

I've put up a pull request to add @PrashantRaj18198! :tada:

allcontributors[bot] avatar Mar 28 '25 18:03 allcontributors[bot]