Recipe "DNA and genesis of a Vagrant Box ("VBubuntu") ready for hosting a SMW"

From SMW CindyKate - Main
Component 998878
Jump to: navigation, search

Content


This recipe explains the steps for creating a VirtualBox .ova on the way towards the Vagrant Box mentioned.

Use Hashicorp Packer to build a VirtualBox .ova file already containing a maximum of setup, provisioning and configuration in view of its purpose of hosting a SMW system

Packer Template "template.json"

Packer Template Key "builders" (Array)

Array[0]

Packer Template Key "provisioners" (Array)

Array[0]

Array[1]

Build

git clone [email protected]:dataspects/dataspectsStandardSMWHostingUbuntuVagrantBoxPackerFactory.git
cd dataspectsStandardSMWHostingUbuntuVagrantBoxPackerFactory
packer validate template.json
PACKER_CACHE_DIR=~/packer_cache/ ./pack_now.sh

This creates a .ova at OUTPUT_DIRECTORY.

Import .ova into VirtualBox

  1. VM VirtualBox Manager > Ctrl+I
  2. Run VBoxManage list vms to get the corresponding VMID

Apply some manual finishing to the VirtualBox VM (notably aspects that somehow fail to run within the Packer build context)

Notice:

This is pragmatic behaviour. Of course these aspects shall be solved and moved into the Packer build context.

  • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
  • Some PEAR/PECL package insstallations

Convert VirtualBox VM into Vagrant Box

vagrant package --base VMID --output ~/dataspectsStandardSMWHostingUbuntuVBVM.box

Add dataspectsStandardSMWHostingUbuntuVBVM for local testing

  1. Create a folder named vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox
  2. Run vagrant box add --name dataspectsStandardSMWHostingUbuntuVagrantBox ~/dataspectsStandardSMWHostingUbuntuVBVM.box
  3. Run vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox$ vagrant init and edit Vagrantfile to use dataspectsStandardSMWHostingUbuntuVagrantBox
  4. Run vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox$ vagrant up

Make dataspectsStandardSMWHostingUbuntuVagrantBox.box available at https://app.vagrantup.com/dataspects/boxes/dataspectsStandardSMWHostingUbuntuVagrantBox

  1. Upload dataspectsStandardSMWHostingUbuntuVagrantBox.box to /srv/ftp
  2. Create box and/or release version at https://app.vagrantup.com/dataspects/boxes