Replace URLs for workflow documentation to appropriate parts of the OpenStack Project Infrastructure Manual. Change-Id: I5ef5385a31f92ab0831e780c96b06da503106f9e
3.0 KiB
Setting Up a Development Environment
This page describes how to setup a Sahara development environment by either installing it as a part of DevStack or pointing a local running instance at an external OpenStack. You should be able to debug and test your changes without having to deploy Sahara.
Setup a Local Environment with Sahara inside DevStack
See the main article <devstack>
.
Setup a Local Environment with an external OpenStack
- Install prerequisites
On OS X Systems:
# we actually need pip, which is part of python package
$ brew install python mysql postgresql
$ pip install virtualenv tox
On Ubuntu:
$ sudo apt-get update
$ sudo apt-get install git-core python-dev python-virtualenv gcc libpq-dev libmysqlclient-dev python-pip
$ sudo pip install tox
On Fedora-based distributions (e.g., Fedora/RHEL/CentOS/Scientific Linux):
$ sudo yum install git-core python-devel python-virtualenv gcc python-pip mariadb-devel postgresql-devel
$ sudo pip install tox
On openSUSE-based distributions (SLES 12, openSUSE, Factory or Tumbleweed):
.. sourcecode:: console
$ sudo zypper in gcc git libmysqlclient-devel postgresql-devel python-devel python-pip python-tox python-virtualenv
- Grab the code:
$ git clone git://github.com/openstack/sahara.git
$ cd sahara
- Create config file from the sample:
$ cp ./etc/sahara/sahara.conf.sample-basic ./etc/sahara/sahara.conf
- Look through the sahara.conf and modify parameter values as needed.
For details see
Sahara Configuration Guide </userdoc/configuration.guide>
- Create database schema:
$ tox -e venv -- sahara-db-manage --config-file etc/sahara/sahara.conf upgrade head
- To start Sahara call:
$ tox -e venv -- sahara-all --config-file etc/sahara/sahara.conf --debug
Setup local OpenStack dashboard with Sahara plugin
../horizon/dev.environment.guide
Tips and tricks for dev environment
- Pip speedup
Add the following lines to ~/.pip/pip.conf
[global]
download-cache = /home/<username>/.pip/cache
index-url = <mirror url>
Note that the ~/.pip/cache
folder should be created
manually.
- Git hook for fast checks
Just add the following lines to .git/hooks/pre-commit and do chmod +x for it.
#!/bin/sh
# Run fast checks (PEP8 style check and PyFlakes fast static analysis)
tools/run_fast_checks
You can added the same check for pre-push, for example, run_tests and run_pylint.
- Running static analysis (PyLint)
Just run the following command
tools/run_pylint