5faa22168d
Sahara is changing the endpoint name from data_processing to data-processing. The Sahara docs are updated here to reflect this change. Change-Id: Ide6c216f939964621bdea29c5588f83c49aad103 Partial-bug: #1356053
192 lines
5.8 KiB
ReStructuredText
192 lines
5.8 KiB
ReStructuredText
Sahara UI Dev Environment Setup
|
|
===============================
|
|
|
|
This page describes how to setup Horizon for developing Sahara by either
|
|
installing it as part of DevStack with Sahara or installing it in an isolated environment
|
|
and running from the command line.
|
|
|
|
Install as a part of DevStack
|
|
-----------------------------
|
|
|
|
See the `DevStack guide <../devref/devstack.html>`_ for more information
|
|
on installing and configuring DevStack with Sahara.
|
|
|
|
After Horizon installation, it will contain a Data Processing tab under Projects tab.
|
|
Sahara UI source code will be located at
|
|
``$DEST/horizon/openstack_dashboard/dashboards/project/data_processing``
|
|
where ``$DEST/`` is usually ``/opt/stack/``.
|
|
|
|
Isolated Dashboard for Sahara
|
|
-----------------------------
|
|
|
|
These installation steps serve two purposes:
|
|
1. Setup a dev environment
|
|
2. Setup an isolated Dashboard for Sahara
|
|
|
|
**Note** The host where you are going to perform installation has to be able
|
|
to connect to all OpenStack endpoints. You can list all available endpoints
|
|
using the following command:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ keystone endpoint-list
|
|
|
|
You can list the registered services with this command:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ keystone service-list
|
|
|
|
1. Install prerequisites
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ sudo apt-get update
|
|
$ sudo apt-get install git-core python-dev gcc python-setuptools python-virtualenv node-less libssl-dev libffi-dev libxslt-dev
|
|
..
|
|
|
|
On Ubuntu 12.10 and higher you have to install the following lib as well:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ sudo apt-get install nodejs-legacy
|
|
..
|
|
|
|
2. Checkout Horizon from git and switch to your version of OpenStack
|
|
|
|
Here is an example:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ git clone https://github.com/openstack/horizon
|
|
..
|
|
|
|
Then install the virtual environment:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ python tools/install_venv.py
|
|
..
|
|
|
|
3. Create a ``local_settings.py`` file
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
|
|
..
|
|
|
|
4. Modify ``openstack_dashboard/local/local_settings.py``
|
|
|
|
Set the proper values for host and url variables:
|
|
|
|
.. sourcecode:: python
|
|
|
|
OPENSTACK_HOST = "ip of your controller"
|
|
..
|
|
|
|
If you are using Nova-Network with ``auto_assign_floating_ip=True`` add the following parameter:
|
|
|
|
.. sourcecode:: python
|
|
|
|
SAHARA_AUTO_IP_ALLOCATION_ENABLED = True
|
|
..
|
|
|
|
5. If Sahara is not registered with the keystone service catalog, it may be added
|
|
with the following commands. To use Sahara from Horizon without keystone
|
|
registration, see `Using the Data Processing Dashboard without Keystone Registration`_.
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ keystone service-create --name sahara --type data-processing
|
|
$ keystone endpoint-create --region RegionOne --service sahara --publicurl 'http://localhost:8386/v1.1/%(tenant_id)s'
|
|
|
|
**Note** you should replace the ip and port in with the appropriate values.
|
|
|
|
6. Start Horizon
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ 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.
|
|
|
|
Debug mode can 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:
|
|
|
|
.. sourcecode:: console
|
|
|
|
$ tools/with_venv.sh python manage.py runserver --insecure 0.0.0.0:8080
|
|
..
|
|
|
|
**Note** It is not recommended to use Horizon in this mode for production.
|
|
|
|
7. Applying changes
|
|
|
|
If you have changed any ``*.py`` files in
|
|
``horizon/openstack_dashboard/dashboards/project/data_processing`` 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 6.
|
|
|
|
Using the Data Processing Dashboard without Keystone Registration
|
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
**Note** These modifications are strictly for a development environment
|
|
|
|
If Sahara is not registered as a service with keystone, Horizon must be
|
|
modified so that the Sahara URL can be known and so service-based
|
|
permissions do not prevent the Data Processing dashboard from displaying.
|
|
|
|
|
|
1. Modify ``openstack_dashboard/api/sahara.py``:
|
|
|
|
Add the following lines before ``def client(request)``:
|
|
|
|
**Note** you should replace the ip and port in ``SAHARA_URL`` with the
|
|
appropriate values.
|
|
|
|
.. sourcecode:: python
|
|
|
|
SAHARA_URL = "http://localhost:8386/v1.1"
|
|
|
|
def get_sahara_url(request):
|
|
|
|
if SAHARA_URL:
|
|
url = SAHARA_URL.rstrip('/')
|
|
if url.split('/')[-1] in ['v1.0', 'v1.1']:
|
|
url = SAHARA_URL + '/' + request.user.tenant_id
|
|
return url
|
|
|
|
return base.url_for(request, SAHARA_SERVICE)
|
|
..
|
|
|
|
After that modify ``sahara_url`` provided in ``def client(request):``
|
|
|
|
.. sourcecode:: python
|
|
|
|
sahara_url=get_sahara_url(request)
|
|
..
|
|
|
|
|
|
2. Modify ``openstack_dashboard/dashboards/project/dashboard.py``:
|
|
|
|
Overload the ``register`` method in ``class Project`` to programmatically
|
|
remove ``data-processing`` permissions from all panels.
|
|
|
|
.. sourcecode:: python
|
|
|
|
@classmethod
|
|
def register(cls, panel):
|
|
if hasattr(panel, 'permissions'):
|
|
panel.permissions = tuple(
|
|
[perm for perm in panel.permissions if not perm.startswith(
|
|
'openstack.services.data_processing')])
|
|
super(Project, cls).register(panel)
|
|
..
|
|
|
|
Alternatively the ``data-processing`` permissions can be removed
|
|
manually from each panel under ``openstack_dashboard/dashboards/project/data_processing``
|