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

Integrate development and deployment information in distinct files

parent 7960e45f
DEPLOYMENT notes
=================
Debian
------
\ No newline at end of file
DEVELOP.txt - Information on how to setup a development environment.
Dependencies
------------
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 https://user@code.grnet.gr/git/synnefo 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.
-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
MySQL must be installed first
*Ubuntu - Debian
$sudo apt-get install libmysqlclient-dev
*MacPorts
$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';
-Postgres
#Ubuntu - Debian
$ sudo apt-get install postgresql-8.4 libpq-dev
#MacPorts
$ sudo port install postgresql84
Install the postgres Python library
$ bin/pip install psycopg2
Configure a postgres db/account for synnefo
<TODO>
3. At this point you should have a working DB. Now configure Django to access it:
Copy the default configuration file
$ cp settings.py.dist settings.py
and then edit according to the database used:
-SQLite
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
DATABASES = {
'default': {
'ENGINE': 'sqlite3', # ATTENTION: This *must* be the absolute path if using sqlite3.
'NAME': PROJECT_PATH + 'database.sqlite'
}
}
-MySQL
DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': 'synnefo',
'USER': 'USERNAME'
'PASSWORD': 'PASSWORD',
'HOST': 'HOST',
'PORT': 'PORT',
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
}
}
}
-Postgres
DATABASES = {
'default': {
'ENGINE': 'postgresql_psycopg2',
'NAME': 'DATABASE',
'USER': 'USERNAME',
'PASSWORD': 'PASSWORD',
'HOST': 'HOST',
'PORT': 'PORT',
}
}
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 manage.py sql db
5. Create the DB and (optionally) load test data
$ ./bin/python manage.py syncdb
$ ./bin/python manage.py loaddata db/fixtures/flavors.json
$ ./bin/python manage.py loaddata db/fixtures/images.json
$ ./bin/python manage.py loaddata db/fixtures/vms.json
6. Start the system
$ cd db
$ ../bin/python db_controller.py
$ cd ..
$ ./bin/python manage.py runserver
7. Done
UI Testing
----------
The functional ui tests require the Selenium server and the synnefo app to be running.
$ wget http://selenium.googlecode.com/files/selenium-server-standalone-2.0b2.jar
$ java -jar selenium-server-standalone-2.0b2.jar &
$ ./bin/python manage.py runserver &
$ ./bin/python manage.py 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 settings.py 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