Jump to: navigation, search

OpenStackDashboard

Revision as of 23:44, 15 July 2011 by Michael (talk)

OpenStack Dashboard

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

To view a quick video tour of the dashboard in action, please see this blog post.

You can also view a more recent demo at http://vimeo.com/20787736.

Prerequisites for Running The OpenStack Dashboard

  • python 2.6 (not tested with python 3.0)
  • 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 nova admin user name and user credentials (specifically, the username, the NOVA_ACCESS_KEY and NOVA_SECRET_KEY). These should be in your novarc file (where they are called EC2_ACCESS_KEY and EC2_SECRET_KEY) but also can be found in the nova database. You can find instructions for this at RunningNova.

These instructions have only been tested on Ubuntu 10.10 server.

Installation Overview

The overall steps for building the dashboard are:

  1. Get the source for openstack-dashboard from Launchpad
  2. Build and configure openstack-dashboard
  3. Create the openstack-dashboard database (via the syncdb command)
  4. Run the server

These instructions are for a test openstack-dashboard deployment. They configure your dashboard to use a sqlite3 database and the default django server. To create a more robust installation, you should configure this with an Apache webserver and MySQL/Postgres database.

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 openstack-dashboard

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


$ git clone https://github.com/4P/openstack-dashboard

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

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/local
$ cp local_settings.py.example local_settings.py
$ vi local_settings.py

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

  • NOVA_DEFAULT_ENDPOINT : this needs to be set to nova-api instance URL from above. Keep the default ('http://localhost:8773/services/Cloud') if you are running the dashboard on the same machine as your nova-api.
  • NOVA_DEFAULT_REGION : this can remain 'nova'
  • 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.
  • NOVA_ADMIN_USER: this can be any user with admin privileges in your nova database. The CLOUD_SERVERS_USERNAME from your admin credentials file is fine.
  • NOVA_PROJECT: this can be any project (defined in your nova database) which the NOVA_ADMIN_USER is defined as project_manager. Refer to RunningNova for assistance if you haven't defined any nova projects.

Now it's time to install the openstack-dashboard environment. This installs all the dependencies for openstack-dashboard.


$ apt-get install -y python-setuptools
$ cd ..
$ sudo easy_install virtualenv
$ python tools/install_venv.py

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 (follow the instructions within the * * to answer the 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 NOVA_USERNAME (The name of the Nova admin user you created) 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. If you get permission denied errors, you may have a project error - try creating a project named 'dashboard' with your user as admin:

$ sudo nova-manage project create dashboard YOUR_ADMIN_USER

Before you can retry, you should probably clear the existing database:

$ rm local/dashboard_openstack.sqlite3


A successful run looks something like this (my dashboard is on the same machine as my nova installation):


$ tools/with_venv.sh dashboard/manage.py syncdb
/home/kpepple/src/dashboard/django-nova/trunk/src/django_nova/models.py:25: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_admin_log
Creating table django_content_type
Creating table django_session
Creating table django_comments
Creating table django_comment_flags
Creating table django_site
Creating table django_nova_credentialsauthorization
Creating table registration_registrationprofile

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 'kpepple'): kpepple
E-mail address: nospam@nospam.com
Password:
Password (again):
DEBUG:boto:using calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova
DEBUG:boto:string_to_sign: GET
localhost:8773
/services/Admin/
AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: NoFDLWwN0Y6Ytety/N2fg3DuLfHpXVvaD8f5esKJSkE=
DEBUG:boto:Canonical: GET


Sun, 30 Jan 2011 21:45:08 GMT
/services/Admin/services/Admin/
DEBUG:boto:Method: GET
DEBUG:boto:Path: /services/Admin/?AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova&Signature=NoFDLWwN0Y6Ytety/N2fg3DuLfHpXVvaD8f5esKJSkE%3D
DEBUG:boto:Data:
DEBUG:boto:Headers: {'Date': 'Sun, 30 Jan 2011 21:45:08 GMT', 'Content-Length': '0', 'Authorization': 'AWS c593c0ce-b72a-4033-a705-b215bb9bea26:IRT:cL1g13ps8Qe/gL1G9GvkRaFzuUg=', 'User-Agent': 'Boto/1.9b (linux2)'}
DEBUG:boto:Host: None
DEBUG:boto:establishing HTTP connection
DEBUG:boto:<?xml version="1.0" ?><DescribeUserResponse xmlns="http://ec2.amazonaws.com/doc/nova/"><requestId>ES1SL094MSGUKJ7Y8RZ2</requestId><username>kpepple</username><secretkey>f1fa0acc-15f0-4bb2-ad07-06c322880e6d</secretkey><accesskey>c593c0ce-b72a-4033-a705-b215bb9bea26</accesskey><file/></DescribeUserResponse>
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Group_permissions model
Installing index for auth.User_user_permissions model
Installing index for auth.User_groups model
Installing index for auth.Message model
Installing index for admin.LogEntry model
Installing index for comments.Comment model
Installing index for comments.CommentFlag model
No fixtures found.

If you receive errors in this step, check your nova-api.log file (usually /var/log/nova/nova-api.log) for clues. Most likely you are having a mismatch between your username, access keys and project settings.

Run the Server

Now run the built-in server at an unprivileged 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 this server on port 8000. If you are running the server on the same machine as your browser, this would be "http://localhost:8000".

Configuring the VNC Console

Note: Tested only with KVM but should work with other hypervisors.

In the same /src directory as your Dashboard is housed, get a copy of noVNC.


cd ~/src
git clone https://github.com/openstack/noVNC.git


Next, run the vncproxy by creating a new screen window with <ctrl>-a <ctrl>-c.

You should run vncproxy with a pointer to the flag file as well:


bin/nova-vncproxy --vncproxy_wwwroot ~/src/noVNC --flagfile=/path/to/flagfile


To your nova.conf, you also need to add the flag: --vncproxy_url=http://<ip of vnc proxy>:6080

Now your VNC button should launch a VNC window so that you can access the instance.