cloudsim-portal is part of the cloudsim project. You can find
This is the cloud interface micro service for Cloudsim
- A web app that manages simulators on the cloud
- Has different types of users (to create, share and start machines on the cloud)
- Launches new AWS instances with simulators or field computers
- Must be run from an AWS instance when using SSL certificates
You will need AWS credentials to launch instances on AWS.
Get the AWS keys (AWSAccessKeyId and AWSSecretKey) from the AWS console.
An important configuration is to upload or create a "Key Pair" in each
region where you want to launch simulator machines. That key must be called cloudsim
.
AWS will put the public key in the simulator machine you launched so that you can ssh into the machine by doing:
ssh -i cloudsim.pem ubuntu@ip_address
Add two security groups (names are important):
-
cloudsim-portal
Inbound rules:
HTTPS / TCP / 443 / Anywhere SSH / TCP / 22 / Anywhere All ICMP / ICMP / 0-65535 / Anywhere Custom TCP Rule / TCP / 5050 / Anywhere
-
cloudsim-sim
Inbound rules:
HTTPS / TCP / 443 / Anywhere SSH / TCP / 22 / Anywhere All ICMP / ICMP / 0-65535 / Anywhere Custom UDP Rule / UDP / 1194 / Anywhere
There are different ways to start an AWS instance to host the cloudsim portal
Option 1)
You can do it manually using the AWS EC2 console. Make sure to assign the
right security group (cloudsim-portal
) and choose the key pair (cloudsim
) you created.
Option 2)
This package contains a script to launch an AWS instance from the command line
with the cloudsim-portal
security group and the cloudsim
key.
To use this script, you will need to first setup the AWS environment variables, see Environment variable setup section below.
Use the launch_portal.js
script to launch a new AWS instance.
node launch_portal.js cloudsim empty.bash
You should see the ip address printed when the machine is launched.
Once the new aws instance is up and running, ssh into the machine:
ssh -i cloudsim.pem ubuntu@ip_address
Change the hostname to portal
sudo su
echo "portal" > /etc/hostname
echo "127.0.1.1 portal" >> /etc/hosts
Setup the iptable to redirect port 443 (HTTPS) to 4000 (cloudsim portal server).
This won't survive a reboot unless you put this in
/etc/rc.local
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 443 -j REDIRECT --to-port 4000
You need the following: nodejs (version 4 and up)
If you are running Ubuntu Trusty or older distributions, you should install using nodesource:
curl https://deb.nodesource.com/setup_4.x | sudo -E bash -
Otherwise, install using apt-get:
sudo apt-get install -y nodejs nodejs-legacy npm redis-server mercurial
From the root directory
npm install
In order for the portal to launch a simulator machine, valid AWS access keys are needed. Create a .env
file and add the follwing but replace the XXX with your AWS keys:
AWS_ACCESS_KEY_ID=XXXXXXXX
AWS_SECRET_ACCESS_KEY=XXXXXXXXXX
These environment variables must be loaded in the shell that runs the portal web app (the keys are used to launch simulation machines)
For security purposes, all sockets and REST API's are protected. Set up the public key needed to decode json web tokens. Edit and .env
file and add the following variable. Replace XXX with the actual public key.
CLOUDSIM_AUTH_PUB_KEY=XXXXXXXX
From the command line:
npm start
This starts the portal http server and you should be able to access it by going to:
https://ip_address:4000 (if port 4000 is open)
https://ip_address (if the port 4000 is redirected to 443)
Set up mongo with an admin user:
$ mongo
> show dbs
> use cloudsim-portal
> db.users.insert({"username": "admin"})
other useful mongo commands for retrieving data from collections:
> db.users.find().pretty()
> db.simulators.find().pretty()
> db.simulations.find().pretty()
> db.simulators.remove({})
npm test
This sets the NODE_ENV
environment variable to test
and uses fake cloud services.
No AWS instances will be launched.
AWS cloud services supports dry runs. Declare a CLOUDSIM_DRY_RUN
variable in the .env
file and set it to true
. All AWS cloud services will be called with DryRun
enabled.
The difference between fake cloud services and AWS dry-run is that the fake cloud services does not actually make any services calls to the AWS provider. Instead, fake cloud service calls return immediately as if machines were successfully launched.
To use fake cloud services, comment out the AWS_ACCESS_KEY_ID
environment variable.in the .env
file.
Refer to these instructions on how to deploy to AWS Elastic Beanstalk using Codeship.