To build a reference dashboard you must use the two projects together. Here are the overall steps for building the dashboard.
Get the source for both django-nova and openstack-dashboard.
Optionally, build django-nova with the bootstrap script and build-out commands as shown.
Build and configure the openstack-dashboard.
-
Create the openstack-dashboard database with the syncdb command.
-
Run the server that starts the dashboard.
Before you begin, you must have bazaar installed. It's straightforward to install
it with sudo apt-get install bzr.
Create a source directory to house both projects:
mkdir src cd src
Next, get the source for the django-nova project. This project contains the code for the website.
mkdir django-nova cd django-nova bzr init-repo . bzr branch lp:django-nova/trunk
If you see a message saying "You have not informed bzr of your Launchpad ID..." you can ignore that if you do not want to make changes to the code for now.
You now have a directory named trunk containing the reference implementation.
Next, move up a directory and get the code for the Openstack-Dashboard project, which provides all the look and feel for the dashboard and is a reference implementation of the django-nova project.
cd .. mkdir openstack-dashboard cd openstack-dashboard bzr init-repo . bzr branch lp:openstack-dashboard trunk
You now have a directory named trunk containing the dashboard application as well as code for the look and feel.
If you want to develop upon or modify the inner workings of django-nova, you'll want to build this reference implementation. If not, proceed to building the OpenStack Dashboard itself.
Here is how you build the reference implementation that the dashboard uses:
cd ../django-nova/trunk python bootstrap.py bin/buildout
These two commands (bootstrap.py and buildout) install all the dependencies of django-nova.
Next we will create the virtualenv for local development. A tool is included in the openstack-dashboard project to create one for you. Switch to the /src/openstack-dashboard/trunk directory and then enter:
python tools/install_venv.py [path to django-nova/trunk]
If you find that virtualenv is not installed, you can use easy_install
virtualenv to install it and then re-run the python command.
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. You configure local_settings.py in the next section.
Now you can configure the dashboard application. The first step in configuring the application is to create your local_settings.py file. An example is provided that you can copy to local_settings.py and then modify for your environment.
cd ../openstack-dashboard/trunk cd local cp local_settings.py.example local_settings.py vi local_settings.py
In the new copy of the local_settings.py file, change these important options:
NOVA_DEFAULT_ENDPOINT : this needs to be set to nova-api instance URL from above. You can use 'http://localhost:8773/services/Cloud' if you plan to view the dashboard on the same machine as your nova-api.
NOVA_ACCESS_KEY : this should be the EC2_ACCESS_KEY in your novarc file (which includes the project name).
NOVA_SECRET_KEY : this should be the EC2_SECRET_KEY in your novarc file.
If you are using an admin user that is named something other than "admin", add the following two options to the local_settings.py file. In this example, the admin user is named "osadmin".
-
NOVA_ADMIN_USER = 'osadmin'
-
NOVA_PROJECT = 'osadmin'
One additional option is available in the local_settings.py file, the default region. This can be set to anything, but is set to nova by default.
-
NOVA_DEFAULT_REGION = 'nova'
Now install the openstack-dashboard environment. This installs all the dependencies for openstack-dashboard (including the django-nova from earlier). If you don't already have easy_install installed, use sudo apt-get install python-setuptools.
sudo easy_install virtualenv python tools/install_venv.py ../../django-nova/trunk
This step takes some time since it downloads a number of dependencies.
Once the download completes, create the database and insert the credentials for your Nova user:
tools/with_venv.sh dashboard/manage.py syncdb
Midway through the script, you are asked, "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):" Answer Yes, and insert these values as shown:
Username (Leave blank to use 'root'): *ENTER YOUR NOVA_ADMIN-LEVEL_USERNAME FROM NOVARC* E-mail address: *ENTER YOUR EMAIL ADDRESS* Password: *MAKE UP A PASSWORD* Password (again): *REPEAT YOUR PASSWORD*
Once this configuration is complete, you should be returned to the prompt with no errors. If you get 403 errors, it probably means the user is undefined. Check the nova-api log file (typically /var/log/nova/nova-api.log) for specifics.
Now run the built-in server on a high port value so that you can validate the installation.
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".
