Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide automatic way for building images #38

Open
bastelfreak opened this issue Jan 22, 2016 · 16 comments
Open

provide automatic way for building images #38

bastelfreak opened this issue Jan 22, 2016 · 16 comments
Labels

Comments

@bastelfreak
Copy link
Member

can we please do something awesome here? building images with FPM? with nspawn? @killermoehre @Bluewind your opinions?

@bastelfreak
Copy link
Member Author

what about some systemd-nspawn magic + debootstrap/yum?

@bastelfreak
Copy link
Member Author

the normal approach would be to setup a virtual machine, install a minimal OS by hand, boot it into the rescue, tar that stuff together, create gpg sigs and you are done. This could somehow be automated with virt-install / cloudinit.

@bastelfreak
Copy link
Member Author

also it needs to be discussed if it is necessary to automate the complete build process or only a update/rebuild process.

@bastelfreak
Copy link
Member Author

Does anybody likes pain and wants tests in serverspec for images?

@bastelfreak
Copy link
Member Author

Maybe we want to take a look at the Hashicorp Toolstack, they recently created Packer

@killermoehre
Copy link
Contributor

nspawn is a rather bad idea if you want to build real (virtual) machines which will have there own (virtual) hardware.
If you want to pre-populate a directory with packages you don't need nspawn neither. With (pac|deboot)strap and yum/dnf you can install where you want and place your config file in it. Just need to package it afterwards and sign it.

@bastelfreak
Copy link
Member Author

@killermoehre recommended https://de.opensuse.org/Portal:KIWI on the IRC

@ghost
Copy link

ghost commented May 27, 2016

Perhaps it would be a good start to document first what an image for installimage actually needs to contain and how the process of building an image without using the distribution installer would look like. Would something like.

  1. Run debootstrap
  2. bind mount the usual dirs (/dev, /proc, /sys)
  3. chroot into the bootstraped system
  4. Install the kernel
  5. Exit chroot and umount bind-mounted dirs
  6. Create tar.gz
  7. Profit

be sufficient? Are there any packages or services that have to be installed, others that are recommended for convenience that are not included in the minimal installation created by the distribution specific utilities?

@killermoehre
Copy link
Contributor

  1. bind mount the usual dirs (/dev, /proc, /sys)
  2. chroot into the bootstraped system

  1. Exit chroot and umount bind-mounted dirs

@heg-hpo the arch-install-scripts should cover this very nice.

@bastelfreak
Copy link
Member Author

@heg-hpo ntp and ssh have to be installed, thats all.

using nspawn instead of chroot is the prefered way for everything that runs on systemd. The installimage already has functions to set that up.

@killermoehre
Copy link
Contributor

@bastelfreak how do you want to configure the file system layout for this images? Doing everything on one (virtual) disk with one partition is easy. I see the problems with different partition layouts. At install time at least »/«, »/var« and »/usr« have to be available (providing /usr via shared storage is somehow common in virtualised environments, a /var on nfs helps to keep things central).

@bastelfreak
Copy link
Member Author

there isn't any need to have multiple partitions for creating an image.

@killermoehre
Copy link
Contributor

There is a need to put them in the /etc/fstab.

@bastelfreak
Copy link
Member Author

we don't have to do that while building the image. installimage will rewrite the fstab.

@killermoehre
Copy link
Contributor

killermoehre commented Jun 8, 2016

So, if we use LARS as base build platform for abriatary distributions, than it should be quite easy.

  1. get the source definition of $DISTRIBUTION in $VERSION
  2. use debootstrap/dnf/pacstrap (from [aur] or [community]) together with the source definition to install systemd/init, bash, and $PACKAGE_MANAGER with dependencies (minimal golden image; keep updated regular) (don't forget implicit deps like sed, grep and awk)
  3. copy this golden image (rsync ftw \o/) to a working dir
  4. boot this working dir as nspawn
  5. bring up network in nspawn (reaching the package server) (systemd-run -M or machinectl shell) OR bind mount the already downloaded packages in the package cache
  6. install kernel, bootloader, ntp, ssh and $ADDITIONAL_SOFTWARE[@] (systemd-run -M or machinectl shell)
  7. quit the machine
  8. machinectl export-tar $MACHINE_DIR $OUTPUT_IMAGE.tar.gz

@bastelfreak
Copy link
Member Author

and then wrap all in jenkins to have CD and (kind of) reproducible builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants