Setting up Vagrant VM for Adapter development
=============================================

1. Download and install latest version of Oracle VirtualBox from
   http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html.
2. Download and install latest version of Vagrant from https://www.vagrantup.com/downloads.html.
3. Download JDK, Oracle XE, weblogic 10.3.6 and patch from OneDrive link provided in email. These are provided
   on OneDrive since at least two of the downloads require an active Oracle support account that's registered
   with the VA Support ID.  You can request a OneDrive link from David Vazquez (david.vazquez@vetsez.com).
4. Copy the downloaded files to <ehx_working_dir>/NHIN_adapter/.vagrant/Software where <ehx_working_dir> is the directory
   where you cloned the ehx repository.
5. Change directory to <ehx_working_dir>/NHIN_adapter and execute the following command:

     vagrant up
     
   NOTE: On Windows, execute the command using a git-bash or cygwin terminal since ssh is required to connect to the VM
   to provision and use it.  The first time you startup the machine, it will take approximately 20 minutes to install and
   provision.
   
   NOTE2: Provisioning may fail if the connection to the CentOS update servers fails.  if this happens, run:
   
     vagrant destroy
     vagrant up
     
   to try the setup again.
6. Run the following command to access a shell on the VM.

     vagrant ssh

7. When you are done with VM session, run the following command shut it down:

     vagrant halt

8. When you are done with the VM and are either sure you won't use it again or you need to start from scratch:

     vagrant destroy

What you'll have when it's done
===============================

* CentOS 7 Linux VM with following specs:
    4GB RAM
    40GB HDD
    3.5GB swap file
* Java JDK 1.7.0_111
* Oracle XE DB instance available on port 1521 (guest) 7521 (host)
* Oracle WebLogic 11g (10.3.6) w/ latest recommended patch on port 7001 (http guest and host),
  7002 (https guest and host) and 7004 (debug port host) and 4000 (debug port guest)
* X Windows support for running weblogic commands that require a GUI.  You'll have to use the following command to
  forward X to your local X Server.
    
    vagrant ssh -- -X

  NOTE: On Windows, you will have to install an X Server (i. e. XMing).  In the git bash shell that you use to
  launch Vagrant, export DISPLAY=localhost:0 before running the vagrant ssh command so that X is properly forwarded.
* Important users:
     un: vagrant pw: vagrant
     un: root pw: vagrant
* JDK, Oracle XE, and weblogic common commands (e. g. config.sh, config_builder.sh, etc.) in path.
* <ehx_stage_dir>/NHIN_adapter directory is mounted in guest VM as /ehx to make sharing of files between host and guest
  easy.
* ADAPTER schema in datbase (un: adapter, pw: adapter).

What we still need
==================

I've been doing these manually, but they can be scripted too so we have a more complete VM.

* Adapter development (ADAPTER_DEVL) WebLogic domain.  Use config.sh to set up domain from the template in /ehx/weblogic/template/adapter_template_10.3.6.0.jar. NOTE: make sure you have X forwarding set up correctly so that you get the GUI.  I create the doamin in /u01/app/domains/adapter_devl.

References
==========

http://vagrantup.com - Vagrant up site.  Read through Get Started material.
