Deployment of a Virtual Lab
Table of Contents
- 1 Who we are?
- 2 Agenda of this Workshop
- 3 What is Virtual Labs?
- 4 Why Virtual Labs?
- 5 Another View of Virtual Labs
- 6 Hosting Infrastructure
- 7 Interplay of services while deploying a lab
- 8 Auto-Deployment Service (ADS)
- 9 Labspec
- 10 Develop and deploy your own virtual lab
- 10.1 Download the sample template of a virtual lab
- 10.2 Edit the source of the virtual lab template
- 10.3 Edit the lab spec of your new virtual lab
- 10.4 Initialise your virtual lab to be a git repository
- 10.5 Create an online repository on GitHub
- 10.6 Push the virtual lab repository on to GitHub
- 10.7 Go to ADS service and Deploy your lab
- 10.8 Watch your lab go live!
1 Who we are?
People
Anon Ray
at Virtual Labs Engineering and Architecture Division IIIT, Hyderabad
Work
We develop, engineer and maintain the Central Platform of Virtual Labs.
This includes the hosting infrastructure, and a plethora of other related platform services required by a Virtual Lab during its life cycle.
2 Agenda of this Workshop
3 What is Virtual Labs?
Virtual Labs is a collection of online labs running on a common platform and acts as a complement to learning in Engineering and Sciences curriculum. All premier Indian technical institutes are contributing their Virtual Labs to aid Indian students who don't have access to good laboratory infrastructure.
4 Why Virtual Labs?
- Virtual Labs is the next technology to deliver educational content in a highly interactive manner.
- The platform aims to provide high availability and auto-scalability of your lab.
- The platform provides usage analytics, single sign on etc.
- The application can choose to be deployed on its preferred platform.
5 Another View of Virtual Labs
6 Hosting Infrastructure
7 Interplay of services while deploying a lab
8 Auto-Deployment Service (ADS)
8.1 What is ADS
8.2 Leveraging ADS
9 Labspec
Detailed discussion regarding various attributes of the lab spec.
- How to specify dependencies.
- How to specify pre-install steps.
- How to specify install steps.
- How to specify post-install steps.
- How to specify various meta information regarding the lab.
{ "lab": { "description": { "id": "stall", "name": "STALL_LAB", "discipline": ["SHOWCASE"], ... "developer": [ { "contact": { "email": "stall@vlabs.ac.in", "alternate_email": "", "mobile_number": "", "office_number": "" }, "department": "", "institute": "", "name": "", "organization": "", "role": "", "title": "", "web": "" } ] }, "build_requirements": { "platform": { "arch": "", "build_steps": { "build": ["make -C ../src"], ... }, } }, "runtime_requirements": { "platform": { "arch": "x86_64", "installer": ["sudo apt-get update", "sudo apt-get install -y apache2"], "lab_actions": { "init": ["mv /var/www/index.html index.html.default", "cp -r ../src/* /var/www/"], "shutdown": ["service apache2 stop"], "start": ["service apache2 start"], }, "memory": { "max_required": "", "min_required": "" }, "storage": { "min_required": "" } } } }, "template": "1.0" }
10 Develop and deploy your own virtual lab
10.1 Download the sample template of a virtual lab
- Go to: https://github.com/ecthiender/sample-vlab-template
- Click on
Download ZIP
to download sources of a web application that you would deploy. - Extract the contents of the zip file by running the command
unzip sample-vlab-template-master.zip
10.2 Edit the source of the virtual lab template
- let's look into the sample template
cd sample-vlab-template-master
- the `src` directory contains the source code of the lab
- the `scripts` directory contains the labspec and other scripts
- let's make some modifications in the source HTML files
cd src
- open index.html in an editor and make modifications.
10.3 Edit the lab spec of your new virtual lab
10.3.1 Editing the lab spec
- We already know the `labspec` file which is required to specify the installation and deployment steps of a lab.
- Lets look at the labspec now which is located inside the `scripts` directory.
cd ../scripts
- Open the labspec.json in an editor.
- Let's look at the following fields that are necessary for a lab specification, one by one to understand them and fill them with appropriate values.
10.3.2 Meta information related to the lab
- id: any string which can be used as an identifier for the lab. e.g - let's use three-letter discipline name followed by 2-digit numeric to represent your lab. But this can be anything.
- name: the name of the lab
- discipline: to specify the discipline name of the lab
- description -> developer: the list of the developers for the lab along with their contact details
{ "id": "cse02", "name": "Computer Programming", "discipline": [ "Computer Science & Engineering" ], "description": { "developer": [ { "contact": { "alternate_email": "", "email": "jawahar@iiit.ac.in", "mobile_number": "", "office_number": "" }, "department": "", "institute": "IIIT Hyderabad", "name": "Jawahar C.V", "organization": "", "role": "Lab Developer", "title": "", "web": "" } ] }
Sample labspec to show the lab information related fields
10.3.3 Build requirements of the lab
- build steps -> build: to specify any build steps that are necessary for the lab before installation
- os, and osVersion: to mention on what OS and OS version the build steps to be performed.
"build_requirements": { "platform": { "arch": "i386", "build_steps": { "build": ["make -C ../src"], . . }, "os": "ubuntu", "osVersion": "12" . . } . . }
Sample labspec to show the build requirment related fields of a lab
10.3.4 Runtime requirements:
- architecture: on what architecture the lab will run (
i386
- 32bit orx86_64
- 64bit) - hosting: dedicated hosting or shared hosting; default is dedicated.
- installer: the list of steps that are to be performed for the lab to get installed. This is the field where one specifies the steps to install the dependencies of a lab.
"installer": ["sudo apt-get update", "sudo apt-get install -y apache2"],
- lab actions -> init: to specify the steps to run after the lab is installed. E.g - the final deployment steps, post-install steps etc.
"init": ["mv /var/www/index.html index.html.default", "cp -r ../src/* /var/www/"]
- lab actions -> start: the steps to start the services of a lab(if required)
"start": ["service apache2 start"],
- lab actions -> shutdown: the steps to stop the services of a lab(if required)
"shutdown": ["service apache2 stop"],
- Snippet of sample run time requirements
"runtime_requirements": { "platform": { "arch": "x86_64", "hosting": "dedicated", "installer": [ "sudo apt-get update", "sudo apt-get install -y php5 apache2", "sudo apt-get install -y mysql memcache" ], "lab_actions": { "init": [ "mv /var/www/index.html index.html.default", "cp -r ../build/* /var/www/" ], "shutdown": ["service apache2 stop"], "start": ["service apache2 start"], . . } } }
Sample labspec to show the runtime requirment related fields of a lab
10.3.5 System requirements of the lab
- memory: minimum required memory to be filled out. we also have a cap on the maximum memory a lab would need.
- os, osVersion: to specify OS and OS version on which the lab would run.
- storage: the minimum required storage for a lab
10.4 Initialise your virtual lab to be a git repository
- now let's make our virtual lab a git repo as well.
- run `git init` inside the sample template directory. Make sure you are at the top level.
git init
- If git in not present, install git.
apt-get install -y git
- Add the files
git add .
- Commit the files
git commit -m "Initial commit"
10.5 Create an online repository on GitHub
- go to
www.github.com
and login to your account. (Create if you do not have one) - Click on
New repository
button on the home page. - Provide the
Repository name
- Provide
Description
- Click on
Create repository
button
10.6 Push the virtual lab repository on to GitHub
- Copy the repository URL
- Make it the remote of your newly created local git repository.
git remote add origin https://github.com/<user-name>/<repo-name>
- Push all the contents of the local repository to GitHub
git push origin master
10.7 Go to ADS service and Deploy your lab
- Open browser and navigate to
http://<ip-address>:8080
. Replace<ip-address>
with the ip address given to you. - Fill
Lab ID
andRepo url
fields.Lab ID
is the id that you have given in the labspec.json file.Repo url
is the url of your github repository.
10.8 Watch your lab go live!
- Hit the submit button and sit back, it takes some time to deploy the lab!
- Access the new deployed lab by navigating to
http://<ip-address>