Package: distrobuilder-menu
distrobuilder-menuApythonconsole frontend toDistrobuilderfor buildingstandardorcustomised LXD / LXCimagesMain Menus (LXD | LXC)Install frompypi.orgpipx install distrobuilder-menuInstallArch Linux package from AURyay distrobuilder-menuBuild LXD or LXC containers:dbmenu || dbmenu --lxc➡️ FeaturesAppversion upgradesviapypi&Distrobuilder templateupdates via theGithub REST API:dbmenu -vdbmenu -uCreate:cloud-initper-once/ standard configurationtemplate overridesto include custom files / scriptscustom templatesbymergingthe template override / cloud-inityamlAutomaticcustom templatere-generationas part of updating thestandardtemplates:This ensurescustomtemplates remain in sync withstandardtemplates (which change distribution versions over time)Automatic selectivecachingofjsonoutput fromLXDimages:jsonread speed improved from1mb/0.65seconds===>30kb/0.0083secondsFastyamlreading withyaml.CSafeLoaderFast menu generation (typically0.03seconds or less)Auto generated menus for the available container versions yourplatformcan build:Version MenuOptionallyimportthe builtLXDimage intoincusorlxdTo disable automaticLXDimportsShow User Configurationfrom theMain Menu& edit / setimport_into_lxdtoFalse➡️ Command line options:usage: dbmenu [-h] [--lxd | --lxc | -o | -g | -i | -c | -e | -d | -m | -y | -u]
                          [-s] [-t] [--rate] [--reset] [-r] [-v]

Menu driven LXD / LXC images for Distrobuilder

options:
  -h, --help        show this help message and exit
  --lxd             build LXD container / vm image (default)
  --lxc             build LXC container image
  -o, --override    create new template override
  -g, --generate    generate custom template from override
  -i, --init        create / edit cloud-init configuration
  -c, --copy        copy existing template / override
  -e, --edit        edit existing template / override
  -d, --delete      delete template / override
  -m, --move        move / rename template or override
  -y, --merge       merge cloudinit configuration with yq
  -u, --update      force update templates (default auto weekly)
  -s, --show        show configuration settings
  -t, --timer       debug timer used in testing
  --rate            show current Github API Rate Limit
  --reset           reset dbmenu base directory configuration
  -r, --regenerate  regenerate custom templates
  -v, --version     show dbmenu version / update to latest release➡️ User Configuration:User configuration is stored under~/.config/dbmenu.yaml& is auto generated with sensible defaults on the first run ofdbmenuThe base directory of thedistrobuilderarea can be optionally changed from thedefault~/distrobuilderon first run or at any time via thedbmenu --resetcommand line option[~]$ cat ~/.config/dbmenu.yaml
config_dir: /home/stuart/.config
main_dir: /home/stuart/devops/distrobuilder
target_dir: /home/stuart/devops/distrobuilder/build
files_dir: /home/stuart/devops/distrobuilder/files
template_dir: /home/stuart/devops/distrobuilder/templates
cloudinit_dir: /home/stuart/devops/distrobuilder/cloudinit
dbmenu_config: /home/stuart/.config/dbmenu.yaml
gh_owner: lxc
gh_repo: lxc-ci
gh_api_url: https://api.github.com
github_token: ''
cache_dir: false
cleanup: true
compression: xz
console_editor: nano
debug: false
disable_overlay: false
import_into_lxd: true
json_cachefile: /home/stuart/devops/distrobuilder/templates/cache.json
lxd_json: /home/stuart/devops/distrobuilder/templates/lxd.json
lxd_output_type: unified
subdir_custom: /home/stuart/devops/distrobuilder/templates/custom
subdir_images: /home/stuart/devops/distrobuilder/templates/images
subdir_overrides: /home/stuart/devops/distrobuilder/templates/overrides
cloudinit_network_dir: /home/stuart/devops/distrobuilder/cloudinit/network-data
cloudinit_user_dir: /home/stuart/devops/distrobuilder/cloudinit/user-data
cloudinit_vendor_dir: /home/stuart/devops/distrobuilder/cloudinit/vendor-data
timeout: false
yq_check: trueFor normal operation it'snotnecessary to add aGithub Personal Access Tokento your User ConfigurationUnauthenticatedGithub API Rate Limitsare not normally exceeded due toconnection-poolinginurllib3& theAPI callsbeing made by asingletoninstance ofGethubTo check your currentGithub API rate limitrundbmenu --rate➡️ Dependenciespython3.10+/pyyaml/urllib3Golang version4+ofyq(go-yqinArch Linux)incusorlxdDistrobuilderversion3.0or higher➡️ Installation / Upgrading✅ Arch Linuxpackage from AUR:yay distrobuilder-menu✅ Isolated app (choose either pypi or github):pipx install distrobuilder-menu(pypi)pipx install git+https://github.com/itoffshore/distrobuilder-menu.git(github)size on disk4mbupgrade release with--force‼️ System module (choose either pypi or github):pip install distrobuilder-menu(pypi)pip install git+https://github.com/itoffshore/distrobuilder-menu.git(github)size on disk600kbupgrade release with--force⬇️Upgrading withdbmenu -v🆕 in version0.2.5:pip/pipxupgrades🆕 in version0.2.8: Arch Linux package detection skips pypi upgrades & displays the latestAUR version🆕 in version0.2.6- a compatibility symlink forlxdis automatically created to ensureDistrobuildercan find/var/lib/incus/unix.socketto import built images.⚠️ By defaultimport_into_lxdisTruein user settings & can be edited with:dbmenu -sor option11from theMain Menu(if neitherlxdorincusare installed locally)For versions prior to0.2.6create the symlink manually if you uselxd& want to import built images:ln -s /var/lib/lxd /var/lib/incus❓ Creating Override Templatesdbmenuwas inspired by & follows a similar methodology toHashicorp Packerwhich builds / creates templates in layers:Create abaseimage override for your chosen distribution with yourshell/ package customizations that overrides astandard templateDistribution MenuThis will generate anoverridetemplate with an examplefiles&packagessections to customise & optionally open in your configuredconsole_editor(nanoby default)⚠️ Anoverrideonly needs theextrapackages you wish to include (& not all of the packages that are included as anexampleof theyamlfrom theSOURCEtemplate you are overriding)Override TemplateCreate aspecificoverride /cloud-initconfig for your customservice containerthat contains customizationsnotin yourbaseimage template (e.gweb services/database)Generate aCustom Templatewhich uses your custombaseimage template as theSOURCEtemplate &mergesyourspecificoverrides / cloud-init for your customservice container📰 Template ExamplesThis repo'sexamplesdirectory is also packaged undersite-packages:e.g forpipxinstalls:~/.local/pipx/venvs/distrobuilder-menu/lib/python3.11/site-packages/distrobuilder_menu/examplese.g for installs from an Arch Linux package:/usr/lib/python3.11/site-packages/distrobuilder_menu/examplesTheseexamplesshow how to create images for:Alpine Linux / UbuntubaseimagesAlpine Linuxbuild environment (21mb) that installsalpine-sdkon first boot via cloud-init &most of the stepsfor contributing packages to AlpineSee thealpine-abuildcloud-initbootcmdfor how to build an Alpine Linux cloud image & remove cloud-init & it's dependencies on first bootUbuntuGitlabcontainer that installsGitlabon firstbootviacloud-init🏗️ Creating / Building a Custom TemplateEmpty input for each menu option / choice willreturnyou to theMain Menu(main event loop)Create Custom OverrideOptionally -Create cloud-init ConfigGenerate Custom Templatethis option gives choices tomergeaCustom Override&cloud-initconfigurationyou could also justMerge cloud-init Configinto an existing template if you only need that optionBuild image- choosing the template type:LXD imagesare built bydefaultto buildlxcimages start the app withdbmenu --lxcdefault container(LXC & LXD)cloud container(LXC & LXD)vm(LXD only)🏗️ Regenerating Custom Templates (🆕 inv0.2.0)Over time the distribution versions instandardDistrobuilder templateschange (causingcustomtemplates to become outdated)v0.2.0adds ajsonfooteras a comment with details of how thecustomtemplate was generated. To use this new feature existingcustom/basetemplates created beforev0.2.0will need to be re-created (so thejsonfooter is written to the template)🆕 inv0.2.1- automaticcustomtemplate regeneration is incorporated intostandardtemplate updates / downloadsCustom templates can also be regenerated at any time with:dbmenu -rAutomatic template regenerationbasetemplates that usestandardtemplates as aSOURCEare regenerated firstcustomtemplates which override abasetemplate are regenerated afterwardsfor templates without adbmenugeneratedjsonfooter a warning message is shown