Skip to content

Latest commit

 

History

History
240 lines (205 loc) · 7.89 KB

run-ads-using-vagrant-box.org

File metadata and controls

240 lines (205 loc) · 7.89 KB

Run ADS using an existing vagrant box

Introduction

This document describes the steps for setting up ADS service in development environment using an existing vagrant box.

Assumption

The developer environment should have installed the following software.

  1. vagrant - any version
  2. virtualbox: any of the following versions - 4.0.x, 4.1.x, 4.2.x, 4.3.x, 5.0.x, and 5.1.x

Please refer virtualbox and vagrant installation steps for installing the above software in development environment.

Steps to run ADS service

  1. Download the ads vagrant box
    wget http://files.vlabs.ac.in/downloads/vagrant-boxes/ads-on-centos.box
        
  2. Add downloaded box to vagrant box list
    vagrant box add ads-on-centos ads-on-centos.box
        
  3. Check whether downloaded ads-on-centos box is added.
    vagrant box list 
        
  4. Above command must list ads-on-centos
  5. Intialize the machine
    cd ~ 
    mkdir ads-on-centos 
    cd ads-on-centos 
    vagrant init ads-on-centos 
        
  6. Edit the Vagrantfile using editor (like e.g emacs, vim, etc.) and uncomment below line by removing # in the beginning of the line to set the vagrant to use private network (e.g 192.168.33.10)
    #config.vm.network "private_network", ip: "192.168.33.10" 
    config.vm.network "private_network", ip: "192.168.33.10" 
        
  7. Boot the machine
    vagrant up 
        
  8. Login in to the machine as root. Sometimes, login will succeed after a few tries.
    vagrant ssh 
    sudo su -
        
  9. Pull the latest ADS source code
    • As root, go into /root/ovpl directory, checkout branch to develop and pull the changes.
      cd /root/ovpl 
      git checkout develop 
      git pull origin develop
              
  10. Configure Proxy
    • if your network is behind proxy, configure HTTP_PROXY and HTTPS_PROXY of ENVIRONMENT variable in /root/ovpl/config/config.json file
      "ENVIRONMENT": {
      "HTTP_PROXY":"http://proxy.iiit.ac.in:8080",
      "HTTPS_PROXY":"http://proxy.iiit.ac.in:8080"
       .......,
       ........
      },
              
  11. Configure OS template
    ADS supoort of different operating systems
    ADS currently supports the following OS and the corresponding versions and the web server. All the three are for x86, 64 bit architecture.
    1. Ubuntu 12.04 with apache
    2. Ubuntu 14.04 with nginx
    3. Centos 6.9 with apache
    Support for Ubuntu 12.04
    ads-on-centos.box comes with default template. If the lab to be deployed on a machine with OS ubuntu 12.04, then no configuration changes are required to the ADS. The file labspec.json in the lab that needs deployment specifies the OS and its version.
    "platform": {
      "os": "ubuntu",
      "osVersion": "12",
      "arch": "x64",
      .....
      .....
            

    ADS picks up the right template from the configuration file /root/ovpl/config/adapters/centos_openvz_config.py.

    supported_template = [
      {'os': 'UBUNTU', 'version': '12.04',
       'id': 'ubuntu-12.04-custom-with-emacs-x86_64'}
    ]
            
    Configure for a diffetent OS
    If the application is to be deployed on Ubuntu 14.04, do the following
    1. add the following lines to /root/ovpl/config/adapters/centos_openvz_config.py.
      supported_template = [
      {'os': 'UBUNTU', 'version': '12.04',
       'id': 'ubuntu-12.04-custom-with-emacs-x86_64'},
      {'os': 'UBUNTU', 'version': '14.04',
       'id': 'ubuntu-14.04_x86_64-custom-emacs-nginx'}
                  
    2. download the os template ubuntu-14.04_x86_64-custom-emacs-nginx.tar.gz from http://files.vlabs.ac.in/downloads/templates/ to /vz/templates/cache/ directory.
      cd /vz/templates/cache/
      wget http://files.vlabs.ac.in/downloads/templates/ubuntu-14.04_x86_64-custom-emacs-nginx.tar.gz
                  
  12. Setup Google Oauth credentials
    • Create a project at Google Dashboard and create Oauth credentials.
    • On successful creation of credentials set Authorized redirect URIs to
      http://local-ads.com:8080/login/authorized
              
    • Provide CONSUMER_KEY and CONSUMER_SECRET in /root/ovpl/src/ads-web-app/config.py.
      CONSUMER_KEY = "<consumerkey>" 
      CONSUMER_SECRET = "<consumer secret key>" 
              
  13. Setup ADS credentials in the same file /root/ovpl/src/ads-web-app/config.py
    • Add email ids to AUTHORIZED_USERS
      AUTHORIZED_USERS = [ "heregoesemail@gmail.com" ]
              
  14. Start ADS services
    • As root, go to ovpl directory and run manage_services.sh file
      cd /root/ovpl 
      ./manage_services.sh (or)
      ./manage_services.sh start 
              
    • Other commands to manage the services
      • To stop the services
      ./manage_services.sh stop 
              
      • To stop or start specific service use

      ./manage_services.sh [action] [services]

      • [action] = start (or) stop
      • [services] = LOGGER (or) ADAPTER (or) CONTROLLER
      ./manage_services.sh start LOGGER 
              
      • For more help use ./manage_services.sh --help.
  15. Start the ADS web application service
    Set Proxy
    If the network is behind a proxy, export proxy variables. The below example shows for a network behind IIIT proxy.
    export http_proxy="http://proxy.iiit.ac.in:8080"
    export https_proxy="http://proxy.iiit.ac.in:8080"
            
    Run ads-web-app service
    cd /root/ovpl/src/ads-web-app/ 
    python app.py &
            
  16. The above steps configure the machine and start the ADS services.
  17. Set up local DNS entry on the host machine. This is the machine where the browser is started.
    • Edit /etc/hosts file on host machine where the ADS application is run from the browser to assign the domain name to 192.168.33.10. This is to be done for successful redirection page for google authorization page
    • Execute below command to reflect the domain name change in /etc/hosts (Note :- Below command should be executed on host machine and not on vagrant machine)
      echo '192.168.33.10 local-ads.com' >> /etc/hosts
              
  18. Access ADS on browser
    • Open the location http://local-ads.com:8080 from the browser and provide the lab id, lab sources url and version/tag.
    • View the logs at /root/logs/ovpl.log by
      tail -f /root/logs/ovpl.log