Skip to content

M10 - JAMK VLE

Introduction

Virtual Learning Environment (VLE) is part of the LabraNet study network and is run locally in a private cloud infrastructure. VLE provides infrastructure for realistic IT laboratory conditions for advanced studies courses and environments can be deployed quickly using a one-click portal.

VLE environment is only available to students enrolled to courses which utilize VLE for exercises. To access VLE, you must first have a working LabraNet VPN connection. All VLE deployments are accessed under https://portal.vle.fi. More information about the environment and infrastructure can be found in https://index.vle.fi (also requires VPN).

VPN to labranet

Remember check VPN to labranet instructions from here https://student.labranet.jamk.fi/instructions/

How to start

Students of JAMK's IT Institute can use the VLE environment for their studies. Student can login from labranet computers (or use VPN connection to labranet) at https://portal.vle.fi/login.

Image 01

You can use Template Catalog to create a new deployment using a template (if any is created for you by system admins). You should have one which includes Ubuntu. Create your own virtual machine. After that open Deployments (View deployments and access virtual machines).

Image 02

Note

Note that you have different "view" in your deployments.

Configure Virtual Server

You can click one of your deployments to see more configuration.

Image 03

With the OPEN WEBCONSOLE function, you can log in to your virtual server in a web browser window using a command line interface. Your initial username with sudo rights is user and password is root66. Change the password the very first time you log in with the passwd command.

In the upper right corner, you can use the Actions function to delete your virtual server. You will then lose all your changes. You can then recreate your virtual server in the initial state in the Template Catalog menu.

In the lower left corner, with the Actions function, you can restart your server, etc.

In the middle of the window you can see the IP number used by your server. The IP address may change from time to time. You can check the IP in use from WEBCONSOLE with the ifconfig command.

It is probably easiest to access your virtual server remotely using the ssh protocol. You can log in as a remote user (with sudo rights) e.g. with the Putty program in exactly the same way as on the student.labranet.jamk.fi server. Logging in with SSH is only possible from the labranet network or you must have VPN enabled.

Putty

First, find out the IP number of your server and make sure that you are using labranet VPN or you are in the labranet network. Then enter your IP number in Putty's contact information and click Open.

Image 04

Log in with your user ID/password and you should see instructions.

Image 05

Publish Node.js app

This chapter has a quick information how you can publish Node.js application to VLE with following configuration:

  • Ubuntu Linux 20.04 LTS based virtual machine is used
  • PM2 is used
  • Apache web server is used

Install Apache

Give a following commands

1
2
sudo apt update
sudo apt install apache2

Install Node.js and npm

Give a following commands

1
2
sudo apt install nodejs
sudo apt install npm

Create a sample Node.js app

Create a folder

1
sudo mkdir /var/www/nodejs

Create a app file

1
sudo nano /var/www/nodejs/app.js

Add a following content

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
const http = require('http')
const hostname = '127.0.0.1'
const port = 3000

const server = http.createServer((req, res) => {
  res.statusCode = 200
  res.setHeader('Content-Type', 'text/plain')
  res.write('Hello World!')
  res.end()
})

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`)
})

Add a following rights

1
sudo chmod 755 /var/www/nodejs/app.js

Install PM2 and start your Node.js app

Give a following commands

1
2
3
cd /var/www/nodejs
sudo npm install -g pm2
sudo pm2 start app.js

Active Apache and configure Apache proxy module

Give a following commands

1
2
sudo a2enmod proxy
sudo a2enmod proxy_http

Create a following file

1
sudo nano /etc/apache2/sites-available/nodeapp.conf

Add a following content

1
2
3
4
5
<VirtualHost *:8080>
 ProxyPreserveHost on
 ProxyPass / http://localhost:3000/
 ProxyPassReverse / http://localhost:3000/
</VirtualHost>

Also add 8080 as the listening TCP port by editing the file

1
sudo nano /etc/apache2/ports.confsudo nano /etc/apache2/ports.conf

Add following line below Listen 80 line

1
Listen 8080

Use above virtual host with below commands

1
2
sudo a2ensite nodeapp.conf
sudo service apache2 restart

Write your virtual machine IP and port to browser: http://your-vle-ip-here:8080/ and you should see Hello World! text in your browser.

Publish Node.js with Express and Mongo

By default you might get old version of Node.js with sudo apt install nodejs command and it is not working with Mongoose (Node version need to be higher than 12). You can follow this link information how to install higher version of Node to your VLE - Ubuntu: How to Install Node.js and npm on Ubuntu 22.04.

Basicly you will need to give a following commands:

1
2
3
sudo curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejs
node -v

After that you can create your Node.js application with Express and Mongoose. Follow instructions found in course materials. Use PM2 to start your project index.js file.

frontend

You can create/publish your full stack application frontend also in VLE.