Revision 972820a2

b/docs/_static/synnefo.nginx.conf
1
server {
2
    listen 80;
3

  
4
    server_name synnefo.local;
5
    
6
    root /var/lib/synnefo/;
7
    
8
    # serving static files 
9
    location /static  {
10
        autoindex on;
11
        root /var/lib/synnefo/;
12
    }
13

  
14
    location / {
15
        
16
        # host and port to fastcgi server
17
        fastcgi_pass 127.0.0.1:8015;
18

  
19
        fastcgi_param PATH_INFO          $fastcgi_script_name;
20
        fastcgi_param REQUEST_METHOD     $request_method;
21
        fastcgi_param QUERY_STRING       $query_string;
22
        fastcgi_param CONTENT_TYPE       $content_type;
23
        fastcgi_param CONTENT_LENGTH     $content_length;
24
        fastcgi_param SERVER_ADDR        $server_addr;
25
        fastcgi_param SERVER_PORT        $server_port;
26
        fastcgi_param SERVER_NAME        $server_name;
27
        fastcgi_param  SERVER_PROTOCOL  $server_protocol;
28
        fastcgi_pass_header Authorization;
29
        fastcgi_intercept_errors off;
30
    }
31
}
b/docs/src/ci.rst
1 1
Continuous integration with Jenkins
2
===================================
2
-----------------------------------
3 3

  
4 4
Preparing a GIT mirror
5
----------------------
5
**********************
6 6

  
7 7
Jenkins cannot currently work with Git over encrypted HTTP. To solve this
8 8
problem we currently mirror the central Git repository locally on the jenkins
......
24 24
    4,14,24,34,44,54 * * * * cd /path/to/mirror && git fetch && git remote prune origin
25 25

  
26 26
Jenkins setup
27
-------------
27
*************
28 28

  
29 29
The following instructions will setup Jenkins to run synnefo tests with the
30 30
SQLite database. To run the tests on MySQL and/or Postgres, step 5 must be
b/docs/src/configuration.rst
79 79

  
80 80
Database initialization
81 81
-----------------------
82

  
82 83
You need to initialize the Synnefo DB::
83 84

  
84 85
    $ synnefo-manage syncdb
......
106 107

  
107 108
.. _additional-configuration:
108 109

  
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

  
110
.. include settings reference
111
.. include: settings.rst
b/docs/src/deployment.rst
74 74

  
75 75
WEBAPP
76 76
******
77
Synnefo WEBAPP node is the server that runs the web application contained within
78
the synnefo package. At the current state Synnefo provides two web frontends.
77
Synnefo WEBAPP node is the server that runs the web application bundled within
78
the synnefo package. The application provides 2 different interfaces.
79

  
80

  
81
Web admin
82
`````````
83
Synnefo web administration interface. Allows administrator users to manage the
84
synnefo application via web interface.
85

  
86
Web application
87
```````````````
88
Web interface which allows users to create/configure/manage their virtual
89
machines.
90

  
91
.. _dispatcher-deploy:
92

  
93
Dispatcher
94
----------
95

  
96
The logic dispatcher is part of the Synnefo Django project and must run
97
on :ref:`LOGIC <LOGIC_NODE>` nodes.
98

  
99
The dispatcher retrieves messages from the queue and calls the appropriate
100
handler function as defined in the queue configuration in `/etc/synnefo/*.conf`
101
files.
102

  
103
The default configuration should work directly without any modifications.
104

  
105
For the time being The dispatcher must be run by hand::
106

  
107
  $ synnefo-dispatcher
108

  
109
The dispatcher should run in at least 2 instances to ensure high
110
(actually, increased) availability.
79 111

  
80 112

  
81 113
.. _webapp-deploy:
......
83 115
Web application deployment
84 116
--------------------------
85 117

  
118

  
119
.. _static-files:
120

  
121
Static files
122
************
123

  
124
* Choose an appropriate path (e.g. /var/lib/synnefo/static/) from which your web 
125
  server will serve all static files (js/css) required by Synnefo web frontend to 
126
  run.
127
* Change ``MEDIA_ROOT`` value in your settings to point to that directory.
128
* Run the following command which will create symlinks of static files in
129
  that directory::
130
    
131
    $ synnefo-manage link_static
132

  
133

  
86 134
Using Apache
87 135
************
88 136

  
......
91 139
Using nginx
92 140
***********
93 141

  
94
.. todo:: document nginx configuration
142
**Sample nginx configuration using fcgi**
143

  
144
.. literalinclude:: ../_static/synnefo.nginx.conf
95 145

  
96
Serving static files
97
********************
146
`download <../_static/synnefo.nginx.conf>`_
98 147

  
99
.. todo:: document serving static files instructions
148
run the fcgi server::
100 149

  
150
    $ synnefo-manage runfcgi host=127.0.0.1 port=8015
b/docs/src/develop.rst
66 66
   own Ganeti backend if you so wish.
67 67

  
68 68

  
69
10.As is.
69
10. As is.
70 70

  
71
11.The Synnefo Ganeti hook is already running on the development backend,
72
   sending notifications over AMQP.
71
11. The Synnefo Ganeti hook is already running on the development backend,
72
    sending notifications over AMQP.
73 73

  
74 74

  
75
12.The VNC authentication proxy is already running on the Ganeti development
76
   backend. You *cannot* run your own, unless you install your own Ganeti
77
   backend, because it needs direct access to the hypervisor's VNC port on
78
   GANETI-NODEs.
75
12. The VNC authentication proxy is already running on the Ganeti development
76
    backend. You *cannot* run your own, unless you install your own Ganeti
77
    backend, because it needs direct access to the hypervisor's VNC port on
78
    GANETI-NODEs.
79 79

  
80
   Note: You still need to install the vncauthproxy package to satisfy
81
   the dependency of the API on the vncauthproxy client. See Synnefo #807
82
   for more details.
80
    Note: You still need to install the vncauthproxy package to satisfy
81
    the dependency of the API on the vncauthproxy client. See Synnefo #807
82
    for more details.
83 83

  
84 84

  
85
13.The development Ganeti backend already has a number of OS Images available.
85
13. The development Ganeti backend already has a number of OS Images available.
86 86

  
87 87

  
88
14.The development Ganeti backend already has a number of pre-provisioned
89
   bridges available, per each BACKEND_PREFIX_ID.
88
14. The development Ganeti backend already has a number of pre-provisioned
89
    bridges available, per each BACKEND_PREFIX_ID.
90 90

  
91
   To setup simple NAT-based networking on a Ganeti backend on your own,
92
   please see the provided patches under contrib/patches/.
93
   You will need minor patches to the sample KVM ifup hook, kvm-vif-bridge,
94
   and a small patch to NFDHCPD to enable it to work with bridged tap+
95
   interfaces. To support bridged tap interfaces you also need to patch the
96
   python-nfqueue package, patches against python-nfqueue-0.3 [part of Debian
97
   Sid] are also provided under contrib/patches/.
91
    To setup simple NAT-based networking on a Ganeti backend on your own,
92
    please see the provided patches under contrib/patches/.
93
    You will need minor patches to the sample KVM ifup hook, kvm-vif-bridge,
94
    and a small patch to NFDHCPD to enable it to work with bridged tap+
95
    interfaces. To support bridged tap interfaces you also need to patch the
96
    python-nfqueue package, patches against python-nfqueue-0.3 [part of Debian
97
    Sid] are also provided under contrib/patches/.
98 98

  
99 99

  
100
15.As is.
100
15. As is.
101 101

  
102 102

  
103
16.As is.
103
16. As is.
104 104

  
105 105

  
106
17.[OPTIONAL] Create settings.d/99-local.conf and insert local overrides for
107
   settings.d/\*.  This will allow pulling new files without needing to reapply
108
   local any local modifications.
106
17. [OPTIONAL] Create settings.d/99-local.conf and insert local overrides for
107
    settings.d/\*.  This will allow pulling new files without needing to reapply
108
    local any local modifications.
109 109

  
110 110

  
111 111
South Database Migrations
112 112
-------------------------
113 113

  
114
* Initial Migration
115

  
116
First, remember to add the south app to settings.py (it is already included in
117
the settings.py.dist).
114
Initial Migration
115
*****************
118 116

  
119 117
To initialise south migrations in your database the following commands must be
120
executed:
118
executed::
121 119

  
122
    $ ./bin/python manage.py syncdb       # Create / update the database with the south tables
123
    $ ./bin/python manage.py migrate db   # Perform migration in the database
120
    $ synnefo-manage syncdb       # Create / update the database with the south tables
121
    $ synnefo-manage migrate db   # Perform migration in the database
124 122

  
125 123
Note that syncdb will create the latest models that exist in the db app, so some
126 124
migrations may fail.  If you are sure a migration has already taken place you
127 125
must use the "--fake" option, to apply it.
128 126

  
129
For example:
127
For example::
130 128

  
131
    $ ./bin/python manage.py migrate db 0001 --fake
129
    $ synnefo-manage migrate db 0001 --fake
132 130

  
133
To be sure that all migrations are applied type:
131
To be sure that all migrations are applied type::
134 132

  
135
    $ ./bin/python manage.py migrate db --list
133
    $ synnefo-manage migrate db --list
136 134

  
137 135
All starred migrations are applied.
138 136

  
......
140 138
schema. If you do not want to migrate the data, a syncdb and fake migrations for
141 139
all the migration versions will suffice.
142 140

  
143
* Schema migrations:
141
Schema migrations
142
*****************
144 143

  
145 144
Do not use the syncdb management command. It can only be used the first time
146 145
and/or if you drop the database and must recreate it from scratch. See
147 146
"Initial Migration" section.
148 147

  
149 148
Every time you make changes to the database and data migration is not required
150
(WARNING: always perform this with extreme care):
149
(WARNING: always perform this with extreme care)::
151 150

  
152
    $ ./bin/python manage.py schemamigration db --auto
151
    $ synnefo-manage schemamigration db --auto
153 152

  
154 153
The above will create the migration script. Now this must be applied to the live
155
database.
154
database::
156 155

  
157
    $ ./bin/python migrate db
156
    $ synnefo-manage migrate db
158 157

  
159
Consider this example (adding a field to the SynnefoUser model):
158
Consider this example (adding a field to the SynnefoUser model)::
160 159

  
161 160
    $ ./bin/python manage.py schemamigration db --auto
162 161
     + Added field new_south_test_field on db.SynnefoUser
163 162

  
164 163
     Created 0002_auto__add_field_synnefouser_new_south_test_field.py.
165 164

  
166
  You can now apply this migration with: ./manage.py migrate db
165
You can now apply this migration with::
167 166

  
168 167
    $ ./manage.py migrate db
169 168
     Running migrations for db:
......
176 175

  
177 176
South needs some extra definitions to the model to preserve and migrate the
178 177
existing data, for example, if we add a field in a model, we should declare its
179
default value. If not, South will propably fail, after indicating the error.
178
default value. If not, South will propably fail, after indicating the error::
180 179

  
181 180
    $ ./bin/python manage.py schemamigration db --auto
182 181
     ? The field 'SynnefoUser.new_south_field_2' does not have a default specified, yet is NOT NULL.
......
186 185
     ?  2. Specify a one-off value to use for existing columns now
187 186
     ? Please select a choice: 1
188 187

  
189
* Data migrations:
188
Data migrations
189
***************
190 190

  
191 191
If we need to do data migration as well, for example rename a field, we use the
192 192
'datamigration' management command.
......
194 194
In contrast with schemamigration, to perform complex data migration, we must
195 195
write the script manually. The process is the following:
196 196

  
197
    1. Introduce the changes in the code and fixtures (initial data).
198
    2. Execute:
197
1. Introduce the changes in the code and fixtures (initial data).
198
2. Execute::
199 199

  
200 200
    $ ./bin/python manage.py datamigration <migration_name_here>
201 201

  
202
    For example:
203

  
204
    $ ./bin/python manage.py datamigration db rename_credit_wallet
205
    Created 0003_rename_credit_wallet.py.
206

  
207
    3. We edit the generated script. It contains two methods: forwards and
208
    backwards.
202
    For example::
209 203

  
210
    For database operations (column additions, alter tables etc) we use the
211
    South database API (http://south.aeracode.org/docs/databaseapi.html).
204
        $ ./bin/python manage.py datamigration db rename_credit_wallet
205
        Created 0003_rename_credit_wallet.py.
212 206

  
213
    To access the data, we use the database reference (orm) provided as
214
    parameter in forwards, backwards method declarations in the migration
215
    script. For example:
207
3. We edit the generated script. It contains two methods: forwards and
208
   backwards.
216 209

  
217
    class Migration(DataMigration):
210
   For database operations (column additions, alter tables etc) we use the
211
   South database API (http://south.aeracode.org/docs/databaseapi.html).
218 212

  
219
    def forwards(self, orm):
220
        orm.SynnefoUser.objects.all()
213
   To access the data, we use the database reference (orm) provided as
214
   parameter in forwards, backwards method declarations in the migration
215
   script. For example::
221 216

  
222
    4. To migrate the database to the latest version, we execute:
217
        .. code-block:: python
223 218

  
224
    ./manage.py migrate db
219
            class Migration(DataMigration):
225 220

  
226
To see which migrations are applied:
221
            def forwards(self, orm):
222
                orm.SynnefoUser.objects.all()
227 223

  
228
    $ ./bin/python manage.py migrate db --list
224
    4. To migrate the database to the latest version, we execute::
229 225

  
230
      db
231
        (*) 0001_initial
232
        (*) 0002_auto__add_field_synnefouser_new_south_test_field
233
        (*) 0003_rename_credit_wallet
226
        $ synnefo-manage migrate db
234 227

  
235
More information and more thorough examples can be found in the South web site.
228
    To see which migrations are applied::
236 229

  
237
http://south.aeracode.org/
230
          $ synnefo-manage migrate db --list
238 231

  
232
          db
233
            (*) 0001_initial
234
            (*) 0002_auto__add_field_synnefouser_new_south_test_field
235
            (*) 0003_rename_credit_wallet
239 236

  
240
UI Testing
241
----------
242
The functional ui tests require the Selenium server and the synnefo app to
243
be running.
244

  
245
    $ wget http://selenium.googlecode.com/files/selenium-server-standalone-2.0b2.jar
246
    $ java -jar selenium-server-standalone-2.0b2.jar &
247
    $ ./bin/python manage.py runserver &
248
    $ ./bin/python manage.py test ui
237
.. seealso::
238
    More information and more thorough examples can be found in the South web site.
239
    http://south.aeracode.org/
249 240

  
250 241

  
251 242
Test coverage
252 243
-------------
253 244

  
254
In order to get code coverage reports you need to install django-test-coverage
245
In order to get code coverage reports you need to install django-test-coverage::
255 246

  
256 247
   $ ./bin/pip install django-test-coverage
257 248

  
258
Then edit your settings.py and configure the test runner:
249
Then edit your settings.py and configure the test runner::
259 250

  
260 251
   TEST_RUNNER = 'django-test-coverage.runner.run_tests'
261 252

  
262 253

  
263 254
.. include:: i18n.rst
264 255

  
256

  
265 257
Building Synnefo package
266 258
------------------------
267 259

  
......
269 261

  
270 262
    $ python setup.py sdist
271 263

  
272
this command will create a ``tar.gz`` python source package using
273
the version number provided in ``setup.py``.
264
this command will create a ``tar.gz`` python source package inside ``dist`` directory.
265

  
274 266

  
275 267
Building Synnefo documentation
276 268
------------------------------
......
283 275
    $ make html
284 276

  
285 277
html files are generated in ``docs/_build/html`` directory
278

  
279
.. include:: ci.rst
b/docs/src/i18n.rst
10 10
then we add on the settings.py the language code e.g.,
11 11

  
12 12
     LANGUAGES = (
13
      ('el', u'Ελληνικά'),
14
      ('en', 'English'),)
13
      ('el', u'Greek'),
14
      ('en', u'English'),)
15 15

  
16 16
1) For each language we want to add, we run makemessages, from our project's
17 17
   base:
......
52 52
   This compiles the po files to mo. Our strings will appear translated once we 
53 53
   change the language (eg from a dropdown menu in the page)
54 54

  
55
More info:
56
http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
55
.. seealso::
56
    http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
57 57

  

Also available in: Unified diff