Difference between revisions of "OpenStackDashboard"
Line 12: | Line 12: | ||
* URL of your nova-api instance (this is usually something like http://localhost:8773/services/Cloud) | * 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]]. | * 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]]. | ||
+ | * A user named "admin" and a project named "admin" in the nova database. Again, you can find instructions for this at [[RunningNova]]. | ||
These instructions have only been tested on Ubuntu 10.10 server. | These instructions have only been tested on Ubuntu 10.10 server. |
Revision as of 00:21, 31 January 2011
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.
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.
- A user named "admin" and a project named "admin" in the nova database. Again, 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:
- Get the source for both django-nova and openstack-dashboard from launchpad
- (OPTIONAL) Build django-nova with the boostrap script and buildout commands as shown in the dajngo-nova README
- Build and configure openstack-dashboard
- Create the openstack-dashboard database (via the syncdb command)
- 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 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 (OPTIONAL)
If you want to develop or modify the inner workings of django-nova, complete this step. If not, proceed to the next step.
We will now build the reference implementation that our OpenStack Dashboard will use.
$ cd ../django-nova/ $ 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 are 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).
$ cd .. $ 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 (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 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. 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 you 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".