TemplateBuilder 5.1

One of my favorite automation tools is my TemplateBuilder. T.Builder Creates a K8s/K0s cluster in minutes. 5.1. includes Debian and Alpine; Dockge, fzf, exa, nala and the K0s installation wizard. It's also faster. I use it daily to create VM's or Kubernetes clusters.

TemplateBuilder 5.1
Photo by Aaron Huber / Unsplash

One of my favorite tools is TemplateBuilder.sh. I use it daily to create VM's or Kubernetes clusters. For the lash weeks I've been setting up 30-50 VM's per day, without anything like this its impossible. Creating the cluster takes 2-5 minutes and then it's just to start a few scripts to start them up - and on to the next.
5.1. includes more OS's to use and the K0s installation wizard and K0s-starter script. Also included is the initVM.sh script to add aliases and a new prompt for the VM.

TemplateBuilder do create the VM's with a basic set of apps but the full set of selected apps will be installed during the firstboot process. This means stuff will be downloaded from the net, some re-boots and a longer time to boot for the first time.

Fistboot will do re-boot(s) and will download stuff - it may take some time!

Notes on setup

Added in 5.1. Debian and Alpine, Dockge (nice alternative to Portainer), bat (cat enhancement), exa (ls as it should be), fzf (fuzzy find), nala (apt front-end with parallel downloads and mirror optimization and much more)

  • Add your user
    • a strong password
    • a public key
    • minimum length of passwords
  • You should input any OS you like to us
    • file name
    • family (ubuntu/debian/alpine)
    • location of the file on the web
  • Storage for ISO's has to be set
    • my storage setup is so complex that this was the only way to keep it understandable
  • The script will detect your storage for VM's
    • choose one location for them all
  • $$$ means an app is non-free meaning you need to pay for a license like Docker and Portainer-BE.
    • But included are community versions that are free

Notes on usage

The script guides you but do not correct for faults. You need to plan what and how to install your VM's. It's a two step process, creation and initialization of the VM.

  • Reading the code helps you understand what to do.
  • keep VM names short and lower case, you know why
  • don't create to small or to large disks for VM's
    • too small will fail during the creation stage
    • you cant make a disk smaller any easy way
  • don't assign to much or to few resources to the VM's
    • too few resources and the initialization stage will fail
  • As long as I test wizards they are marked TBA, to be announced.
  • All the wizards and settings are constantly changing as I find better ways for running things.
  • Copy/past works in Console xterm.js, that's why we have the serial port. It also uses your local keyboard.
  • The base.qcow2 file can be used for future installs see this blog post
  • For most of the world you need to set the keyboard after installation, only keyboard supported by default in Cloud Images is US.

Fuzzy find an bat combo

Two examples. Please read more on the projects pages.

  • Use fzf and bat combo alias fzfbat fzf --preview "bat --color=always --style=numbers --line-range=:500 {}"
  • Or help screens in color with these in .zshrc
    alias -g – -h='-h 2>&1 | bat --language=help --style=plain'
    alias -g – --help='--help 2>&1 | bat --language=help --style=plain'

Using K0s

A startup script, K0s-startup.sh, is loaded to all VM's in the cluster. Run it to start up the cluster. First start all VM's and wait for them to do all their re-boots and installs, time depends on your system but several minutes is normal.

Using my aliases and prompt

A initialization script, initVM.sh, is loaded to the VM's, edit it and then run it.
The scripts are downloaded for you to edit. For desktops you might like to use them as ~/.bashrc-personal to be able to skel or distro hopping and keep them.

Dockge

Go to http://<IP of the VM>: 5001 and create an admin with a strong password.

NOTE don't use admin and password in NOT a password

Alpine Docker

Alpine Docker will disregard all other selections. And will be super small.

Next Step

Soon I will have more time and I will release the version 5.2 that I use today. It needs to be cleaned up and stripped of customer specific parts to be generic.


References

Dockage [1] CasaUrsus [2] Dockage [3] bat [4] exa [5] fzf [6] bat [4:1] nala [7]


  1. Dockge homepage, getting started GitHub ↩︎

  2. See my GitHub for the scrips and bash add-ones ↩︎

  3. Dockage GitHub, YouTube video ↩︎

  4. bat is a cat clone with e.g. syntax highlighting and Git integration GitHub ↩︎ ↩︎

  5. exa is a modern replacement for the command-line program ls homepage ↩︎

  6. fzf is a general-purpose command-line fuzzy finder GitHub ↩︎

  7. nala is an apt frontend and more GitHub ↩︎