Updates related to the move to /contrib which happened during the L cycle. Change-Id: I564241ea20b5ef966a4e7458a7c62f6457abb081 Partial-Bug: #1490687
5.8 KiB
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 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/contrib/sahara/content/data_processing
where $DEST/
is usually /opt/stack/
.
Isolated Dashboard for Sahara
- These installation steps serve two purposes:
-
- Setup a dev environment
- 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:
$ keystone endpoint-list
You can list the registered services with this command:
$ keystone service-list
- Install prerequisites
$ 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:
$ sudo apt-get install nodejs-legacy
- Checkout Horizon from git and switch to your version of OpenStack
Here is an example:
$ git clone https://github.com/openstack/horizon
Then install the virtual environment:
$ python tools/install_venv.py
- Create a
local_settings.py
file
$ cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
- Modify
openstack_dashboard/local/local_settings.py
Set the proper values for host and url variables:
= "ip of your controller" OPENSTACK_HOST
If you are using Nova-Network with
auto_assign_floating_ip=True
add the following parameter:= True SAHARA_AUTO_IP_ALLOCATION_ENABLED
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.
$ 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.
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.
Debug mode can be disabled by changing
DEBUG=True
toFalse
inlocal_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
Note It is not recommended to use Horizon in this mode for production.
- Applying changes
If you have changed any
*.py
files inhorizon/openstack_dashboard/contrib/sahara/content/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.
Modify
openstack_dashboard/contrib/sahara/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.= "http://localhost:8386/v1.1" SAHARA_URL def get_sahara_url(request): if SAHARA_URL: = SAHARA_URL.rstrip('/') url if url.split('/')[-1] in ['v1.0', 'v1.1']: = SAHARA_URL + '/' + request.user.tenant_id url return url return base.url_for(request, SAHARA_SERVICE)
After that modify
sahara_url
provided indef client(request):
=get_sahara_url(request) sahara_url
Modify
openstack_dashboard/dashboards/project/dashboard.py
:Overload the
register
method inclass Project
to programmatically removedata-processing
permissions from all panels.@classmethod def register(cls, panel): if hasattr(panel, 'permissions'): = tuple( panel.permissions for perm in panel.permissions if not perm.startswith( [perm 'openstack.services.data-processing')]) super(Project, cls).register(panel)
Alternatively the
data-processing
permissions can be removed manually from each panel underopenstack_dashboard/contrib/sahara/content/data_processing