Jump to: navigation, search

Difference between revisions of "OpenStackDashboard"

Line 4: Line 4:
 
The OpenStack Dashboard is a reference implementation for the django-nova project. Both are housed on Launchpad.  
 
The OpenStack Dashboard is a reference implementation for the django-nova project. Both are housed on Launchpad.  
  
This web application (built in[http://www.djangoproject.com/ Django]) communicates with nova-api to allow the user to interact with the nova installation with a pleasing graphic interface.
+
= Prerequisites for Running The [[OpenStack]] Dashboard =
  
The overall steps for building a dashboard are:
+
* Running [[OpenStack]] nova instance (nova-api and nova-compute) with EC2 API enabled
 +
* URL of your nova-api instance (this is usually something like http://localhost:8773/services/Cloud)
 +
* Valid user and user credentials for nova (specifically, the username, the NOVA_ACCESS_KEY and NOVA_SECRET_KEY). These should be in your novarc file.
 +
* python 2.6 (not tested with python 3.0)
 +
 
 +
= Installation Overview =
 +
 
 +
The overall steps for building the dashboard are:
  
 
# Get the source for both django-nova and openstack-dashboard from launchpad
 
# Get the source for both django-nova and openstack-dashboard from launchpad
 
# Build django-nova with the boostrap script and buildout commands as shown in the dajngo-nova README
 
# Build django-nova with the boostrap script and buildout commands as shown in the dajngo-nova README
# Change over to the openstack-dashboard directory
+
# Build and configure openstack-dashboard
# Create a virtaulenv for openstack-dashboard (this loads all of it's dependent libraries)
 
# Configure openstack-dashboard (included example file below)
 
 
# Create the openstack-dashboard database (via the sync-db command)
 
# Create the openstack-dashboard database (via the sync-db command)
 
# Run the server
 
# Run the server
  
The details of these steps are included below from the README files of each project.
+
= Get The Source =
  
 +
To prevent any interruption to our hacking, let's grab all the code that we need.
  
<pre><nowiki>#!rst
+
== Create Your Source Directory ==
  
OpenStack Dashboard
 
-------------------
 
  
The OpenStack Dashboard is a reference implementation of a Django site that
+
<pre><nowiki>
uses the Django-Nova project to provide web based interactions with the
+
$ mkdir src
OpenStack Nova cloud controller.
+
$ cd src
 +
</nowiki></pre>
  
For more information about the Django-Nova project, please visit:
 
  
  http://launchpad.net/django-nova
+
== Get django-nova ==
 +
django-nova is the reference implementation of the openstack dashboard. This module contains almost all of the real code of the website.
  
  
Getting Started
+
<pre><nowiki>
---------------
+
$ mkdir django-nova
 +
$ cd django-nova
 +
$ bzr init-repo .
 +
$ bzr branch lp:django-nova/trunk
 +
</nowiki></pre>
  
The first step is to obtain a local copy of the django-nova project:
 
  
  $ mkdir django-nova
+
You should now have a directory called trunk, which contains the reference implementation.
  $ cd django-nova
 
  $ bzr init-repo .
 
  $ bzr branch lp:django-nova/trunk
 
  
 +
== Get openstack-dashboard ==
 +
openstack-dashboard provides all the look and feel for the dashboard.
 +
 +
 +
<pre><nowiki>
 +
$ cd ..
 +
$ mkdir openstack-dashboard
 +
$ cd openstack-dashboard
 +
$ bzr init-repo .
 +
$ bzr branch lp:openstack-dashboard trunk
 +
</nowiki></pre>
  
Next we will create the virtualenv for local development. A tool is included to
 
create one for you:
 
  
  $ python tools/install_venv.py <path to django-nova/trunk>
+
You should now have a directory called trunk, which contains the [[OpenStack]] Dashboard application.
  
 +
= Build django-nova =
 +
We will now build the reference implementation that our [[OpenStack]] dashboard will use.
  
Now that the virtualenv is created, you need to configure your local
 
environment.  To do this, create a local_settings.py file in the local/
 
directory.  There is a local_settings.py.example file there that may be used
 
as a template.
 
  
Finally, issue the django syncdb command:
+
<pre><nowiki>   
 +
$ cd ../django-nova/trunk
 +
$ python bootstrap.py
 +
$ bin/buildout
 +
</nowiki></pre>
  
  $ tools/with_venv.sh dashboard/manage.py syncdb
 
  
If after you have specified the admin user the script appears to hang, it
+
These two commands (bootstrap.py and buildout) will install all the dependencies of django-nova.
probably means the installation of Nova being referred to in local_settings.py
 
is unavailable.
 
  
 +
= Build and Configure openstack-dashboard =
 +
With the reference implementation built, it is now time to configure our Openstack Dashboard application. The first step in configuring the application is to create your local_settings.py file:
  
If all is well you should now able to run the server locally:
 
  
  $ tools/with_venv.sh dashboard/manage.py runserver
+
<pre><nowiki>
 +
$ cd ../openstack-dashboard/trunk
 +
$ cd local
 +
$ cp local_settings.py.example local_settings.py
 +
$ vi local_settings.py
 +
</nowiki></pre>
  
  
OpenStack Django-Nova
+
In the local_settings.py file, we need to change three important options:
---------------------
 
  
The Django-Nova project is a Django module that is used to provide web based
+
* NOVA_DEFAULT_ENDPOINT : this needs to be set to nova-api instance URL from above. DO NOT KEEP THE DEFAULT as it contains a typo (localhoat instead of localhost). Use 'http://localhost:8773/services/Cloud' if you running the dashboard on the same machine as your nova-api
interactions with the OpenStack Nova cloud controller.
+
* NOVA_ACCESS_KEY : this should be the EC2_ACCESS_KEY in your novarc file
 +
* NOVA_SECRET_KEY : this should be the EC2_SECRET_KEY in your novarc file
  
There is a reference implementation that uses this module located at:
+
Now it's time to install the openstack-dashboard environment. This installs all the dependencies for openstack-dashboard (including the django-nova from earlier).
  
    http://launchpad.net/openstack-dashboard
 
  
It is highly recommended that you make use of this reference implementation
+
<pre><nowiki>
so that changes you make can be visualized effectively and are consistent.
+
$ sudo easy_install virtualenv
Using this reference implementation as a development environment will greatly
+
$ python tools/install_venv.py ../../django-nova/trunk
simplify development of the django-nova module.
+
</nowiki></pre>
  
Of course, if you are developing your own Django site using django-nova, then
 
you can disregard this advice.
 
  
 +
This will take a bit as it needs to download a number of dependencies from the internet.
  
 +
With that done, let's create the database:
  
Getting Started
 
---------------
 
  
Django-Nova uses Buildout (http://www.buildout.org/) to manage local
+
<pre><nowiki>
development.  To configure your local Buildout environment:
+
$ tools/with_venv.sh dashboard/manage.py syncdb
 +
</nowiki></pre>
  
  $ python bootstrap.py
 
  $ bin/buildout
 
  
This will install all the dependencies of django-nova and provide some useful
+
This will ask you a few questions:
scripts in the bin/ directory:
 
  
  bin/python provides a python shell for the current buildout.
+
<pre><nowiki>   
  bin/django provides django functions for the current buildout.
+
    You just installed Django's auth system, which means you don't have any superusers defined.
 +
    Would you like to create one now? (yes/no): *yes*
 +
    Username (Leave blank to use 'root'): *ENTER YOUR CLOUD_SERVERS_USERNAME FROM NOVARC*
 +
    E-mail address: *ENTER YOUR EMAIL ADDRESS*
 +
    Password: *MAKE UP A PASSWORD*
 +
    Password (again): *REPEAT YOUR PASSWORD*
 +
</nowiki></pre>
  
  
You should now be able to run unit tests as follows:
+
If everything goes correctly, you shouldn't see any errors.
  
  $ bin/django test
+
= Run the Server =
  
 +
Now run the built-in server at a high port so that you can view your results
  
  
 +
<pre><nowiki>
 +
    $ tools/with_venv.sh dashboard/manage.py runserver 0.0.0.0:8000
 
</nowiki></pre>
 
</nowiki></pre>
 +
 +
 +
Make sure that your firewall isn't blocking TCP/8000 and just point your browser at your server on port 8000.

Revision as of 23:55, 26 January 2011

OpenStack Dashboard

The OpenStack Dashboard is a reference implementation for the django-nova project. Both are housed on Launchpad.

Prerequisites for Running The OpenStack Dashboard

  • Running OpenStack nova instance (nova-api and nova-compute) with EC2 API enabled
  • URL of your nova-api instance (this is usually something like http://localhost:8773/services/Cloud)
  • Valid user and user credentials for nova (specifically, the username, the NOVA_ACCESS_KEY and NOVA_SECRET_KEY). These should be in your novarc file.
  • python 2.6 (not tested with python 3.0)

Installation Overview

The overall steps for building the dashboard are:

  1. Get the source for both django-nova and openstack-dashboard from launchpad
  2. Build django-nova with the boostrap script and buildout commands as shown in the dajngo-nova README
  3. Build and configure openstack-dashboard
  4. Create the openstack-dashboard database (via the sync-db command)
  5. Run the server

Get The Source

To prevent any interruption to our hacking, let's grab all the code that we need.

Create Your Source Directory

$ mkdir src
$ cd src


Get django-nova

django-nova is the reference implementation of the openstack dashboard. This module contains almost all of the real code of the website.


$ mkdir django-nova
$ cd django-nova
$ bzr init-repo .
$ bzr branch lp:django-nova/trunk


You should now have a directory called trunk, which contains the reference implementation.

Get openstack-dashboard

openstack-dashboard provides all the look and feel for the dashboard.


$ cd ..
$ mkdir openstack-dashboard
$ cd openstack-dashboard
$ bzr init-repo .
$ bzr branch lp:openstack-dashboard trunk


You should now have a directory called trunk, which contains the OpenStack Dashboard application.

Build django-nova

We will now build the reference implementation that our OpenStack dashboard will use.


    
$ cd ../django-nova/trunk
$ python bootstrap.py
$ bin/buildout


These two commands (bootstrap.py and buildout) will install all the dependencies of django-nova.

Build and Configure openstack-dashboard

With the reference implementation built, it is now time to configure our Openstack Dashboard application. The first step in configuring the application is to create your local_settings.py file:


$ cd ../openstack-dashboard/trunk
$ cd local
$ cp local_settings.py.example local_settings.py
$ vi local_settings.py


In the local_settings.py file, we need to change three important options:

  • NOVA_DEFAULT_ENDPOINT : this needs to be set to nova-api instance URL from above. DO NOT KEEP THE DEFAULT as it contains a typo (localhoat instead of localhost). Use 'http://localhost:8773/services/Cloud' if you running the dashboard on the same machine as your nova-api
  • NOVA_ACCESS_KEY : this should be the EC2_ACCESS_KEY in your novarc file
  • NOVA_SECRET_KEY : this should be the EC2_SECRET_KEY in your novarc file

Now it's time to install the openstack-dashboard environment. This installs all the dependencies for openstack-dashboard (including the django-nova from earlier).


$ sudo easy_install virtualenv
$ python tools/install_venv.py ../../django-nova/trunk


This will take a bit as it needs to download a number of dependencies from the internet.

With that done, let's create the database:


$ tools/with_venv.sh dashboard/manage.py syncdb


This will ask you a few questions:

    
    You just installed Django's auth system, which means you don't have any superusers defined.
    Would you like to create one now? (yes/no): *yes*
    Username (Leave blank to use 'root'): *ENTER YOUR CLOUD_SERVERS_USERNAME FROM NOVARC*
    E-mail address: *ENTER YOUR EMAIL ADDRESS*
    Password: *MAKE UP A PASSWORD*
    Password (again): *REPEAT YOUR PASSWORD*


If everything goes correctly, you shouldn't see any errors.

Run the Server

Now run the built-in server at a high port so that you can view your results


    $ tools/with_venv.sh dashboard/manage.py runserver 0.0.0.0:8000 


Make sure that your firewall isn't blocking TCP/8000 and just point your browser at your server on port 8000.