This document describes the steps for setting up ADS
service in development environment using an existing
vagrant box.
The developer environment should have installed the following software.
- vagrant - any version
- 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.
- Download the ads vagrant box
wget http://files.vlabs.ac.in/downloads/vagrant-boxes/ads-on-centos.box
- Add downloaded box to vagrant box list
vagrant box add ads-on-centos ads-on-centos.box
- Check whether downloaded
ads-on-centos
box is added.vagrant box list
- Above command must list
ads-on-centos
- Intialize the machine
cd ~ mkdir ads-on-centos cd ads-on-centos vagrant init ads-on-centos
- 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"
- Boot the machine
vagrant up
- Login in to the machine as root. Sometimes, login will
succeed after a few tries.
vagrant ssh sudo su -
- Pull the latest ADS source code
- As root, go into
/root/ovpl
directory, checkout branch todevelop
and pull the changes.cd /root/ovpl git checkout develop git pull origin develop
- As root, go into
- Configure Proxy
- if your network is behind proxy, configure
HTTP_PROXY
andHTTPS_PROXY
ofENVIRONMENT
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" ......., ........ },
- if your network is behind proxy, configure
- 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.
- Ubuntu 12.04 with apache
- Ubuntu 14.04 with nginx
- 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 OSubuntu 12.04
, then no configuration changes are required to the ADS. The filelabspec.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
- 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'}
- download the os template
ubuntu-14.04_x86_64-custom-emacs-nginx.tar.gz
fromhttp://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
- add the following lines to
- 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
andCONSUMER_SECRET
in/root/ovpl/src/ads-web-app/config.py
.CONSUMER_KEY = "<consumerkey>" CONSUMER_SECRET = "<consumer secret key>"
- Create a project at Google Dashboard and create
- 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" ]
- Add email ids to
- Start ADS services
- As root, go to
ovpl
directory and runmanage_services.sh
filecd /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
.
- As root, go to
- 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 &
- The above steps configure the machine and start the ADS services.
- 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 to192.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
- Edit
- 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
- Open the location