Commit 1131962f authored by Georgios Gousios's avatar Georgios Gousios
Browse files

Integrate development and deployment information in distinct files

parent 7960e45f
\ No newline at end of file
DEVELOP.txt - Information on how to setup a development environment.
Synnefo depends on the following Python modules
- django
- django-piston
- simplejson
- selenium
- pyzmq-static
also, depending on the database engine of choice, on one of the following:
- MySQL-python
- psycopg2
Preparing the development environment
1. Prepare the system
The easiest method is to setup a working environment through virtualenv.
Alternatively, you can use your system's package manager to install
the dependencies (e.g. Macports has them all).
*On Snow Leopard, you have to set the following environment variable for
pip to compile the dependencies correctly.
$export ARCHFLAGS="-arch x86_64"
*On Ubuntu, a few more packages must be isntalled before installing the
prerequisite Python libraries
$sudo aptitude install libcurl3-gnutls libcurl3-gnutls-dev uuid-dev
2. Checkout the code and install the Python prerequisites. This assumes
that python is already installed on the host.
$ sudo easy_install virtualenv
$ git clone synnefo
$ virtualenv --python=python2.6 synnefo --no-site-packages
$ cd synnefo
$ ./bin/pip install django django-piston pycurl simplejson selenium pyzmq-static
2. At this point you should have all required dependencies installed. Now you
have to select a database engine. The choices are: postgres, mysql and sqlite.
The python sqlite driver is available by default with Python so no additional
configuration is required. Also, most self-respecting systems have the sqlite
library installed by default.
MySQL must be installed first
*Ubuntu - Debian
$sudo apt-get install libmysqlclient-dev
$sudo port install mysql5
Install the MySQL python library
$ bin/pip install MySQL-python
Note: On MacOSX with Mysql install from MacPorts the above command will fail
complaining that it cannot find the mysql_config command. Do the following and
restart the installation
$ echo "mysql_config = /opt/local/bin/mysql_config5" >> ./build/MySQL-python/site.cfg
Configure a MySQL db/account for synnefo
$ mysql -u root -p
mysql> create database synnefo;
mysql> show databases;
mysql> GRANT ALL on synnefo.* TO username IDENTIFIED BY 'password';
#Ubuntu - Debian
$ sudo apt-get install postgresql-8.4 libpq-dev
$ sudo port install postgresql84
Install the postgres Python library
$ bin/pip install psycopg2
Configure a postgres db/account for synnefo
3. At this point you should have a working DB. Now configure Django to access it:
Copy the default configuration file
$ cp
and then edit according to the database used:
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
'default': {
'ENGINE': 'sqlite3', # ATTENTION: This *must* be the absolute path if using sqlite3.
'NAME': PROJECT_PATH + 'database.sqlite'
'default': {
'ENGINE': 'mysql',
'NAME': 'synnefo',
'init_command': 'SET storage_engine=INNODB',
'default': {
'ENGINE': 'postgresql_psycopg2',
4. Try it out. The following command will attempt to connec to the DB and
print out DDL statements. It should not fail.
$ ./bin/python sql db
5. Create the DB and (optionally) load test data
$ ./bin/python syncdb
$ ./bin/python loaddata db/fixtures/flavors.json
$ ./bin/python loaddata db/fixtures/images.json
$ ./bin/python loaddata db/fixtures/vms.json
6. Start the system
$ cd db
$ ../bin/python
$ cd ..
$ ./bin/python runserver
7. Done
UI Testing
The functional ui tests require the Selenium server and the synnefo app to be running.
$ wget
$ java -jar selenium-server-standalone-2.0b2.jar &
$ ./bin/python runserver &
$ ./bin/python test ui
Test coverage
In order to get code coverage reports you need to install django-test-coverage
$ ./bin/pip install django-test-coverage
Then edit your and configure the test runner:
TEST_RUNNER = 'django-test-coverage.runner.run_tests'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment