I am learning Vagrant and friends. I am currently writing a document in Org Mode where I intend to compare different providers and boxes. Ideally I’d like to automate and generate the comparision dynamically. Vagrant provides an API to query their box cloud registry. It is not very sofisticated in terms of searching but it sort of works.
My initial efforts with verb.el are geared towards getting simple results, then maybe I can manage to generalize the functions and code blocks in order for them to accept arguments.
template https://app.vagrantup.com/api/v1/box
For this test I chose arbitrarily a Vagrant Box called Barge which I am interested in testing and benchmarking.I hardcoded the path. Ideally I’d like to be able to pass variables like :var
account="ailispaw" box-name="barge"
to this or a similar verb block.
I am insterested in the current_version
object and some of its properties down
the hierarchy like: update date, size of the image (if avialiable), list of providers, etc.
So it seems reasonable to only query the API once for each box I am interested in.
(setq barge (verb-json-get (oref (verb-stored-response box) body) "current_version"))
Results are sent to barge.json
because I don’t want them in the exported
document. Maybe there is a better way?
Then I can for example call currentVersion
like:
Since tables are first-class citizens in Org Mode, I see many examples that ingest data from a source table, process them and finally output the desired result. I could start for example from a table like:
ailispaw | barge |
bento | amazonlinux-2 |
gbailey | amzn2 |
hajowieland | amazonlinux2 |
hbsmith | awslinux2 |
bb_sdet | amzn2 |
nixwei | amazon-linux-2 |
and use an emacs-lisp (or verb?) source block to map over each row in order to get the desired data and then format it accordingly into another table and/or interpolate the data into a text paragraph via inline calls.
A formatted result could look like:
Box name | providers | Last update | total downloads | description | time of vagrant up (seconds) |
---|---|---|---|---|---|
ailispaw/barge | VirtualBox | [2020-01-01] | 123456 | A minimal box capable of running Docker images | 45 |
etc… |
Another example could be a table that tracks the results of vagrant up
under different providers:
VirtualBox | libvirt (qemu-kvm) | VMware | |
---|---|---|---|
ailispaw/barge | success | N/A | N/A |
centos/8 | pending | success | N/A |
freebsd/FreeBSD-12.2-STABLE | pending | N/A | pending |
bento/freebsd-12.2 | pending | N/A | pending |
alpine-linux/alpine-x86_64 | pending | pending | N/A |
fedora/33-cloud-base | pending | success | N/A |
Right now, I am doing this by hand but I am quite sure this could be automated.
I am not using a source data table but heading properties and a columnview
block to collect and show the data. Example:
Add below for fast bootAmazon Linux 2 vagrant box construction, using an Amazon supplied VDI disk image as a base. This approach avoids actually booting the Amazon supplied VDI disk image by mounting it and applying vagrant related changes to it, and then calling vagrant to package the resulting image as a box file. Available updates are applied as part of this process. Features
These scripts also shrink the consumed disk space, such that these box files are significantly smaller than others I’ve seen posted online.
VirtualBox Guest Additions are included in this box.
config.vm.provider :libvirt do |libvirt|
# Pass through /dev/random from the host to the VM
libvirt.random :model => 'random'
end
This approach works fine when exporting by adding org-update-all-dblocks
to
org-export-before-parsing-hook
.
:no_export:
tags? Prepending COMMENT before the Org headline
title?