Statistics
| Branch: | Tag: | Revision:

root / docs / src / configuration.rst @ ceded986

History | View | Annotate | Download (3.2 kB)

1
.. _configuration:
2

    
3
Configuration
4
=============
5

    
6
Customizing Synnefo settings
7
----------------------------
8

    
9
Synnefo package bundles a `Django` project with predefined common `settings` 
10
and `urls` set. The corresponding `Django` ``manage.py`` for the bundled project is 
11
``synnefo-manage`` which after the package installation should be available as a
12
command from your system's terminal.
13

    
14
To ease up the configuration of the application Synnefo includes settings
15
defined in ``/etc/synnefo/*.conf`` files.
16

    
17

    
18
.. _database-configuration:
19

    
20
Database configuration
21
----------------------
22

    
23
Add the following to your custom settings.py, depending on your choice
24
of DB:
25

    
26
SQLite
27
******
28
.. code-block:: python
29

    
30
    DATABASES = {
31
        'default': {
32
            'ENGINE': 'django.db.backends.sqlite3',
33
            'NAME': '/path/to/synnefo.db'
34
        }
35
    }
36

    
37
.. warning:: `NAME` must be an absolute path to the sqlite3 database file
38

    
39
MySQL
40
*****
41
.. code-block:: python
42

    
43
    DATABASES = {
44
         'default': {
45
             'ENGINE': 'django.db.backends.mysql',
46
             'NAME': 'synnefo',
47
             'USER': 'USERNAME',
48
             'PASSWORD': 'PASSWORD',
49
             'HOST': 'HOST',
50
             'PORT': 'PORT',
51
             'OPTIONS': {
52
                 'init_command': 'SET storage_engine=INNODB',
53
             }
54
        }
55
    }
56

    
57
PostgreSQL
58
**********
59
.. code-block:: python
60

    
61
    DATABASES = {
62
         'default': {
63
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
64
             'NAME': 'DATABASE',
65
             'USER': 'USERNAME',
66
             'PASSWORD': 'PASSWORD',
67
             'HOST': 'HOST',
68
             'PORT': 'PORT',
69
         }
70
    }
71

    
72
Try it out. The following command will attempt to connect to the DB and
73
print out DDL statements. It should not fail::
74

    
75
    $ synnefo-manage sql db
76

    
77

    
78
.. _database-initialization:
79

    
80
Database initialization
81
-----------------------
82
You need to initialize the Synnefo DB::
83

    
84
    $ synnefo-manage syncdb
85
    $ synnefo-manage migrate
86

    
87
and load fixtures {users,flavors,images}, 
88
which make the API usable by end users by defining a sample set of users, 
89
hardware configurations (flavors) and OS images::
90

    
91
    $ synnefo-manage loaddata /path/to/users.json
92
    $ synnefo-manage loaddata flavors
93
    $ synnefo-manage loaddata images
94

    
95
.. warning:: 
96
    Be sure to load a custom users.json and select a unique token 
97
    for each of the initial and any other users defined in this file. 
98
    **DO NOT LEAVE THE SAMPLE AUTHENTICATION TOKENS** enabled in deployed
99
    configurations.
100

    
101
sample users.json file:
102

    
103
.. literalinclude:: ../../synnefo/db/fixtures/users.json
104
    :language: json
105

    
106
`download <../_static/users.json>`_
107

    
108
.. _additional-configuration:
109

    
110
Additional configuration
111
************************
112

    
113
The logic dispatcher is part of the Synnefo Django project and must run
114
on LOGIC nodes.
115

    
116
The dispatcher retrieves messages from the queue and calls the appropriate
117
handler function as defined in the queue configuration in `/etc/synnefo/*.conf'
118
files.
119

    
120
The default configuration should work directly without any modifications.
121

    
122
For the time being The dispatcher must be run by hand::
123

    
124
  $ synnefo-dispatcher
125

    
126
The dispatcher should run in at least 2 instances to ensure high
127
(actually, increased) availability.
128