Statistics
| Branch: | Tag: | Revision:

root / docs / admin-guide.rst @ 90e7da53

History | View | Annotate | Download (66.2 kB)

1
.. _admin-guide:
2

    
3
Synnefo Administrator's Guide
4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5

    
6
This is the complete Synnefo Administrator's Guide.
7

    
8

    
9
.. _syn+archip:
10

    
11
General Synnefo Architecture
12
============================
13

    
14
The following figure shows a detailed view of the whole Synnefo architecture
15
and how it interacts with multiple Ganeti clusters. We hope that after reading
16
the Administrator's Guide you will be able to understand every component and
17
all the interactions between them.
18

    
19
.. image:: images/synnefo-arch2.png
20
   :width: 100%
21
   :target: _images/synnefo-arch2.png
22

    
23
Synnefo also supports RADOS as an alternative storage backend for
24
Files/Images/VM disks. You will find the :ref:`corresponding figure
25
<syn+archip+rados>` later in this guide.
26

    
27

    
28
Identity Service (Astakos)
29
==========================
30

    
31

    
32
Authentication methods
33
----------------------
34

    
35
Astakos supports multiple authentication methods:
36

    
37
 * local username/password
38
 * LDAP / Active Directory
39
 * SAML 2.0 (Shibboleth) federated logins
40
 * Google
41
 * Twitter
42
 * LinkedIn
43

    
44
.. _shibboleth-auth:
45

    
46
Shibboleth Authentication
47
~~~~~~~~~~~~~~~~~~~~~~~~~
48

    
49
Astakos can delegate user authentication to a Shibboleth federation.
50

    
51
To setup shibboleth, install package::
52

    
53
  apt-get install libapache2-mod-shib2
54

    
55
Change appropriately the configuration files in ``/etc/shibboleth``.
56

    
57
Add in ``/etc/apache2/sites-available/synnefo-ssl``::
58

    
59
  ShibConfig /etc/shibboleth/shibboleth2.xml
60
  Alias      /shibboleth-sp /usr/share/shibboleth
61

    
62
  <Location /ui/login/shibboleth>
63
    AuthType shibboleth
64
    ShibRequireSession On
65
    ShibUseHeaders On
66
    require valid-user
67
  </Location>
68

    
69
and before the line containing::
70

    
71
  ProxyPass        / http://localhost:8080/ retry=0
72

    
73
add::
74

    
75
  ProxyPass /Shibboleth.sso !
76

    
77
Then, enable the shibboleth module::
78

    
79
  a2enmod shib2
80

    
81
After passing through the apache module, the following tokens should be
82
available at the destination::
83

    
84
  eppn # eduPersonPrincipalName
85
  Shib-InetOrgPerson-givenName
86
  Shib-Person-surname
87
  Shib-Person-commonName
88
  Shib-InetOrgPerson-displayName
89
  Shib-EP-Affiliation
90
  Shib-Session-ID
91

    
92
Finally, add 'shibboleth' in ``ASTAKOS_IM_MODULES`` list. The variable resides
93
inside the file ``/etc/synnefo/20-snf-astakos-app-settings.conf``
94

    
95
Twitter Authentication
96
~~~~~~~~~~~~~~~~~~~~~~
97

    
98
To enable twitter authentication while signed in under a Twitter account,
99
visit dev.twitter.com/apps.
100

    
101
Click Create an application.
102

    
103
Fill the necessary information and for callback URL give::
104

    
105
    https://node1.example.com/ui/login/twitter/authenticated
106

    
107
Finally, add 'twitter' in ``ASTAKOS_IM_MODULES`` list. The variable resides
108
inside the file ``/etc/synnefo/20-snf-astakos-app-settings.conf``
109

    
110
Google Authentication
111
~~~~~~~~~~~~~~~~~~~~~
112

    
113
To enable google authentication while signed in under a Google account,
114
visit https://code.google.com/apis/console/.
115

    
116
Under API Access select Create another client ID, select Web application,
117
expand more options in Your site or hostname section and in Authorized
118
Redirect URIs add:
119

    
120

    
121
Fill the necessary information and for callback URL give::
122

    
123
    https://node1.example.com/ui/login/google/authenticated
124

    
125
Finally, add 'google' in ``ASTAKOS_IM_MODULES`` list. The variable resides
126
inside the file ``/etc/synnefo/20-snf-astakos-app-settings.conf``
127

    
128

    
129
Working with Astakos
130
--------------------
131

    
132
User registration
133
~~~~~~~~~~~~~~~~~
134

    
135
When a new user signs up, he/she is not directly marked as active. You can see 
136
his/her state by running (on the machine that runs the Astakos app):
137

    
138
.. code-block:: console
139

    
140
   $ snf-manage user-list
141

    
142
More detailed user status is provided in the `status` field of the `user-show` 
143
command:
144

    
145
.. code-block:: console
146

    
147
  $ snf-manage user-show <user-id>
148

    
149
  id                  : 6
150
  uuid                : 78661411-5eed-412f-a9ea-2de24f542c2e
151
  status              : Accepted/Active (accepted policy: manual)
152
  email               : user@synnefo.org
153
  ....
154

    
155
Based on the `astakos-app` configuration, there are several ways for a user to
156
get verified and activated in order to be able to login. We discuss the user
157
verification and activation flow in the following section.
158

    
159
User activation flow
160
````````````````````
161

    
162
A user can register for an account using the astakos signup form. Once the form
163
is submited successfully a user entry is created in astakos database. That entry
164
is passed through the astakos activation backend which handles whether the user
165
should be automatically verified and activated.
166

    
167
Email verification
168
``````````````````
169

    
170
The verification process takes place in order to ensure that the user owns the
171
email provided during the signup process. By default, after each successful
172
signup astakos notifies user with an verification url via email. 
173

    
174
At this stage:
175

    
176
    * subsequent registrations invalidate and delete the previous registrations 
177
      of the same email address.
178

    
179
    * in case user misses the initial notification, additional emails can be
180
      send either via the url which is prompted to the user if he tries to
181
      login, or by the administrator using the ``snf-manage user-activation-send
182
      <userid>`` command.
183

    
184
    * administrator may also enforce a user to get verified using the
185
      ``snf-manage user-modify --verify <userid>`` command.
186

    
187
Account activation
188
``````````````````
189

    
190
Once the user gets verified, it is time for Astakos to decide whether or not to
191
proceed through user activation process. If ``ASTAKOS_MODERATION_ENABLED``
192
setting is set to ``False`` (default value) user gets activated automatically. 
193

    
194
In case the moderation is enabled Astakos may still automatically activate the
195
user in the following cases:
196

    
197
    * User email matches any of the regular expressions defined in
198
      ``ASTAKOS_RE_USER_EMAIL_PATTERNS`` (defaults to ``[]``)
199
    * User used a signup method (e.g. ``shibboleth``) for which automatic
200
      activation is enabled (see 
201
      :ref:`authentication methods policies <auth_methods_policies>`).
202

    
203
If all of the above fail to trigger automatic activation, an email is sent to
204
the persons listed in ``HELPDESK``, ``MANAGERS`` and ``ADMINS`` settings,
205
notifing that there is a new user pending for moderation and that it's up to
206
the administrator to decide if the user should be activated. The UI also shows
207
a corresponding 'pending moderation' message to the user. The administrator can
208
activate a user using the ``snf-manage user-modify`` command:
209

    
210
.. code-block:: console
211

    
212
    # command to activate a pending user
213
    $ snf-manage user-modify --accept <userid>
214

    
215
    # command to reject a pending user
216
    $ snf-manage user-modify --reject --reject-reason="spammer" <userid>
217

    
218
Once the activation process finishes, a greeting message is sent to the user
219
email address and a notification for the activation to the persons listed in
220
``HELPDESK``, ``MANAGERS`` and ``ADMINS`` settings. Once activated the user is
221
able to login and access the Synnefo services.
222

    
223
Additional authentication methods
224
`````````````````````````````````
225

    
226
Astakos supports third party logins from external identity providers. This
227
can be usefull since it allows users to use their existing credentials to 
228
login to astakos service.
229

    
230
Currently astakos supports the following identity providers:
231

    
232
    * `Shibboleth <http://www.internet2.edu/shibboleth>`_ (module name
233
      ``shibboleth``)
234
    * `Google <https://developers.google.com/accounts/docs/OAuth2>`_ (module
235
      name ``google``)
236
    * `Twitter <https://dev.twitter.com/docs/auth>`_ (module name ``twitter``)
237
    * `LinkedIn <http://developer.linkedin.com/documents/authentication>`_
238
      (module name ``linkedin``)
239

    
240
To enable any of the above modules (by default only ``local`` accounts are
241
allowed), retrieve and set the required provider settings and append the 
242
module name in ``ASTAKOS_IM_MODULES``.
243

    
244
.. code-block:: python
245

    
246
    # settings from https://code.google.com/apis/console/
247
    ASTAKOS_GOOGLE_CLIENT_ID = '1111111111-epi60tvimgha63qqnjo40cljkojcann3.apps.googleusercontent.com'
248
    ASTAKOS_GOOGLE_SECRET = 'tNDQqTDKlTf7_LaeUcWTWwZM'
249
    
250
    # let users signup and login using their google account
251
    ASTAKOS_IM_MODULES = ['local', 'google']
252

    
253

    
254
.. _auth_methods_policies:
255

    
256
Authentication method policies
257
``````````````````````````````
258

    
259
Astakos allows you to override the default policies for each enabled provider 
260
separately by adding the approriate settings in your ``.conf`` files in the 
261
following format:
262

    
263
**ASTAKOS_AUTH_PROVIDER_<module>_<policy>_POLICY**
264

    
265
Available policies are:
266

    
267
    * **CREATE** Users can signup using that provider (default: ``True``) 
268
    * **REMOVE/ADD** Users can remove/add login method from their profile 
269
      (default: ``True``)
270
    * **AUTOMODERATE** Automatically activate users that signup using that
271
      provider (default: ``False``)
272
    * **LOGIN** Whether or not users can use the provider to login (default:
273
      ``True``).
274

    
275
e.g. to enable automatic activation for your academic users, while keeping 
276
locally signed up users under moderation you can apply the following settings.
277

    
278
.. code-block:: python
279

    
280
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_AUTOMODERATE_POLICY = True
281
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_REMOVE_POLICY = False
282

    
283
User login
284
~~~~~~~~~~
285

    
286
During the logging procedure, the user is authenticated by the respective
287
identity provider.
288

    
289
If ``ASTAKOS_RECAPTCHA_ENABLED`` is set and the user fails several times
290
(``ASTAKOS_RATELIMIT_RETRIES_ALLOWED`` setting) to provide the correct
291
credentials for a local account, he/she is then prompted to solve a captcha
292
challenge.
293

    
294
Upon success, the system renews the token (if it has expired), logins the user
295
and sets the cookie, before redirecting the user to the ``next`` parameter
296
value.
297

    
298
Setting quota limits
299
~~~~~~~~~~~~~~~~~~~~
300

    
301
Set default quota
302
`````````````````
303

    
304
In 20-snf-astakos-app-settings.conf, 
305
uncomment the default setting ``ASTAKOS_SERVICES``
306
and customize the ``'uplimit'`` values.
307
These are the default base quota for all users.
308

    
309
To apply your configuration run::
310

    
311
    # snf-manage astakos-init --load-service-resources
312
    # snf-manage quota --sync
313

    
314
Set base quota for individual users
315
```````````````````````````````````
316

    
317
For individual users that need different quota than the default
318
you can set it for each resource like this::
319

    
320
    # use this to display quota / uuid
321
    # snf-manage user-show 'uuid or email' --quota
322

    
323
    # snf-manage user-modify 'user-uuid' --set-base-quota 'cyclades.vm' 10
324

    
325

    
326
Enable the Projects feature
327
~~~~~~~~~~~~~~~~~~~~~~~~~~~
328

    
329
If you want to enable the projects feature so that users may apply
330
on their own for resources by creating and joining projects,
331
in ``20-snf-astakos-app-settings.conf`` set::
332

    
333
    # this will make the 'projects' page visible in the dashboard
334
    ASTAKOS_PROJECTS_VISIBLE = True
335

    
336
You can change the maximum allowed number of pending project applications
337
per user with::
338

    
339
    # snf-manage resource-modify astakos.pending_app --limit <number>
340

    
341
You can also set a user-specific limit with::
342

    
343
    # snf-manage user-modify 'user-uuid' --set-base-quota 'astakos.pending_app' 5
344

    
345
When users apply for projects they are not automatically granted
346
the resources. They must first be approved by the administrator.
347

    
348
To list pending project applications in astakos::
349

    
350
    # snf-manage project-list --pending
351

    
352
Note the last column, the application id. To approve it::
353

    
354
    # <app id> from the last column of project-list
355
    # snf-manage project-control --approve <app id>
356

    
357
To deny an application::
358

    
359
    # snf-manage project-control --deny <app id>
360

    
361
Users designated as *project admins* can approve, deny, or modify
362
an application through the web interface. In
363
``20-snf-astakos-app-settings.conf`` set::
364

    
365
    # UUIDs of users that can approve or deny project applications from the web.
366
    ASTAKOS_PROJECT_ADMINS = [<uuid>, ...]
367

    
368

    
369
Astakos advanced operations
370
---------------------------
371

    
372
Adding "Terms of Use"
373
~~~~~~~~~~~~~~~~~~~~~
374

    
375
Astakos supports versioned terms-of-use. First of all you need to create an
376
html file that will contain your terms. For example, create the file
377
``/usr/share/synnefo/sample-terms.html``, which contains the following:
378

    
379
.. code-block:: console
380

    
381
   <h1>My cloud service terms</h1>
382

    
383
   These are the example terms for my cloud service
384

    
385
Then, add those terms-of-use with the snf-manage command:
386

    
387
.. code-block:: console
388

    
389
   $ snf-manage term-add /usr/share/synnefo/sample-terms.html
390

    
391
Your terms have been successfully added and you will see the corresponding link
392
appearing in the Astakos web pages' footer.
393

    
394
During the account registration, if there are approval terms, the user is
395
presented with an "I agree with the Terms" checkbox that needs to get checked
396
in order to proceed.
397

    
398
In case there are new approval terms that the user has not signed yet, the
399
``signed_terms_required`` view decorator redirects to the ``approval_terms``
400
view, so the user will be presented with the new terms the next time he/she
401
logins.
402

    
403
Enabling reCAPTCHA
404
~~~~~~~~~~~~~~~~~~
405

    
406
Astakos supports the `reCAPTCHA <http://www.google.com/recaptcha>`_ feature.
407
If enabled, it protects the Astakos forms from bots. To enable the feature, go
408
to https://www.google.com/recaptcha/admin/create and create your own reCAPTCHA
409
key pair. Then edit ``/etc/synnefo/20-snf-astakos-app-settings.conf`` and set
410
the corresponding variables to reflect your newly created key pair. Finally, set
411
the ``ASTAKOS_RECAPTCHA_ENABLED`` variable to ``True``:
412

    
413
.. code-block:: console
414

    
415
   ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
416
   ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
417

    
418
   ASTAKOS_RECAPTCHA_ENABLED = True
419

    
420
Restart the service on the Astakos node(s) and you are ready:
421

    
422
.. code-block:: console
423

    
424
   # /etc/init.d/gunicorn restart
425

    
426
Checkout your new Sign up page. If you see the reCAPTCHA box, you have setup
427
everything correctly.
428

    
429

    
430
Astakos internals
431
-----------------
432

    
433
X-Auth-Token
434
~~~~~~~~~~~~
435

    
436
Alice requests a specific resource from a cloud service e.g.: Pithos. In the
437
request she supplies the `X-Auth-Token` to identify whether she is eligible to
438
perform the specific task. The service contacts Astakos through its
439
``/account/v1.0/authenticate`` api call (see :ref:`authenticate-api-label`)
440
providing the specific ``X-Auth-Token``. Astakos checkes whether the token
441
belongs to an active user and it has not expired and returns a dictionary
442
containing user related information. Finally the service uses the ``uniq``
443
field included in the dictionary as the account string to identify the user
444
accessible resources.
445

    
446
.. _authentication-label:
447

    
448
Django Auth methods and Backends
449
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
450

    
451
Astakos incorporates Django user authentication system and extends its User model.
452

    
453
Since username field of django User model has a limitation of 30 characters,
454
AstakosUser is **uniquely** identified by the ``email`` instead. Therefore,
455
``astakos.im.authentication_backends.EmailBackend`` is served to authenticate a
456
user using email if the first argument is actually an email, otherwise tries
457
the username.
458

    
459
A new AstakosUser instance is assigned with a uui as username and also with a
460
``auth_token`` used by the cloud services to authenticate the user.
461
``astakos.im.authentication_backends.TokenBackend`` is also specified in order
462
to authenticate the user using the email and the token fields.
463

    
464
Logged on users can perform a number of actions:
465

    
466
 * access and edit their profile via: ``/im/profile``.
467
 * change their password via: ``/im/password``
468
 * send feedback for grnet services via: ``/im/send_feedback``
469
 * logout (and delete cookie) via: ``/im/logout``
470

    
471
Internal Astakos requests are handled using cookie-based Django user sessions.
472

    
473
External systems should forward to the ``/login`` URI. The server,
474
depending on its configuration will redirect to the appropriate login page.
475
When done with logging in, the service's login URI should redirect to the URI
476
provided with next, adding user and token parameters, which contain the email
477
and token fields respectively.
478

    
479
The login URI accepts the following parameters:
480

    
481
======================  =========================
482
Request Parameter Name  Value
483
======================  =========================
484
next                    The URI to redirect to when the process is finished
485
renew                   Force token renewal (no value parameter)
486
force                   Force logout current user (no value parameter)
487
======================  =========================
488

    
489
External systems inside the ``ASTAKOS_COOKIE_DOMAIN`` scope can acquire the
490
user information by the cookie identified by ``ASTAKOS_COOKIE_NAME`` setting
491
(set during the login procedure).
492

    
493
Finally, backend systems having acquired a token can use the
494
:ref:`authenticate-api-label` API call from a private network or through HTTPS.
495

    
496

    
497
Compute/Network/Image Service (Cyclades)
498
========================================
499

    
500
Working with Cyclades
501
---------------------
502

    
503
Managing Ganeti Backends
504
~~~~~~~~~~~~~~~~~~~~~~~~
505

    
506
Since v0.11, Synnefo is able to manage multiple Ganeti clusters (backends)
507
making it capable to scale linearly to tens of thousands of VMs. Backends
508
can be dynamically added or removed via `snf-manage` commands.
509

    
510
Each newly created VM is allocated to a Ganeti backend by the Cyclades backend
511
allocator. The VM is "pinned" to this backend, and can not change through its
512
lifetime. The backend allocator decides in which backend to spawn the VM based
513
on the available resources of each backend, trying to balance the load between
514
them.
515

    
516
Handling of Networks, as far as backends are concerned, is based on whether the
517
network is public or not. Public networks are created through the `snf-manage
518
network-create` command, and are only created on one backend. Private networks
519
are created on all backends, in order to ensure that VMs residing on different
520
backends can be connected to the same private network.
521

    
522
Listing existing backends
523
`````````````````````````
524
To list all the Ganeti backends known to Synnefo, we run:
525

    
526
.. code-block:: console
527

    
528
   $ snf-manage backend-list
529

    
530
Adding a new Ganeti backend
531
```````````````````````````
532
Backends are dynamically added under the control of Synnefo with `snf-manage
533
backend-add` command. In this section it is assumed that a Ganeti cluster,
534
named ``cluster.example.com`` is already up and running and configured to be
535
able to host Synnefo VMs.
536

    
537
To add this Ganeti cluster, we run:
538

    
539
.. code-block:: console
540

    
541
   $ snf-manage backend-add --clustername=cluster.example.com --user="synnefo_user" --pass="synnefo_pass"
542

    
543
where ``clustername`` is the Cluster hostname of the Ganeti cluster, and
544
``user`` and ``pass`` are the credentials for the `Ganeti RAPI user
545
<http://docs.ganeti.org/ganeti/2.2/html/rapi.html#users-and-passwords>`_.  All
546
backend attributes can be also changed dynamically using the `snf-manage
547
backend-modify` command.
548

    
549
``snf-manage backend-add`` will also create all existing private networks to
550
the new backend. You can verify that the backend is added, by running
551
`snf-manage backend-list`.
552

    
553
Note that no VMs will be spawned to this backend, since by default it is in a
554
``drained`` state after addition and also it has no public network assigned to
555
it.
556

    
557
So, first you need to create its public network, make sure everything works as
558
expected and finally make it active by un-setting the ``drained`` flag. You can
559
do this by running:
560

    
561
.. code-block:: console
562

    
563
   $ snf-manage backend-modify --drained=False <backend_id>
564

    
565
Removing an existing Ganeti backend
566
```````````````````````````````````
567
In order to remove an existing backend from Synnefo, we run:
568

    
569
.. code-block:: console
570

    
571
   # snf-manage backend-remove <backend_id>
572

    
573
This command will fail if there are active VMs on the backend. Also, the
574
backend is not cleaned before removal, so all the Synnefo private networks
575
will be left on the Ganeti nodes. You need to remove them manually.
576

    
577
Allocation of VMs in Ganeti backends
578
````````````````````````````````````
579
As already mentioned, the Cyclades backend allocator is responsible for
580
allocating new VMs to backends. This allocator does not choose the exact Ganeti
581
node that will host the VM but just the Ganeti backend. The exact node is
582
chosen by the Ganeti cluster's allocator (hail).
583

    
584
The decision about which backend will host a VM is based on the available
585
resources. The allocator computes a score for each backend, that shows its load
586
factor, and the one with the minimum score is chosen. The admin can exclude
587
backends from the allocation phase by marking them as ``drained`` by running:
588

    
589
.. code-block:: console
590

    
591
   $ snf-manage backend-modify --drained=True <backend_id>
592

    
593
The backend resources are periodically updated, at a period defined by
594
the ``BACKEND_REFRESH_MIN`` setting, or by running `snf-manage backend-update-status`
595
command. It is advised to have a cron job running this command at a smaller
596
interval than ``BACKEND_REFRESH_MIN`` in order to remove the load of refreshing
597
the backends stats from the VM creation phase.
598

    
599
Finally, the admin can decide to have a user's VMs being allocated to a
600
specific backend, with the ``BACKEND_PER_USER`` setting. This is a mapping
601
between users and backends. If the user is found in ``BACKEND_PER_USER``, then
602
Synnefo allocates all his/hers VMs to the specific backend in the variable,
603
even if is marked as drained (useful for testing).
604

    
605
Allocation based on disk-templates
606
**********************************
607

    
608
Besides the available resources of each Ganeti backend, the allocator takes
609
into consideration the disk template of the instance when trying to allocate it
610
to a Ganeti backend. Specifically, the allocator checks if the flavor of the
611
instance belongs to the available disk templates of each Ganeti backend.
612

    
613
A Ganeti cluster has a list of enabled disk templates
614
(`--enabled-disk-templates`) and a list of allowed disk templates for new
615
instances (`--ipolicy-disk-templates`). See the `gnt-cluster` manpage for more
616
details about these options.
617

    
618
When Synnefo allocates an instance, it checks whether the disk template of the
619
new instance belongs both in the enabled and ipolicy disk templates. You can
620
see the list of the available disk-templates by running `snf-manage
621
backend-list`. This list should be updated automatically after changing
622
these options in Ganeti and it can also be updated by running `snf-manage
623
backend-update-status`.
624

    
625
So the administrator, can route instances on different backends based on their
626
flavor disk template, by modifying the enabled or ipolicy disk templates of
627
each backend.  Also, the administrator can route instances between different
628
nodes of the same Ganeti backend, by modifying the same options at the
629
nodegroup level (see `gnt-group` manpage for mor details).
630

    
631

    
632
Managing Virtual Machines
633
~~~~~~~~~~~~~~~~~~~~~~~~~
634

    
635
As mentioned, Cyclades uses Ganeti for management of VMs. The administrator can
636
handle Cyclades VMs just like any other Ganeti instance, via `gnt-instance`
637
commands. All Ganeti instances that belong to Synnefo, are separated from
638
others, by a prefix in their names. This prefix is defined in
639
``BACKEND_PREFIX_ID`` setting in
640
``/etc/synnefo/20-snf-cyclades-app-backend.conf``.
641

    
642
Apart from handling instances directly in the Ganeti level, a number of `snf-manage`
643
commands are available:
644

    
645
* ``snf-manage server-list``: List servers
646
* ``snf-manage server-show``: Show information about a server in the Cyclades DB
647
* ``snf-manage server-inspect``: Inspect the state of a server both in DB and Ganeti
648
* ``snf-manage server-modify``: Modify the state of a server in the Cycldes DB
649
* ``snf-manage server-create``: Create a new server
650
* ``snf-manage server-import``: Import an existing Ganeti instance to Cyclades
651

    
652

    
653
Managing Virtual Networks
654
~~~~~~~~~~~~~~~~~~~~~~~~~
655

    
656
Cyclades is able to create and manage Virtual Networks. Networking is
657
desployment specific and must be customized based on the specific needs of the
658
system administrator. For better understanding of networking please refer to
659
the :ref:`Network <networks>` section.
660

    
661
Exactly as Cyclades VMs can be handled like Ganeti instances, Cyclades Networks
662
can also by handled as Ganeti networks, via `gnt-network commands`. All Ganeti
663
networks that belong to Synnefo are named with the prefix
664
`${BACKEND_PREFIX_ID}-net-`.
665

    
666
There are also the following `snf-manage` commands for managing networks:
667

    
668
* ``snf-manage network-list``: List networks
669
* ``snf-manage network-show``: Show information about a network in the Cyclades DB
670
* ``snf-manage network-inspect``: Inspect the state of the network in DB and Ganeti backends
671
* ``snf-manage network-modify``: Modify the state of a network in the Cycldes DB
672
* ``snf-manage network-create``: Create a new network
673
* ``snf-manage network-remove``: Remove an existing network
674

    
675
Managing Network Resources
676
``````````````````````````
677

    
678
Proper operation of the Cyclades Network Service depends on the unique
679
assignment of specific resources to each type of virtual network. Specifically,
680
these resources are:
681

    
682
* IP addresses. Cyclades creates a Pool of IPs for each Network, and assigns a
683
  unique IP address to each VM, thus connecting it to this Network. You can see
684
  the IP pool of each network by running `snf-manage network-inspect
685
  <network_ID>`. IP pools are automatically created and managed by Cyclades,
686
  depending on the subnet of the Network.
687
* Bridges corresponding to physical VLANs, which are required for networks of
688
  type `PRIVATE_PHYSICAL_VLAN`.
689
* One Bridge corresponding to one physical VLAN which is required for networks of
690
  type `PRIVATE_MAC_PREFIX`.
691

    
692
IPv4 addresses
693
**************
694

    
695
An allocation pool of IPv4 addresses is automatically created for every network
696
that has the attribute `dhcp` set to True. The allocation pool contains the
697
range of IP addresses that are included in the subnet. The gateway and the
698
broadcast address of the network are excluded from the allocation pool. The
699
admin can externally reserve IP addresses to exclude them from automatic
700
allocation with the `--add-reserved-ips` option of `snf-manage network-modify`
701
command. For example the following command will reserve two IP addresses
702
from network with ID `42`:
703

    
704
.. code-block:: console
705

    
706
 snf-manage network-modify --add-reserved-ips=10.0.0.21,10.0.0.22 42
707

    
708
.. warning:: Externally reserving IP addresses is also available at the Ganeti.
709
 However, when using Cyclades with multiple Ganeti backends, the handling of
710
 IP pools must be performed from Cyclades!
711

    
712
Bridges
713
*******
714

    
715
As already mentioned Cyclades use a pool of Bridges that must correspond
716
to Physical VLAN at the Ganeti level. A bridge from the pool is assigned to
717
each network of flavor `PHYSICAL_VLAN`. Creation of this pool is done
718
using `snf-manage pool-create` command. For example the following command
719
will create a pool containing the brdiges from `prv1` to `prv21`.
720

    
721
.. code-block:: console
722

    
723
   # snf-manage pool-create --type=bridge --base=prv --size=20
724

    
725
You can verify the creation of the pool, and check its contents by running:
726

    
727
.. code-block:: console
728

    
729
   # snf-manage pool-list
730
   # snf-manage pool-show --type=bridge 1
731

    
732
Finally you can use the `pool-modify` management command in order to externally
733
reserve the values from pool, extend or shrink the pool if possible.
734

    
735
MAC Prefixes
736
************
737

    
738
Cyclades also use a pool of MAC prefixes to assign to networks of flavor
739
`MAC_FILTERED`. Handling of this pool is done exactly as with pool of bridges,
740
except that the type option must be set to mac-prefix:
741

    
742
.. code-block:: console
743

    
744
   # snf-manage pool-create --type=mac-prefix --base=aa:00:0 --size=65536
745

    
746
The above command will create a pool of MAC prefixes from ``aa:00:1`` to
747
``b9:ff:f``. The MAC prefix pool is responsible for providing only unicast and
748
locally administered MAC addresses, so many of these prefixes will be
749
externally reserved, to exclude from allocation.
750

    
751
Pool reconciliation
752
*******************
753

    
754
The management command `snf-manage reconcile-pools` can be used that all the
755
above mentioned pools are consistent and that all values that come from the
756
pool are not used more than once.
757

    
758

    
759
Cyclades advanced operations
760
----------------------------
761

    
762
Reconciliation mechanism
763
~~~~~~~~~~~~~~~~~~~~~~~~
764

    
765
On certain occasions, such as a Ganeti or RabbitMQ failure, the state of
766
Cyclades database may differ from the real state of VMs and networks in the
767
Ganeti backends. The reconciliation process is designed to synchronize
768
the state of the Cyclades DB with Ganeti. There are two management commands
769
for reconciling VMs and Networks
770

    
771
Reconciling Virtual Machines
772
````````````````````````````
773

    
774
Reconciliation of VMs detects the following conditions:
775

    
776
 * Stale DB servers without corresponding Ganeti instances
777
 * Orphan Ganeti instances, without corresponding DB entries
778
 * Out-of-sync state for DB entries wrt to Ganeti instances
779

    
780
To detect all inconsistencies you can just run:
781

    
782
.. code-block:: console
783

    
784
  $ snf-manage reconcile-servers
785

    
786
Adding the `--fix-all` option, will do the actual synchronization:
787

    
788
.. code-block:: console
789

    
790
  $ snf-manage reconcile-servers --fix-all
791

    
792
Please see ``snf-manage reconcile-servers --help`` for all the details.
793

    
794
Reconciling Networks
795
````````````````````
796

    
797
Reconciliation of Networks detects the following conditions:
798

    
799
  * Stale DB networks without corresponding Ganeti networks
800
  * Orphan Ganeti networks, without corresponding DB entries
801
  * Private networks that are not created to all Ganeti backends
802
  * Unsynchronized IP pools
803

    
804
To detect all inconsistencies you can just run:
805

    
806
.. code-block:: console
807

    
808
  $ snf-manage reconcile-networks
809

    
810
Adding the `--fix-all` option, will do the actual synchronization:
811

    
812
.. code-block:: console
813

    
814
  $ snf-manage reconcile-networks --fix-all
815

    
816
Please see ``snf-manage reconcile-networks --help`` for all the details.
817

    
818

    
819
Cyclades internals
820
------------------
821

    
822
Asynchronous communication with Ganeti backends
823
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
824
Synnefo uses Google Ganeti backends for VM cluster management. In order for
825
Cyclades to be able to handle thousands of user requests, Cyclades and Ganeti
826
communicate asynchronously. Briefly, requests are submitted to Ganeti through
827
Ganeti's RAPI/HTTP interface, and then asynchronous notifications about the
828
progress of Ganeti jobs are being created and pushed upwards to Cyclades. The
829
architecture and communication with a Ganeti backend is shown in the graph
830
below:
831

    
832
.. image:: images/cyclades-ganeti-communication.png
833
   :width: 50%
834
   :target: _images/cyclades-ganeti-communication.png
835

    
836
The Cyclades API server is responsible for handling user requests. Read-only
837
requests are directly served by looking up the Cyclades DB. If the request
838
needs an action in the Ganeti backend, Cyclades submit jobs to the Ganeti
839
master using the `Ganeti RAPI interface
840
<http://docs.ganeti.org/ganeti/2.2/html/rapi.html>`_.
841

    
842
While Ganeti executes the job, `snf-ganeti-eventd`, `snf-ganeti-hook` and
843
`snf-progress-monitor` are monitoring the progress of the job and send
844
corresponding messages to the RabbitMQ servers. These components are part
845
of `snf-cyclades-gtools` and must be installed on all Ganeti nodes. Specially:
846

    
847
* *snf-ganeti-eventd* sends messages about operations affecting the operating
848
  state of instances and networks. Works by monitoring the Ganeti job queue.
849
* *snf-ganeti_hook* sends messages about the NICs of instances. It includes a
850
  number of `Ganeti hooks <http://docs.ganeti.org/ganeti/2.2/html/hooks.html>`_
851
  for customisation of operations.
852
* *snf-progress_monitor* sends messages about the progress of the Image deployment
853
  phase which is done by the Ganeti OS Definition `snf-image`.
854

    
855
Finally, `snf-dispatcher` consumes messages from the RabbitMQ queues, processes
856
these messages and properly updates the state of the Cyclades DB. Subsequent
857
requests to the Cyclades API, will retrieve the updated state from the DB.
858

    
859

    
860
Synnefo management commands ("snf-manage")
861
==========================================
862

    
863
Each Synnefo service, Astakos, Pithos and Cyclades are controlled by the
864
administrator using the "snf-manage" admin tool. This tool is an extension of
865
the Django command-line management utility. It is run on the host that runs
866
each service and provides different types of commands depending the services
867
running on the host. If you are running more than one service on the same host
868
"snf-manage" adds all the corresponding commands for each service dynamically,
869
providing a unified admin environment.
870

    
871
To run "snf-manage" you just type:
872

    
873
.. code-block:: console
874

    
875
   # snf-manage <command> [arguments]
876

    
877
on the corresponding host that runs the service. For example, if you have all
878
services running on different physical hosts you would do:
879

    
880
.. code-block:: console
881

    
882
   root@astakos-host # snf-manage <astakos-command> [argument]
883
   root@pithos-host # snf-manage <pithos-command> [argument]
884
   root@cyclades-host # snf-manage <cyclades-command> [argument]
885

    
886
If you have all services running on the same host you would do:
887

    
888
.. code-block:: console
889

    
890
   root@synnefo-host # snf-manage <{astakos,pithos,cyclades}-command> [argument]
891

    
892
Note that you cannot execute a service's command on a host that is not running
893
this service. For example, the following will return an error if Astakos and
894
Cyclades are installed on different physical hosts:
895

    
896
.. code-block:: console
897

    
898
   root@astakos-host # snf-manage <cyclades-command> [argument]
899
   Unknown command: 'cyclades-command'
900
   Type 'snf-manage help' for usage.
901

    
902
This is the complete list of "snf-manage" commands for each service.
903

    
904
Astakos snf-manage commands
905
---------------------------
906

    
907
============================  ===========================
908
Name                          Description
909
============================  ===========================
910
fix-superusers                Transform superusers created by syncdb into AstakosUser instances
911
cleanup-full                  Cleanup sessions and session catalog
912
commission-list               List pending commissions
913
commission-show               Show details for a pending commission
914
component-add                 Register a component
915
component-list                List components
916
component-modify              Modify component attributes
917
component-show                Show component details
918
project-control               Manage projects and applications
919
project-list                  List projects
920
project-show                  Show project details
921
quota                         List and check the integrity of user quota
922
reconcile-resources-astakos   Reconcile resource usage of Quotaholder with Astakos DB
923
resource-list                 List resources
924
resource-modify               Modify a resource's default base quota and boolean flags
925
service-export-astakos        Export Astakos services and resources in JSON format
926
service-import                Register services
927
service-list                  List services
928
service-show                  Show service details
929
term-add                      Add approval terms
930
user-activation-send          Send user activation
931
user-add                      Add user
932
authpolicy-add                Create a new authentication provider policy profile
933
authpolicy-list               List existing authentication provider policy profiles
934
authpolicy-remove             Remove an authentication provider policy
935
authpolicy-set                Assign an existing authentication provider policy profile to a user or group
936
authpolicy-show               Show authentication provider profile details
937
group-add                     Create a group with the given name
938
group-list                    List available groups
939
user-list                     List users
940
user-modify                   Modify user
941
user-show                     Show user details
942
============================  ===========================
943

    
944
Pithos snf-manage commands
945
--------------------------
946

    
947
============================  ===========================
948
Name                          Description
949
============================  ===========================
950
reconcile-commissions-pithos  Display unresolved commissions and trigger their recovery
951
service-export-pithos         Export Pithos services and resources in JSON format
952
reconcile-resources-pithos    Detect unsynchronized usage between Astakos and Pithos DB resources and synchronize them if specified so.
953
============================  ===========================
954

    
955
Cyclades snf-manage commands
956
----------------------------
957

    
958
============================== ===========================
959
Name                           Description
960
============================== ===========================
961
backend-add                    Add a new Ganeti backend
962
backend-list                   List backends
963
backend-modify                 Modify a backend
964
backend-update-status          Update backend statistics for instance allocation
965
backend-remove                 Remove a Ganeti backend
966
server-create                  Create a new server
967
server-show                    Show server details
968
server-list                    List servers
969
server-modify                  Modify a server
970
server-import                  Import an existing Ganeti VM into synnefo
971
server-inspect                 Inspect a server in DB and Ganeti
972
network-create                 Create a new network
973
network-list                   List networks
974
network-modify                 Modify a network
975
network-inspect                Inspect network state in DB and Ganeti
976
network-remove                 Delete a network
977
flavor-create                  Create a new flavor
978
flavor-list                    List flavors
979
flavor-modify                  Modify a flavor
980
image-list                     List images
981
image-show                     Show image details
982
pool-create                    Create a bridge or mac-prefix pool
983
pool-show                      Show pool details
984
pool-list                      List pools
985
pool-modify                    Modify a pool
986
pool-remove                    Delete a pool
987
port-create                    Create a port connecting a server to a network
988
port-inspect                   Inspect the state of a port in DB and Ganeti
989
port-list                      List ports
990
port-remove                    Delete a port
991
floating-ip-create             Create a new floating IP
992
floating-ip-attach             Attach a floating IP to a server
993
floating-ip-dettach            Dettach a flotaing IP from a server
994
floating-ip-list               List floating IPs
995
floating-ip-remove             Delete a floating IP
996
queue-inspect                  Inspect the messages of a RabbitMQ queue
997
queue-retry                    Resend messages from Dead Letter queues to original exchanges
998
service-export-cyclades        Export Cyclades services and resources in JSON format
999
subnet-create                  Create a subnet
1000
subnet-inspect                 Inspect a subnet in DB
1001
subnet-list                    List subnets
1002
subnet-modify                  Modify a subnet
1003
reconcile-servers              Reconcile servers of Synnefo DB with state of Ganeti backend
1004
reconcile-networks             Reconcile networks of Synnefo DB with state of Ganeti backend
1005
reconcile-pools                Check consistency of pool resources
1006
reconcile-commissions-cyclades Detect and resolve pending commissions to Quotaholder
1007
reconcile-resources-cyclades   Reconcile resource usage of Astakos with Cyclades DB.
1008
============================== ===========================
1009

    
1010

    
1011
Astakos helper scripts
1012
======================
1013

    
1014
Astakos includes two scripts to facilitate the installation procedure.
1015
Running:
1016

    
1017
.. code-block:: console
1018

    
1019
   snf-component-register [<component_name>]
1020

    
1021
automates the registration of the standard Synnefo components (astakos,
1022
cyclades, and pithos) in astakos database. It internally uses the script:
1023

    
1024
.. code-block:: console
1025

    
1026
   snf-service-export <component_name> <base_url>
1027

    
1028
which simulates the export of service and resource definitions of the
1029
standard Synnefo components.
1030

    
1031

    
1032
Pithos managing accounts
1033
========================
1034

    
1035
Pithos provides a utility tool for managing accounts.
1036
To run you just type:
1037

    
1038
.. code-block:: console
1039

    
1040
   # pithos-manage-accounts <command> [arguments]
1041

    
1042
This is the list of the available commands:
1043

    
1044
============================  ===========================
1045
Name                          Description
1046
============================  ===========================
1047
delete                        Remove an account from the Pithos DB
1048
export-quota                  Export account quota in a file
1049
list                          List existing/dublicate accounts
1050
merge                         Move an account contents in another account
1051
set-container-quota           Set container quota for all or a specific account
1052
============================  ===========================
1053

    
1054

    
1055
The "kamaki" API client
1056
=======================
1057

    
1058
To upload, register or modify an image you will need the **kamaki** tool.
1059
Before proceeding make sure that it is configured properly. Verify that
1060
*image.url*, *file.url*, *user.url* and *token* are set as needed:
1061

    
1062
.. code-block:: console
1063

    
1064
   $ kamaki config list
1065

    
1066
To change a setting use ``kamaki config set``:
1067

    
1068
.. code-block:: console
1069

    
1070
   $ kamaki config set image.url https://cyclades.example.com/image
1071
   $ kamaki config set file.url https://pithos.example.com/v1
1072
   $ kamaki config set user.url https://accounts.example.com
1073
   $ kamaki config set token ...
1074

    
1075
To test that everything works, try authenticating the current account with
1076
kamaki:
1077

    
1078
.. code-block:: console
1079

    
1080
  $ kamaki user authenticate
1081

    
1082
This will output user information.
1083

    
1084
Upload Image
1085
------------
1086

    
1087
By convention, images are stored in a container called ``images``. Check if the
1088
container exists, by listing all containers in your account:
1089

    
1090
.. code-block:: console
1091

    
1092
   $ kamaki file list
1093

    
1094
If the container ``images`` does not exist, create it:
1095

    
1096
.. code-block:: console
1097

    
1098
  $ kamaki file create images
1099

    
1100
You are now ready to upload an image to container ``images``. You can upload it
1101
with a Pithos client, or use kamaki directly:
1102

    
1103
.. code-block:: console
1104

    
1105
   $ kamaki file upload ubuntu.iso images
1106

    
1107
You can use any Pithos client to verify that the image was uploaded correctly,
1108
or you can list the contents of the container with kamaki:
1109

    
1110
.. code-block:: console
1111

    
1112
  $ kamaki file list images
1113

    
1114
The full Pithos URL for the previous example will be
1115
``pithos://u53r-un1qu3-1d/images/ubuntu.iso`` where ``u53r-un1qu3-1d`` is the
1116
unique user id (uuid).
1117

    
1118
Register Image
1119
--------------
1120

    
1121
To register an image you will need to use the full Pithos URL. To register as
1122
a public image the one from the previous example use:
1123

    
1124
.. code-block:: console
1125

    
1126
   $ kamaki image register Ubuntu pithos://u53r-un1qu3-1d/images/ubuntu.iso --public
1127

    
1128
The ``--public`` flag is important, if missing the registered image will not
1129
be listed by ``kamaki image list``.
1130

    
1131
Use ``kamaki image register`` with no arguments to see a list of available
1132
options. A more complete example would be the following:
1133

    
1134
.. code-block:: console
1135

    
1136
   $ kamaki image register Ubuntu pithos://u53r-un1qu3-1d/images/ubuntu.iso \
1137
            --public --disk-format diskdump --property kernel=3.1.2
1138

    
1139
To verify that the image was registered successfully use:
1140

    
1141
.. code-block:: console
1142

    
1143
   $ kamaki image list --name-like=ubuntu
1144

    
1145

    
1146
Miscellaneous
1147
=============
1148

    
1149
.. _branding:
1150

    
1151
Branding
1152
--------
1153

    
1154
Since Synnefo v0.14, you are able to adapt the Astakos, Pithos and Cyclades Web
1155
UI to your company’s visual identity. This is possible using the snf-branding
1156
component, which is automatically installed on the nodes running the API
1157
servers for Astakos, Pithos and Cyclades. 
1158

    
1159
Configuration
1160
~~~~~~~~~~~~~
1161

    
1162
This can be done by modifing the settings provided by the snf-branding component
1163
to match your service identity. The settings for the snf-branding application
1164
can be found inside the configuration file ``/etc/synnefo/15-snf-branding.conf``
1165
on the nodes that have Astakos, Pithos and Cyclades installed.
1166

    
1167
By default, the global service name is "Synnefo" and the company name is
1168
"GRNET". These names and their respective logos and URLs are used throughout
1169
the Astakos, Pithos and Cyclades UI.
1170

    
1171
**Names and URLs:**
1172

    
1173
The first group of branding customization refers to the service's and company's
1174
information.
1175

    
1176
You can overwrite the company and the service name and URL respectively by
1177
uncommenting and setting the following:
1178

    
1179
.. code-block:: python
1180
  
1181
  # setting used in Astakos Dashboard/Projects pages
1182
  BRANDING_SERVICE_NAME = 'My cloud'
1183
  BRANDING_SERVICE_URL = 'http://www.mycloud.synnefo.org/'
1184

    
1185
  # settings used in Astakos, Pithos, Cyclades footer only if 
1186
  # BRANDING_SHOW_COPYRIGHT is set to True
1187
  BRANDING_SHOW_COPYRIGHT = True
1188
  BRANDING_COMPANY_NAME = 'Company LTD'
1189
  BRANDING_COMPANY_URL = 'https://www.company-ltd.synnefo.org/'
1190

    
1191

    
1192
**Copyright and footer options:**
1193

    
1194
By default, no Copyright message is shown in the UI footer. If you want to make
1195
it visible in the footer of Astakos, Pithos and Cyclades UI, you can uncomment
1196
and set to ``True`` the ``BRANDING_SHOW_COPYRIGHT`` setting:
1197

    
1198
.. code-block:: python
1199

    
1200
  #BRANDING_SHOW_COPYRIGHT = False
1201

    
1202
Copyright message defaults to 'Copyright (c) 2011-<current_year>
1203
<BRANDING_COMPANY_NAME>.' but you can overwrite it to a completely custom one by
1204
setting the following option:
1205

    
1206
.. code-block:: python
1207

    
1208
  BRANDING_COPYRIGHT_MESSAGE = 'Copyright (c) 2011-2013 GRNET'
1209

    
1210
If you want to include a custom message in the footer, you can uncomment and 
1211
set the ``BRANDING_FOOTER_EXTRA_MESSAGE`` setting. You can use html markup. 
1212
Your custom message will appear  above Copyright message at the Compute 
1213
templates and the Dashboard UI.
1214

    
1215
.. code-block:: python
1216

    
1217
  #BRANDING_FOOTER_EXTRA_MESSAGE = ''
1218

    
1219

    
1220
**Images:**
1221

    
1222
The Astakos, Pithos and Cyclades Web UI has some logos and images.
1223
 
1224
The branding-related images are presented in  the following table:
1225

    
1226
===============  ============================  =========
1227
Image            Name/extension  convention    Usage
1228
===============  ============================  =========
1229
Favicon          favicon.ico                   Favicon for all services
1230
Dashboard logo   dashboard_logo.png            Visible in all Astakos UI pages
1231
Compute logo     compute_logo.png              Visible in all Cyclades UI pages
1232
Console logo     console_logo.png              Visible in the Cyclades Console Window
1233
Storage logo     storage_logo.png              Visible in all Pithos UI pages
1234
===============  ============================  =========
1235

    
1236
There are two methods  available for replacing all, or individual, 
1237
branding-related images:
1238

    
1239
1. Create a new directory inside ``/usr/share/synnefo/static/`` (e.g.
1240
   ``mybranding``) and place there some or all of your images.
1241

    
1242
   If you want to replace all of your images, keep the name/extension
1243
   conventions as indicated in the above table and change the
1244
   ``BRANDING_IMAGE_MEDIA_URL`` setting accordingly:
1245

    
1246
   .. code-block:: python
1247
        
1248
      # using relative path
1249
      BRANDING_IMAGE_MEDIA_URL= '/static/mybranding/images/' 
1250

    
1251
      # or if you already host them in a separate domain (e.g. cdn)
1252
      BRANDING_IMAGE_MEDIA_URL= 'https://cdn.synnefo.org/branding/images/'
1253

    
1254

    
1255
   If you wish to replace individual images, **do not uncomment**
1256
   ``BRANDING_IMAGE_MEDIA_URL``, but instead provide a relative path, pointing to
1257
   the file inside your directory for each ``BRANDING_<image>_URL`` that you wish
1258
   to replace.
1259

    
1260
2. Upload some or all of your images to a server and replace each 
1261
   ``BRANDING_<image>_URL`` with the absolute url of the image (i.e.
1262
   ``BRANDING_DASHBOARD_URL = 'https://www.synnefo.com/images/my_dashboard.jpg'``).
1263

    
1264
   Note that the alternative text  for each image tag inside html documents is 
1265
   alt=“BRANDING_SERVICE_NAME {Dashboard, Compute. Console, Storage}” respectively.
1266

    
1267
.. note:: Retina optimized images:
1268

    
1269
   Synnefo UI is optimized for Retina displays. As far as images are concerned,  
1270
   `retina.js <http://retinajs.com/>`_ is used.
1271

    
1272
   Retina.js checks each image on a page to see if there is a high-resolution 
1273
   version of that image on your server. If a high-resolution variant exists, 
1274
   the script will swap in that image in-place.
1275

    
1276
   The script assumes you use  `Apple's prescribed high-resolution modifier (@2x)
1277
   <http://developer.apple.com/library/ios/#documentation/2DDrawing/Conceptual/
1278
   DrawingPrintingiOS/SupportingHiResScreensInViews/SupportingHiResScreensInViews
1279
   .html#//apple_ref/doc/uid/TP40010156-CH15-SW1>`_ to denote high-resolution 
1280
   image variants on your server.
1281

    
1282
   For each of the images that you wish the script to  replace, you must have a 
1283
   high-resolution variant in the same folder  named correctly and it will be 
1284
   detected automatically. For example if your image is in <my_directory> and is 
1285
   named "my_image.jpg" the script will look in the same directory for an image 
1286
   named "my_image@2x.jpg".
1287

    
1288
   In case that you don’t want to use a high-resolution image, the 
1289
   normal-resolution image will be visible.
1290

    
1291
More branding
1292
~~~~~~~~~~~~~
1293

    
1294
Although, it is not 100% branding-related, further verbal customization is
1295
feasible. 
1296

    
1297
**EMAILS**
1298

    
1299
The output of all email `*`.txt files will be already customized to contain your
1300
company and service names but you can further alter their content if you feel it
1301
best fits your needs as simple as creasynnefo template.    
1302

    
1303
In order to overwrite one or more email-templates you need to place your 
1304
modified <email-file>.txt files respecting the following structure:
1305
  
1306
  **/etc/synnefo/templates/**
1307
      **im/**
1308
          | activation_email.txt
1309
          | email.txt
1310
          | invitation.txt
1311
          | switch_accounts_email.txt
1312
          | welcome_email.txt
1313
          **projects/**
1314
              | project_approval_notification.txt
1315
              | project_denial_notification.txt    
1316
              | project_membership_change_notification.txt
1317
              | project_membership_enroll_notification.txt
1318
              | project_membership_leave_request_notification.txt
1319
              | project_membership_request_notification.txt
1320
              | project_suspension_notification.txt
1321
              | project_termination_notification.txt
1322
      **registration/**
1323
          | email_change_email.txt
1324
          | password_email.txt
1325

    
1326
Feel free to omit any of the above files you do not wish to overwrite.
1327

    
1328
Below is a list of all emails sent by Synnefo to users along with a short 
1329
description and a link to their content:
1330

    
1331
* ``snf-astakos-app/astakos/im/templates/im/email.txt``
1332
  Base email template. Contains a contact email and a “thank you” message.
1333
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/email.txt>`_)
1334
* ``snf-astakos-app/astakos/im/templates/im/activation_email.txt`` Email sent to
1335
  user that prompts  him/her to click on a link provided to activate the account.
1336
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/activation_email.txt>`_)
1337
* ``snf-astakos-app/astakos/im/templates/im/invitation.txt`` Email sent to an
1338
  invited user. He/she has to click on a link provided to activate the account.
1339
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/invitation.txt>`_)
1340
* ``snf-astakos-app/astakos/im/templates/im/switch_accounts_email.txt`` Email
1341
  sent to user upon his/her request to associate this email address with a
1342
  shibboleth account. He/she has to click on a link provided to activate the
1343
  association. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/switch_accounts_email.txt>`_)
1344
* ``snf-astakos-app/astakos/im/templates/im/welcome_email.txt`` Email sent to
1345
  inform the user that his/ her account has been activated. Extends “email.txt”
1346
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/welcome_email.txt>`_)
1347
* ``snf-astakos-app/astakos/im/templates/registration/email_change_email.txt``
1348
  Email sent to user when he/she has requested new email address assignment. The
1349
  user has to click on a link provided to validate this action. Extends
1350
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/registration/email_change_email.txt>`_)
1351
* ``snf-astakos-app/astakos/im/templates/registration/password_email.txt`` Email
1352
  sent for resetting password purpose. The user has to click on a link provided
1353
  to validate this action. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/registration/password_email.txt>`_)
1354
* ``snf-astakos-app/astakos/im/templates/im/projects/project_approval_notification.txt``
1355
  Informs  the project owner that his/her project has been approved. Extends
1356
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_approval_notification.txt>`_)
1357
* ``snf-astakos-app/astakos/im/templates/im/projects/project_denial_notification.txt``
1358
  Informs the project owner that his/her  project application has been denied
1359
  explaining the reasons. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_denial_notification.txt>`_)
1360
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt``
1361
  An email is sent to a user containing information about his project membership
1362
  (whether he has been accepted, rejected or removed). Extends “email.txt” (`Link
1363
  <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt>`_)
1364
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_enroll_notification.txt``
1365
  Informs a user that he/she  has been enrolled to a project. Extends
1366
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_enroll_notification.txt>`_)
1367
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_leave_request_notification.txt``
1368
  An email is sent to the project owner to make him aware of a  user having
1369
  requested to leave his project. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_leave_request_notification.txt>`_)
1370
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_request_notification.txt``
1371
  An email is sent to the project owner to make him/her aware of a user having
1372
  requested to join  his project. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_request_notification.txt>`_)
1373
* ``snf-astakos-app/astakos/im/templates/im/projects/project_suspension_notification.txt``
1374
  An email is sent to the project owner to make him/her aware of his/her project
1375
  having been suspended. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_suspension_notification.txt>`_)
1376
* ``snf-astakos-app/astakos/im/templates/im/projects/project_termination_notification.txt``
1377
  An email is sent to the project owner to make him/her aware of his/her project
1378
  having been terminated. Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_termination_notification.txt>`_)
1379

    
1380
.. warning:: Django templates language:
1381

    
1382
  If you choose to  overwrite these email templates, be mindful of the necessary 
1383
  information contained in django template variables that must not be omitted, 
1384
  such as the activation link for activating one’s account and many more. 
1385
  These variables are contained into {{}} inside the templates.
1386

    
1387

    
1388
.. RabbitMQ
1389

    
1390
RabbitMQ Broker
1391
---------------
1392

    
1393
Queue nodes run the RabbitMQ sofware, which provides AMQP functionality. To
1394
guarantee high-availability, more than one Queue nodes should be deployed, each
1395
of them belonging to the same `RabbitMQ cluster
1396
<http://www.rabbitmq.com/clustering.html>`_. Synnefo uses the RabbitMQ
1397
active/active `High Available Queues <http://www.rabbitmq.com/ha.html>`_ which
1398
are mirrored between two nodes within a RabbitMQ cluster.
1399

    
1400
The RabbitMQ nodes that form the cluster, are declared to Synnefo through the
1401
`AMQP_HOSTS` setting. Each time a Synnefo component needs to connect to
1402
RabbitMQ, one of these nodes is chosen in a random way. The client that Synnefo
1403
uses to connect to RabbitMQ, handles connection failures transparently and
1404
tries to reconnect to a different node. As long as one of these nodes are up
1405
and running, functionality of Synnefo should not be downgraded by the RabbitMQ
1406
node failures.
1407

    
1408
All the queues that are being used are declared as durable, meaning that
1409
messages are persistently stored to RabbitMQ, until they get successfully
1410
processed by a client.
1411

    
1412
Currently, RabbitMQ is used by the following components:
1413

    
1414
* `snf-ganeti-eventd`, `snf-ganeti-hook` and `snf-progress-monitor`:
1415
  These components send messages concerning the status and progress of
1416
  jobs in the Ganeti backend.
1417
* `snf-dispatcher`: This daemon, consumes the messages that are sent from
1418
  the above components, and updates the Cyclades DB accordingly.
1419

    
1420

    
1421
Installation
1422
~~~~~~~~~~~~
1423

    
1424
Please check the RabbitMQ documentation which covers extensively the
1425
`installation of RabbitMQ server <http://www.rabbitmq.com/download.html>`_ and
1426
the setup of a `RabbitMQ cluster <http://www.rabbitmq.com/clustering.html>`_.
1427
Also, check out the `web management plugin
1428
<http://www.rabbitmq.com/management.html>`_ that can be useful for managing and
1429
monitoring RabbitMQ.
1430

    
1431
For a basic installation of RabbitMQ on two nodes (node1 and node2) you can do
1432
the following:
1433

    
1434
On both nodes, install rabbitmq-server and create a Synnefo user:
1435

    
1436
.. code-block:: console
1437

    
1438
  $ apt-get install rabbitmq-server
1439
  $ rabbitmqctl add_user synnefo "example_pass"
1440
  $ rabbitmqctl set_permissions synnefo  ".*" ".*" ".*"
1441

    
1442
Also guarantee that both nodes share the same cookie, by running:
1443

    
1444
.. code-block:: console
1445

    
1446
  $ scp node1:/var/lib/rabbitmq/.erlang.cookie node2:/var/lib/rabbitmq/.erlang.cookie
1447

    
1448
and restart the nodes:
1449

    
1450
.. code-block:: console
1451

    
1452
  $ /etc/init.d/rabbitmq-server restart
1453

    
1454

    
1455
To setup the RabbitMQ cluster run:
1456

    
1457
.. code-block:: console
1458

    
1459
  root@node2: rabbitmqctl stop_app
1460
  root@node2: rabbitmqctl reset
1461
  root@node2: rabbitmqctl cluster rabbit@node1 rabbit@node2
1462
  root@node2: rabbitmqctl start_app
1463

    
1464
You can verify that the cluster is set up correctly by running:
1465

    
1466
.. code-block:: console
1467

    
1468
  root@node2: rabbitmqctl cluster_status
1469

    
1470

    
1471
Logging
1472
-------
1473

    
1474
Logging in Synnefo is using Python's logging module. The module is configured
1475
using dictionary configuration, whose format is described here:
1476

    
1477
http://docs.python.org/release/2.7.1/library/logging.html#logging-config-dictschema
1478

    
1479
Note that this is a feature of Python 2.7 that we have backported for use in
1480
Python 2.6.
1481

    
1482
The logging configuration dictionary is defined in
1483
``/etc/synnefo/10-snf-webproject-logging.conf``
1484

    
1485
The administrator can have finer logging control by modifying the
1486
``LOGGING_SETUP`` dictionary, and defining subloggers with different handlers
1487
and log levels.  e.g. To enable debug messages only for the API set the level
1488
of 'synnefo.api' to ``DEBUG``
1489

    
1490
By default, the Django webapp and snf-manage logs to syslog, while
1491
`snf-dispatcher` logs to `/var/log/synnefo/dispatcher.log`.
1492

    
1493

    
1494
.. _scale-up:
1495

    
1496
Scaling up to multiple nodes
1497
============================
1498

    
1499
Here we will describe how should a large scale Synnefo deployment look like. Make
1500
sure you are familiar with Synnefo and Ganeti before proceeding with this section.
1501
This means you should at least have already set up successfully a working Synnefo
1502
deployment as described in the :ref:`Admin's Installation Guide
1503
<quick-install-admin-guide>` and also read the Administrator's Guide until this
1504
section.
1505

    
1506
Graph of a scale-out Synnefo deployment
1507
---------------------------------------
1508

    
1509
Each box in the following graph corresponds to a distinct physical node:
1510

    
1511
.. image:: images/synnefo-arch2-roles.png
1512
   :width: 100%
1513
   :target: _images/synnefo-arch2-roles.png
1514

    
1515
The above graph is actually the same with the one at the beginning of this
1516
:ref:`guide <admin-guide>`, with the only difference that here we show the
1517
Synnefo roles of each physical node. These roles are described in the
1518
following section.
1519

    
1520
.. _physical-node-roles:
1521

    
1522
Physical Node roles
1523
-------------------
1524

    
1525
As appears in the previous graph, a scale-out Synnefo deployment consists of
1526
multiple physical nodes that have the following roles:
1527

    
1528
* **WEBSERVER**: A web server running in front of gunicorn (e.g.: Apache, nginx)
1529
* **ASTAKOS**: The Astakos application (gunicorn)
1530
* **ASTAKOS_DB**: The Astakos database (postgresql)
1531
* **PITHOS**: The Pithos application (gunicorn)
1532
* **PITHOS_DB**: The Pithos database (postgresql)
1533
* **CYCLADES**: The Cyclades application (gunicorn)
1534
* **CYCLADES_DB**: The Cyclades database (postgresql)
1535
* **MQ**: The message queue (RabbitMQ)
1536
* **GANETI_MASTER**: The Ganeti master of a Ganeti cluster
1537
* **GANETI_NODE** : A VM-capable Ganeti node of a Ganeti cluster
1538

    
1539
You will probably also have:
1540

    
1541
* **CMS**: The CMS used as a frotend portal for the Synnefo services
1542
* **NS**: A nameserver serving all other Synnefo nodes and resolving Synnefo FQDNs
1543
* **CLIENT**: A machine that runs the Synnefo clients (e.g.: kamaki, Web UI),
1544
              most of the times, the end user's local machine
1545

    
1546
From this point we will also refer to the following groups of roles:
1547

    
1548
* **SYNNEFO**: [ **ASTAKOS**, **ASTAKOS_DB**, **PITHOS**, **PITHOS_DB**, **CYCLADES**, **CYCLADES_DB**, **MQ**, **CMS**]
1549
* **G_BACKEND**: [**GANETI_MASTER**, **GANETI_NODE**]
1550

    
1551
Of course, when deploying Synnefo you can combine multiple of the above roles on a
1552
single physical node, but if you are trying to scale out, the above separation
1553
gives you significant advantages.
1554

    
1555
So, in the next section we will take a look on what components you will have to
1556
install on each physical node depending on its Synnefo role. We assume the graph's
1557
architecture.
1558

    
1559
Components for each role
1560
------------------------
1561

    
1562
When deploying Synnefo in large scale, you need to install different Synnefo
1563
or/and third party components on different physical nodes according to their
1564
Synnefo role, as stated in the previous section.
1565

    
1566
Specifically:
1567

    
1568
Role **WEBSERVER**
1569
    * Synnefo components: `None`
1570
    * 3rd party components: Apache
1571
Role **ASTAKOS**
1572
    * Synnefo components: `snf-webproject`, `snf-astakos-app`
1573
    * 3rd party components: Django, Gunicorn
1574
Role **ASTAKOS_DB**
1575
    * Synnefo components: `None`
1576
    * 3rd party components: PostgreSQL
1577
Role **PITHOS**
1578
    * Synnefo components: `snf-webproject`, `snf-pithos-app`, `snf-pithos-webclient`
1579
    * 3rd party components: Django, Gunicorn
1580
Role **PITHOS_DB**
1581
    * Synnefo components: `None`
1582
    * 3rd party components: PostgreSQL
1583
Role **CYCLADES**
1584
    * Synnefo components: `snf-webproject`, `snf-cyclades-app`, `snf-vncauthproxy`
1585
    * 3rd party components: Django Gunicorn
1586
Role **CYCLADES_DB**
1587
    * Synnefo components: `None`
1588
    * 3rd party components: PostgreSQL
1589
Role **MQ**
1590
    * Synnefo components: `None`
1591
    * 3rd party components: RabbitMQ
1592
Role **GANETI_MASTER**
1593
    * Synnefo components: `snf-cyclades-gtools`
1594
    * 3rd party components: Ganeti
1595
Role **GANETI_NODE**
1596
    * Synnefo components: `snf-cyclades-gtools`, `snf-network`, `snf-image`, `nfdhcpd`
1597
    * 3rd party components: Ganeti
1598
Role **CMS**
1599
    * Synnefo components: `snf-webproject`, `snf-cloudcms`
1600
    * 3rd party components: Django, Gunicorn
1601
Role **NS**
1602
    * Synnefo components: `None`
1603
    * 3rd party components: BIND
1604
Role **CLIENT**
1605
    * Synnefo components: `kamaki`, `snf-image-creator`
1606
    * 3rd party components: `None`
1607

    
1608
Example scale out installation
1609
------------------------------
1610

    
1611
In this section we describe an example of a medium scale installation which
1612
combines multiple roles on 10 different physical nodes. We also provide a
1613
:ref:`guide <i-synnefo>` to help with such an install.
1614

    
1615
We assume that we have the following 10 physical nodes with the corresponding
1616
roles:
1617

    
1618
Node1:
1619
    **WEBSERVER**, **ASTAKOS**
1620
      Guide sections:
1621
        * :ref:`apt <i-apt>`
1622
        * :ref:`gunicorn <i-gunicorn>`
1623
        * :ref:`apache <i-apache>`
1624
        * :ref:`snf-webproject <i-webproject>`
1625
        * :ref:`snf-astakos-app <i-astakos>`
1626
Node2:
1627
    **WEBSERVER**, **PITHOS**
1628
      Guide sections:
1629
        * :ref:`apt <i-apt>`
1630
        * :ref:`gunicorn <i-gunicorn>`
1631
        * :ref:`apache <i-apache>`
1632
        * :ref:`snf-webproject <i-webproject>`
1633
        * :ref:`snf-pithos-app <i-pithos>`
1634
        * :ref:`snf-pithos-webclient <i-pithos>`
1635
Node3:
1636
    **WEBSERVER**, **CYCLADES**
1637
      Guide sections:
1638
        * :ref:`apt <i-apt>`
1639
        * :ref:`gunicorn <i-gunicorn>`
1640
        * :ref:`apache <i-apache>`
1641
        * :ref:`snf-webproject <i-webproject>`
1642
        * :ref:`snf-cyclades-app <i-cyclades>`
1643
        * :ref:`snf-vncauthproxy <i-cyclades>`
1644
Node4:
1645
    **WEBSERVER**, **CMS**
1646
      Guide sections:
1647
        * :ref:`apt <i-apt>`
1648
        * :ref:`gunicorn <i-gunicorn>`
1649
        * :ref:`apache <i-apache>`
1650
        * :ref:`snf-webproject <i-webproject>`
1651
        * :ref:`snf-cloudcms <i-cms>`
1652
Node5:
1653
    **ASTAKOS_DB**, **PITHOS_DB**, **CYCLADES_DB**
1654
      Guide sections:
1655
        * :ref:`apt <i-apt>`
1656
        * :ref:`postgresql <i-db>`
1657
Node6:
1658
    **MQ**
1659
      Guide sections:
1660
        * :ref:`apt <i-apt>`
1661
        * :ref:`rabbitmq <i-mq>`
1662
Node7:
1663
    **GANETI_MASTER**, **GANETI_NODE**
1664
      Guide sections:
1665
        * :ref:`apt <i-apt>`
1666
        * :ref:`general <i-backends>`
1667
        * :ref:`ganeti <i-ganeti>`
1668
        * :ref:`snf-cyclades-gtools <i-gtools>`
1669
        * :ref:`snf-network <i-network>`
1670
        * :ref:`snf-image <i-image>`
1671
        * :ref:`nfdhcpd <i-network>`
1672
Node8:
1673
    **GANETI_NODE**
1674
      Guide sections:
1675
        * :ref:`apt <i-apt>`
1676
        * :ref:`general <i-backends>`
1677
        * :ref:`ganeti <i-ganeti>`
1678
        * :ref:`snf-cyclades-gtools <i-gtools>`
1679
        * :ref:`snf-network <i-network>`
1680
        * :ref:`snf-image <i-image>`
1681
        * :ref:`nfdhcpd <i-network>`
1682
Node9:
1683
    **GANETI_NODE**
1684
      Guide sections:
1685
        `Same as Node8`
1686
Node10:
1687
    **GANETI_NODE**
1688
      Guide sections:
1689
        `Same as Node8`
1690

    
1691
All sections: :ref:`Scale out Guide <i-synnefo>`
1692

    
1693

    
1694
Upgrade Notes
1695
=============
1696

    
1697
.. toctree::
1698
   :maxdepth: 1
1699

    
1700
   v0.12 -> v0.13 <upgrade/upgrade-0.13>
1701
   v0.13 -> v0.14 <upgrade/upgrade-0.14>
1702
   v0.14 -> v0.14.2 <upgrade/upgrade-0.14.2>
1703
   v0.14.5 -> v0.14.6 <upgrade/upgrade-0.14.6>
1704
   v0.14.7 -> v0.14.8 <upgrade/upgrade-0.14.8>
1705
   v0.14 -> v0.15 <upgrade/upgrade-0.15>
1706

    
1707

    
1708
Changelog, NEWS
1709
===============
1710

    
1711

    
1712
* v0.14.9 :ref:`Changelog <Changelog-0.14.9>`, :ref:`NEWS <NEWS-0.14.9>`
1713
* v0.14.8 :ref:`Changelog <Changelog-0.14.8>`, :ref:`NEWS <NEWS-0.14.8>`
1714
* v0.14.7 :ref:`Changelog <Changelog-0.14.7>`, :ref:`NEWS <NEWS-0.14.7>`
1715
* v0.14.6 :ref:`Changelog <Changelog-0.14.6>`, :ref:`NEWS <NEWS-0.14.6>`
1716
* v0.14.5 :ref:`Changelog <Changelog-0.14.5>`, :ref:`NEWS <NEWS-0.14.5>`
1717
* v0.14.4 :ref:`Changelog <Changelog-0.14.4>`, :ref:`NEWS <NEWS-0.14.4>`
1718
* v0.14.3 :ref:`Changelog <Changelog-0.14.3>`, :ref:`NEWS <NEWS-0.14.3>`
1719
* v0.14.2 :ref:`Changelog <Changelog-0.14.2>`, :ref:`NEWS <NEWS-0.14.2>`
1720
* v0.14 :ref:`Changelog <Changelog-0.14>`, :ref:`NEWS <NEWS-0.14>`
1721
* v0.13 :ref:`Changelog <Changelog-0.13>`, :ref:`NEWS <NEWS-0.13>`