This is a sample project for working with Ravello APIs, in order to create virtual training labs in the cloud
Additional information on this sample project can be found here.
The application is composed of three parts:
- Client side (in AngularJS).
- Static server, which serves the static client files.
- REST API server, which is accessed by the client.
The two servers are separated. The client sends requests only to the static Web server, which serves its static files. The REST calls are also sent to that server, which is responsible for redirecting the requests to the REST server.
There are two projects in this codebase - 'training-webapp' for the client, and 'training-sever' for the REST server. The 'training-webapp' project also holds Grunt configuration for running the static server in development mode.
You need to have the following components installed:
- nodejs
- bower
- grunt
- mongoDB
- Set the RAVELLO_TRAINING_HOME environment variable to the root directory of the project, for example :
export RAVELLO_TRAINING_HOME=/home/myUser/ravello-training
-
cd training-webapp
-
npm install
-
bower install
-
By default, the application is launched on port 8080. If you would like to change it, you can do so in the Gruntfile.js file, under the 'connect.options' property.
-
grunt
-
cd training-server
-
npm install
In the root directory, run:
config/startup_static_server.sh
config/startup_rest_server.sh
Now you can access the application locally at:
http://localhost:8080
How to run the application in production is up to you.
The project provides a basic nginx configuration example, to illustrate how the static server can be launched with nginx: config/nginx.conf.
Notice! The $RAVELLO_TRAINING_HOME variable should be replaced with the actual path of the project's root directory, inside the nfinx.conf file itself, if it's to be actually used.
The REST server should be run the same way as in development mode:
config/start_rest_server.sh
To configure the application to its initial state, run from the root directory:
mongo training config/init_db.js
This creates the basic 'admin' user, with which you could create the other application users, and then start using its full functionality.
- Make sure grunt-cli is installed globally, so that the grunt command is found and executed successfully.