Managing Multiple Environments
Now that you have your first local Vagrant/VirtualBox deployment under your belt you may find it useful enough to desire multiple distinct environments. Or maybe you are experimenting with an environment (DataGuard, GoldenGate) that requires multiple VMs.
Using advanced Vagrantfile features you can spin up multiple VMs with one "vagrant up" deployment command. I'll cover these in later blog posts.
By updating individual Vagrantfile config files you can ensure new deployments do not have name or port collisions in your VirtualBox environment
Prepping a Host Only network in VirtualBoxTo set up a private/host only network so multiple VMs can communicate with each other and the PC host perform the following steps. In my example I am using 192.168.88.x as a subnet since I know it is not in use in my environment.
- In the VirtualBox GUI Admin, go to File->Host Network Manager
- Click Create
- Configure Adaptor Manually
- IPv4 Address 192.168.88.1 / Network Mask 255.255.255.0
- DHCP Server Disable
Configuring the VMs
If you are planning on having multiple environments configured then:
1) Create a new directory for the project files to live in
cd \work mkdir node1 mkdir node2 mkdir node3
2) Set up project files according to previously defined setup stepsUse git clone or download the zip file to populate files in the new directory.
cd \work\node1 git clone https://github.com/totalamateurhour/oracle-12.2-vagrant
- or -
Download and unzip https://github.com/totalamateurhour/oracle-12.2-vagrant/archive/master.zip to c:\work\node1 .
Now files will be available in the c:\work\oracle-12.2-vagrant\node1 project directory. The Vagrant specific files and scripts are in the 126.96.36.199 subdirectory.
3) Customize the Vagrantfile:This is necessary to ensure the new VM has no Name or IP address collisions.
- Add the following to the networking section of the Vagrantfile. Specify different IP addresses for each node:
config.vm.network "private_network", ip: "192.168.88.10"
- Specify a unique name for the Virtual Machine. Update v.name to a new, unique name. Name collisions with any configured VMs will cause the script to fail.
- Update the destination port forward values. This is also to remove collisions in the environment.
- Update the inputs to the install.sh shell script to modify install paths, SID name, PDB names, or Character Set if desired.