sahara/doc/source/horizon/dev.environment.guide.rst

4.2 KiB

Sahara UI Dev Environment Setup

Install as a part of DevStack

The easiest way to have local Sahara UI environment with DevStack is to include Sahara component in DevStack.

../devref/devstack

After Sahara installation as a part of DevStack Horizon will contain Sahara tab. Sahara dashboard source code will be located at $DEST/sahara_dashboard which is usually /opt/stack/sahara_dashboard.

Isolated Dashboard for Sahara

These installation steps suite for two purposes:
  • to setup dev environment
  • to setup isolated Dashboard for Sahara

Note that the host where you're going to perform installation has to be able to connected to all OpenStack endpoints. You can list all available endpoints using the following command:

$ keystone endpoint-list
  1. Install prerequisites
$ sudo apt-get update
$ sudo apt-get install git-core python-dev gcc python-setuptools python-virtualenv node-less libssl-dev

On Ubuntu 12.10 and higher you have to install the following lib as well:

$ sudo apt-get install nodejs-legacy

2. Checkout Horizon from git and switch to your version of OpenStack (stable/grizzly or stable/folsom). Here is an example for grizzly:

$ git clone https://github.com/openstack/horizon -b stable/grizzly

Then install virtual environment:

$ python tools/install_venv.py
  1. Create local_settings.py file:
$ cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
  1. Open file openstack_dashboard/local/local_settings.py and uncomment strings:
from horizon.utils import secret_key
SECRET_KEY = secret_key.generate_or_read_....

and set right value for variables:

OPENSTACK_HOST = "ip of your controller"
SAHARA_URL = "url for sahara (e.g. "http://localhost:8386/v1.1")"

If you are using Neutron instead of Nova Network:

SAHARA_USE_NEUTRON = True

If you are not using nova-network with auto_assign_floating_ip=True, also set:

AUTO_ASSIGNMENT_ENABLED = False
  1. Clone sahara-dashboard sources from https://github.com/openstack/sahara-dashboard.git
$ git clone https://github.com/openstack/sahara-dashboard.git
  1. Export SAHARA_DASHBOARD_HOME environment variable with path to sahara-dashboard folder. E.g.:
$ export SAHARA_DASHBOARD_HOME=$(pwd)/sahara-dashboard
  1. Install sahara-dashboard module to horizon's venv. Go to horizon folder and execute:
$ .venv/bin/pip install $SAHARA_DASHBOARD_HOME
  1. Create a symlink to sahara-dashboard source
$ ln -s $SAHARA_DASHBOARD_HOME/saharadashboard .venv/lib/python2.7/site-packages/saharadashboard
  1. In openstack_dashboard/settings.py add sahara to
HORIZON_CONFIG = {
    'dashboards': ('nova', 'syspanel', 'settings', 'sahara'),

and add saharadashboard to

INSTALLED_APPS = (
    'saharadashboard',
    ....
  1. Start horizon
$ tools/with_venv.sh python manage.py runserver 0.0.0.0:8080

This will start horizon in debug mode. That means the logs will be written to console, and if any exceptions happen, you will see the stack-trace rendered as a web-page.

The debug could be disabled by changing DEBUG=True to False in local_settings.py. In that case Horizon should be started slightly differently, otherwise it will not serve static files:

$ tools/with_venv.sh  python manage.py runserver --insecure 0.0.0.0:8080

It is not recommended to use horizon in this mode for production.

  1. Applying changes

If you have changed any *.py files in $SAHARA_DASHBOARD_HOME directory, horizon will notice that and reload automatically. However changes made to non-python files may not be noticed, so you have to restart horizon again manually, as described in step 10.