Statistics
| Branch: | Tag: | Revision:

root / docs / src / configuration.rst @ c469ca86

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

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

    
107
.. _additional-configuration:
108

    
109
Additional configuration
110
************************
111

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

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

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

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

    
123
  $ synnefo-dispatcher
124

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