Horizon is the web component of OpenStack. It is an extensible component, which means new views can be added without losing consistency in its look and feel, as it provides the necessary core classes and templates for developers to use. In this chapter, we will look at the architecture of Horizon and install it in our environment. After completing this, we will have our cloud ready and take it for a spin in the next chapter.
In this chapter, we will cover the following topics:
Horizon is a component of OpenStack that is slightly different from the others. This is a Django web application, and its sole purpose is to provide a user interface for other components of OpenStack services such as Nova and Swift.
One more thing about Horizon is that it does not actually use a database like other services, as all the information that it needs is pulled out from the other components using their respective APIs. In order to use Horizon, the use of Keystone is a must, which means we cannot use the individual authentication modules that the services themselves provide.
If you have followed the book to this point, all our services have been already authenticated using Keystone, so we can proceed. However, if we have anything that is locally authenticated, then that needs to be changed.
Let's discuss some terminologies used in the context of Horizon; this will help us in the remaining part of the chapter and also when we are either creating or modifying Horizon dashboards:
<Dashboard Name>/<Panel Name>/panel.py
file.dashboard.py
file.dashboard.py
file. Some of the dashboards installed by default are admin
, identity
, project
, and so on.tabs.py
file.<Dashboard Name>/<Panel Name>/workflows/workflow.py
.DeleteAction
and LinkAction
.tables.py
file.urls.py
file.views.py
file.Examining some of these components on the UI, as shown in the following screenshot, will give us a better understanding:
Some system requirements need to be kept in mind while installing the Horizon dashboard:
python -c "import sys; print(sys.version)" python -c "import django; print(django.get_version())"
You should be able to see the versions of Python and Django as shown here:
As you can see in our case, Python version 2.7.6 and Django version 1.6.1 are being used.
The installation is very simple; we will install the dashboard and memory cache. Let's fill in our familiar check list:
Name |
Info |
---|---|
Access to Internet |
Yes |
Proxy needed |
No |
Proxy IP and port |
Not applicable |
Node name |
|
Node IP address |
172.22.6.95 |
Node OS |
Ubuntu 14.04.1 LTS |
Keystone installed on |
172.22.6.95 |
Admin username |
|
Admin password |
|
Now run the following command:
sudo apt-get install openstack-dashboard apache2 libapache2-mod-wsgi memcached python-memcache
Ensure that the command is successful and the packages are installed successfully. This will install Horizon on our controller node.
The initial configuration of Horizon is simple as well, we need to modify a single /etc/openstack-dashboard/local_settings.py
file and configure three aspects:
Edit the previously mentioned file and set the values as:
OPENSTACK_HOST = "172.22.6.95"
: This will set OSControllerNode
for the Keystone servicesALLOWED_HOSTS = ['*']
: We are allowing all the hosts to access the Horizon dashboardCACHES
: This sets the location to 127.0.0.1 (or to localhost)You should see something like the following screenshot:
In order to finalize the installation, we restart the apache and memcached services using these commands:
sudo service apache2 restart sudo service memcached restart
This concludes the installation of the Horizon dashboard.
Once the installation has been completed, open a browser (which is HTML5-compatible and has JavaScript and cookies turned on). You can use Firefox, Google Chrome, or any up-to-date browser.
The dashboard will be available at (replace the IP with your controller node's IP address)
http://172.22.6.95/horizon/
You will need to authenticate with the admin credentials, and you should be able to log in to the dashboard:
After you've logged in, the page will look as follows:
While it is not necessary to know this, it is good to know about the structure. This helps us to make connections with the terminologies that we discussed previously, as an example. Let's see the structure of the dashboard.
You can view this yourself after you have installed Horizon, with the following instructions:
sudo apt-get install tree
cd /usr/share/openstack-dashboard/openstack_dashboard/dashboards
tree <dashboard name>
, so take a look at the settings of the dashboard:tree settings
In the preceding screenshot, you can see that we have dashboard settings and multiple panels such as user and password, and that each of them has URLs, views, and so on.