Skip to content

tool_dev

Daniel Clavijo Coca edited this page Feb 21, 2024 · 3 revisions

Developer Information

Repository Structure

├── appliances                  # src for "service appliances" holding the appliance logic
│   ├── VRouter                 # Vrouter logic
│   ├── legacy                  # bash libraries for appliance service management
│   ├── lib                     # ruby libraries for appliance service management
│   ├── scripts
│   └── service
├── build
├── context-linux               # src for linux context pacakges
├── context-windows             # src for windows context pacakges
├── export                      # where built images are dumped to
│   ├── alma8.qcow2
│   ├── alpine317.qcow2
│   ├── alpine318.qcow2
│   └── service_wordpress.qcow2
└── packer                      # Packer build scripts for each distribution
    ├── alma
    ├── alpine
    ├── alt
    ├── amazon
    ├── build.sh
    ├── centos
    ├── debian
    ├── devuan
    ├── fedora
    ├── freebsd
    ├── ol
    ├── opensuse
    ├── plugins.pkr.hcl
    ├── postprocess.sh          # script used by every appliance to remove any ID the VM acquired during the build process
    ├── rhel
    ├── rocky
    ├── service_OneKE
    ├── service_OneKEa -> service_OneKE/
    ├── service_VRouter
    ├── service_vnf
    ├── service_wordpress
    └── ubuntu

Appliance Build Process

Appliances are constructed using Packer.io templates, each tailored to accommodate the unique characteristics of various distributions. Within the packer directory, individual folders for each distribution contain:

  • A Packer template file
  • Customization scripts (*.sh files)
  • cloud-init.yaml user data (if required)
└── packer
    ├── alma
    │   ├── 10-upgrade-distro.sh
    │   ├── 11-update-grub.sh
    │   ├── 11-zzz.sh
    │   ├── 80-install-context.sh.8
    │   ├── 80-install-context.sh.9
    │   ├── 81-configure-ssh.sh
    │   ├── 98-collect-garbage.sh
    │   ├── alma.pkr.hcl                           # packer template
    │   ├── cloud-init.yml
    │   ├── plugins.pkr.hcl -> ../plugins.pkr.hcl
    │   └── variables.pkr.hcl

For multiple versions of the same distribution, like Debian 10, 11, and 12, a shared Packer template is used, with the version passed to Packer as a parameter.

Whenever feasible, distributions with 'cloud' images serve as the starting point, launched via cloud-init within the Packer Qemu Builder. In cases where 'cloud' images aren't available, the default image is used, and an installer is executed.

Primarily, this stage focuses on installing 'one-context' packages, alongside package updates and the removal of redundant elements.

Subsequently, post-processing takes place within Packer, involving the utilization of virt-sysprep and virt-sparsify.

Lastly, the image undergoes compression using qemu-img convert -c. While image compression can be a Packer option, a separate final compression step often yields smaller image sizes.

Clone this wiki locally