Skip to content

Virtual Machine Builds

John Paden edited this page Jun 3, 2016 · 47 revisions

Virtual machine (VM) builds are useful for debugging and learning how to use the OPS environment.

There are pre-built VM's that are useful for taking to the field (https://data.cresis.ku.edu/data/ops/). The steps below also describe how to create these pre-built VM's.

Build an OPS VM

Creating a Template VM

NEED TO FINISH DESCRIBING THIS PROCESS Rather than starting from scratch, we recommend starting with the template VM. This section describes how to create the template VM.

The template VM has only a minimal setup:

  1. Centos base install
  2. Username and password setup for root
  3. Username and password setup for pub
  4. Desktop background image
  5. Virtual box guest additions

Template VM

The OPS template VM is called ops.base.ova and is available here. This VM has minimal software already installed and is a good starting place for creating a pre-built VM. This VM has CentOS Linux installed and a few additional packages (NEED TO SPECIFY WHICH HERE). It still needs to be "provisioned". The steps below describe how to provision the VM.

Create a new build from the template VM

  • Download the template VM
  • Install Oracle Virtual Box
  • Import the template VM into Oracle Virtual Box
  • Set the shared folder path if you want a convenient way to pass files back and forth from your VM.
  • Run the VM
  • Login to the VM Default login information: username: ops, password: pubOps
  • Open a terminal and enter the following code:

sudo -i
yum update -y
mkdir /vagrant && cd /vagrant
git clone https://github.com/cresis/OPS.git .
reboot

  • If you want to use "Guest Additions", choose "Devices-->Insert Guest Additions CD Image" from the VM window. This should bring up a few prompts to install the Guest Additions. This will usually ask you to reboot after a successful install before proceeding.

  • After the VM is rebooted, log in and open the terminal, enter the following code:

sudo -i
cd /vagrant
sh conf/provisions.sh
reboot

You will be prompted for a database user/password. Accept the defaults (admin and pubAdmin) by pressing enter. At some point you will be asked to accept two JAVA license agreements. A [MORE] prompt will appear. You can use your space bar to skip to the YES/NO (hit it until you see YES/NO). Type yes for both.

Next, you will be prompted to add django admins. There can be zero or more admins that will be emailed error information if/when django encounters errors. It is recommended that at least one person be on the admin list to receive and deal with such errors.

Finally, you will be asked if django should operate in debug mode. The answer to this question should always be 'no' in a production environment. If working in a development environment, however, activating django's debug mode may provide insight to errors encountered during development. You can change to and from debug mode later by editing /var/django/ops/ops/settings.py and setting DEBUG to true or false.

  • Should you want to preload a portion of the database (i.e. for a field deployment), start the process here instead.

  • If one wants to have the eclipse IDE pre-installed and configured for the build, follow these instructions.

  • You will need to create an anonymous user for the system to work properly. First edit the createUserExample.py file with the new user information. This file is located at "/vagrant/conf/tools/" on your virtual box. Then follow the instructions in the header of createUserExample.py to run python. From within python, run "execfile('createUserExample.py')". This anonymous user should have the following properties: ** username: "anonymous" ** email: "[email protected]" ** password: "anonymous".

  • Run the OPS tests to verify Django is operational on the VM.

  • Next, run MATLAB from your host machine. After setting up the cresis-toolbox, in Matlab: ** edit opsCmd and set "gOps.sysUrl = 'http://192.168.111.222/';" ** run "opsTests"

  • Before testing, make sure the virtual box network environment is set up to use 192.168.111.222. See Virtualbox installation for directions on how to set the host only adapter to use this IP address.

  • If all tests pass the OPS VM is provisioned and running. Finally you can make sure the GeoPortal is working by visiting 192.168.111.222 on your host machine.

  • Secure the geoserver by:

    • Logging into the geoserver (192.168.111.222/geoserver/web/)
    • log in as the administrator (username: root password: pubMaster)
    • Navigate to the Passwords tab (left hand bar)
    • Click on Change password and change it to the standard CReSIS OPS password
  • To finish up the process enter the following commands in a new terminal (close all others):

sudo -i
yum clean all
history -c
exit
history -c
sudo -i
shutdown -h now

Making changes to the VM setup

OPS is open source on github and so authentication is not needed to grab the source code. However, to push changes back to OPS, you need to authenticate. Some additional commands are needed for this:

sudo -i
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"
git remote set-url origin https://[email protected]/cresis/OPS.git

Create a pre-built VM

After following the steps in [Build an OPS VM](Build an OPS VM), do the following:

  • In Oracle VirtualBox VM Manager click on the VM that you created and rename the VM. Select the "General" settings. Then select the "Basic" tab under the General settings and then change the Name field. Our typical naming convention is: ops.build.yyyy.mm.dd (e.g. "ops.build.2014.05.15")

  • In Oracle VirtualBox VM Manager select File > Export Appliance and select the renamed VM, decide on an output location, and OVF 1.0 as the format. At CReSIS, these prebuilt VM's are shared at /cresis/snfs1/dataproducts/public/data/ops/ which is https://data.cresis.ku.edu/data/ops/.