Question & Answer
Question
Answer
On Demand Consulting
Author: Sergii Berdnyk
Overview
This article details the approach or high level of strategy for building environments using Vagrant software.
Intended Audience
Intended Audience for this article is people that are intended to build and deploy experimental environments for different software products.
High Level Steps
-
Install Vagrant software
-
Install Vagrant provider (e.g. VMWare Virtual Box Docker etc.)
-
Prepare and deploy the OS template(s) image for the specified environment
-
Prepare the installation files for target product itself and all the add-ons plug-ins fix packs etc
-
Prepare the scripts for the deployment system that will build the environments (shef shell etc..)
-
Create the installation instruction for the specific installation
Procedure
-
Install Vagrant software for the required host OS according to their installation instructions at https://www.vagrantup.com/docs/installation/
-
Install Vagrant provider(s) as per the instruction at https://www.vagrantup.com/docs/providers/ though at this time the document will cover most used cases. Make sure that your vagrant version is listed as compatible with all the providers you intend to use for the target environment.
-
Install Docker as per following instructions https://docs.docker.com/engine/installation/
-
Install Virtual Box as per following instructions https://www.virtualbox.org/manual/ch02.html
-
Install VMware as per following instructions https://www.vmware.com/products/player/faqs.html#installation
-
-
Prepare and deploy the OS template(s) image for the specified environment.
-
If you use Docker your OS template image is prepared during the next step please skip to #4.
-
For Virtual Box servers please use following steps. We use Debian as an example but you can use any other OS as needed.
-
If you want to use the existing images from the library at https://app.vagrantup.com/boxes/search please skip to step 3.b.c
-
For Debian you may download the netinstall iso image at https://www.debian.org/CD/netinst/
-
Prepare the installation for Virtual Box Guest Additions image per your OS please see it here https://www.virtualbox.org/manual/ch04.html
-
Create an empty virtual machine.
-
Select the ISO image you prepared one step above and install the required OS.
-
Install all the OS updates unless you completed 3.b.a.
-
Install ssh server.
-
Create the user vagrant with the safe password and keep it on file.
-
Install the Virtual Box Guest Additions image prepared at step 3.b.c.
-
Stop the machine that you are planning to use as a template.
-
Export the template machine created to a file using 'vagrant package --base <name of your template>'. It should produce a file called package.box in your current directory.
-
Import the file created in the previous step into the vagrant repository using following command 'vagrant box add --name <pick the name for your vagrant repository item that would correspond to the template above> package.box'.
-
Make sure the <pick the name for your template> is available in the output of the command 'vagrant box list'.
-
-
VMware provider instructions are similar to Vitrual Box in case one one is to use VMWare provider very same debian is used as base os the provider type though has to be correctly specified in 5.b. below.
-
-
Prepare the installation files for target product itself and all the add-ons plug-ins fix packs etc...Follow the installation page for the required product (e.g. IBM BPM IBM ODM etc..) and make sure all the installation files are available either locally or online.
-
Prepare the scripts for the deployment system that will build the environments.
-
Create the directory you are planning to use as a base for the product installation. This directory is going to be shared with the built host.
-
In case one is to use Docker provider the entire portion #3 above must go to the Docker file as per referred highlight "The Docker provider does not require a config.vm.box setting. Since the "base image" for a Docker container is pulled from the Docker Index or built from a Dockerfile the box does not add much value and is optional for this provider." at https://www.vagrantup.com/docs/docker/basics.html
-
In the directory above either generate default Vagrantfile by issuing the command vagrant init or create a Vagrantfile in a favorite text editor as per https://www.vagrantup.com/docs/vagrantfile/
-
Specify the vagrant username and password in the vagrant file as per 3.b.h.
-
-
Create a script that will install the product as if the script is run from the template host where the shared directory is called /vagrant.
-
-
Create the detailed installation instructions for the product environment and place it in the same directory. Be sure to include the instruction how to keep the runtime data for each box as the command below will create the environment with empty run time data
-
Run the final vagrant file by 'vagrant up' and once #5 above is properly set up the environment consisting of as many hosts as necessary is up and running.
References
Was this topic helpful?
Document Information
Modified date:
11 February 2019
UID
ibm10771829