Recipe "DNA and genesis of a Vagrant Box ("VBubuntu") ready for hosting a SMW"
Component 998878
Jump to navigation
Jump to 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
- All necessary files are contained in https://github.com/dataspects/dataspectsStandardSMWHostingUbuntuVagrantBoxPackerFactory.
- https://www.packer.io
Packer Template "template.json"
Packer Template Key "builders" (Array)
Array[0]
- "type": https://www.packer.io/docs/builders/virtualbox-iso.html
- "boot_command": runs https://github.com/dataspects/dataspectsStandardSMWHostingUbuntuVagrantBoxPackerFactory/blob/master/http/preseed.cfg
- "iso_url": loads "http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso"
- "format": "ova"
- "output_directory": OUTPUT_DIRECTORY
- "vm_name": "dataspectsStandardSMWHostingUbuntuVBVM"
- ...
Packer Template Key "provisioners" (Array)
Array[0]
- "type": https://www.packer.io/docs/provisioners/shell.html
- "scripts": https://github.com/dataspects/dataspectsStandardSMWHostingUbuntuVagrantBoxPackerFactory/tree/master/scripts
Array[1]
- "type": https://www.packer.io/docs/provisioners/ansible-local.html
- https://github.com/dataspects/dataspectsStandardSMWHostingAnsibleRole
Build
git clone git@github.com: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
- VM VirtualBox Manager > Ctrl+I
- 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
- Create a folder named vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox
- Run
vagrant box add --name dataspectsStandardSMWHostingUbuntuVagrantBox ~/dataspectsStandardSMWHostingUbuntuVBVM.box
- Run
vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox$ vagrant init
and edit Vagrantfile to use dataspectsStandardSMWHostingUbuntuVagrantBox - Run
vagrant_test_dataspectsStandardSMWHostingUbuntuVagrantBox$ vagrant up
Make dataspectsStandardSMWHostingUbuntuVagrantBox.box available at https://app.vagrantup.com/dataspects/boxes/dataspectsStandardSMWHostingUbuntuVagrantBox
- Upload dataspectsStandardSMWHostingUbuntuVagrantBox.box to
/srv/ftp
- Create box and/or release version at https://app.vagrantup.com/dataspects/boxes