Statistics
| Branch: | Tag: | Revision:

root / docs / admin-guide.rst @ fb814235

History | View | Annotate | Download (61.4 kB)

1
.. _admin-guide:
2

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

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

    
8

    
9

    
10
General Synnefo Architecture
11
============================
12

    
13
The following graph shows the whole Synnefo architecture and how it interacts
14
with multiple Ganeti clusters. We hope that after reading the Administrator's
15
Guide you will be able to understand every component and all the interactions
16
between them. It is a good idea to first go through the Quick Administrator's
17
Guide before proceeding.
18

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

    
23

    
24

    
25
Identity Service (Astakos)
26
==========================
27

    
28

    
29
Overview
30
--------
31

    
32
Authentication methods
33
~~~~~~~~~~~~~~~~~~~~~~
34

    
35
Local Authentication
36
````````````````````
37

    
38
LDAP Authentication
39
```````````````````
40

    
41
.. _shibboleth-auth:
42

    
43
Shibboleth Authentication
44
`````````````````````````
45

    
46
Astakos can delegate user authentication to a Shibboleth federation.
47

    
48
To setup shibboleth, install package::
49

    
50
  apt-get install libapache2-mod-shib2
51

    
52
Change appropriately the configuration files in ``/etc/shibboleth``.
53

    
54
Add in ``/etc/apache2/sites-available/synnefo-ssl``::
55

    
56
  ShibConfig /etc/shibboleth/shibboleth2.xml
57
  Alias      /shibboleth-sp /usr/share/shibboleth
58

    
59
  <Location /ui/login/shibboleth>
60
    AuthType shibboleth
61
    ShibRequireSession On
62
    ShibUseHeaders On
63
    require valid-user
64
  </Location>
65

    
66
and before the line containing::
67

    
68
  ProxyPass        / http://localhost:8080/ retry=0
69

    
70
add::
71

    
72
  ProxyPass /Shibboleth.sso !
73

    
74
Then, enable the shibboleth module::
75

    
76
  a2enmod shib2
77

    
78
After passing through the apache module, the following tokens should be
79
available at the destination::
80

    
81
  eppn # eduPersonPrincipalName
82
  Shib-InetOrgPerson-givenName
83
  Shib-Person-surname
84
  Shib-Person-commonName
85
  Shib-InetOrgPerson-displayName
86
  Shib-EP-Affiliation
87
  Shib-Session-ID
88

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

    
92
Architecture
93
------------
94

    
95
Prereqs
96
-------
97

    
98
Installation
99
------------
100

    
101
Configuration
102
-------------
103

    
104
Working with Astakos
105
--------------------
106

    
107
User registration
108
~~~~~~~~~~~~~~~~~
109

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

    
113
.. code-block:: console
114

    
115
   $ snf-manage user-list
116

    
117
More detailed user status is provided in the `status` field of the `user-show` 
118
command:
119

    
120
.. code-block:: console
121

    
122
  $ snf-manage user-show <user-id>
123

    
124
  id                  : 6
125
  uuid                : 78661411-5eed-412f-a9ea-2de24f542c2e
126
  status              : Accepted/Active (accepted policy: manual)
127
  email               : user@synnefo.org
128
  ....
129

    
130

    
131
Based on how your configuration of `astakos-app`, there are several ways for a 
132
user to get activated and be able to login. We discuss the user activation 
133
flow in the following section.
134

    
135

    
136
User activation flow
137
````````````````````
138

    
139
A user can register for an account using the astakos signup form. Once the form
140
is submited successfully a user entry is created in astakos database. That entry
141
is passed through the astakos activation backend which handles whether the user
142
should be automatically verified and activated.
143

    
144

    
145
Email verification
146
``````````````````
147

    
148
The verification process takes place in order to ensure that the user owns the
149
email provided during the signup process. By default, after each successful
150
signup astakos notifies user with an verification url via email. 
151

    
152
At this stage:
153

    
154
    * subsequent registrations invalidate and delete the previous registrations 
155
      of the same email address.
156

    
157
    * in case user misses the initial notification, additional emails can be
158
      send either via the url which is prompted to the user if he tries to
159
      login, or by the administrator using the ``snf-manage user-activation-send
160
      <userid>`` command.
161

    
162
    * administrator may also enforce a user to get verified using the
163
      ``snf-manage user-modify --verify <userid>`` command.
164

    
165

    
166
Account activation
167
``````````````````
168

    
169
Once user gets verified it is time for astakos to decide whether or not to
170
proceed through user activation process. If ``ASTAKOS_MODERATION_ENABLED``
171
setting is set to ``False`` (default value) user gets activated automatically. 
172

    
173
In case the moderation is enabled astakos may still automatically activate the
174
user in the following cases:
175

    
176
    * User email matches any of the regular expressions defined in
177
      ``ASTAKOS_RE_USER_EMAIL_PATTERNS`` (defaults to ``[]``)
178
    * User used a signup method (e.g. ``shibboleth``) for which automatic
179
      activation is enabled (see 
180
      :ref:`authentication methods policies <auth_methods_policies>`).
181

    
182
If all of the above fail to trigger automatic activation, an email is sent 
183
to the persons listed in ``HELPDESK``, ``MANAGERS`` and ``ADMINS`` settings, 
184
notifing that there is a new user pending for moderation and that it's 
185
up to the administrator to decide if the user should be activated, using the 
186
``user-modify`` command.
187

    
188
.. code-block:: console
189

    
190
    # command to activate a pending user
191
    $ snf-manage user-modify --accept <userid>
192

    
193
    # command to reject a pending user
194
    $ snf-manage user-modify --reject --reject-reason="spammer" <userid>
195

    
196
Once activation process finish, a greeting message is sent to the user email
197
address and a notification for the activation to the persons listed in 
198
``HELPDESK``, ``MANAGERS`` and ``ADMINS`` settings. Once activated the user is 
199
able to login and access the synnefo services.
200

    
201

    
202
Additional authentication methods
203
`````````````````````````````````
204

    
205
Astakos supports third party logins from external identity providers. This
206
can be usefull since it allows users to use their existing credentials to 
207
login to astakos service.
208

    
209
Currently astakos supports the following identity providers:
210

    
211
    * `Shibboleth <http://www.internet2.edu/shibboleth>`_ (module name
212
      ``shibboleth``)
213
    * `Google <https://developers.google.com/accounts/docs/OAuth2>`_ (module
214
      name ``google``)
215
    * `Twitter <https://dev.twitter.com/docs/auth>`_ (module name ``twitter``)
216
    * `LinkedIn <http://developer.linkedin.com/documents/authentication>`_
217
      (module name ``linkedin``)
218

    
219
To enable any of the above modules (by default only ``local`` accounts are
220
allowed), retrieve and set the required provider settings and append the 
221
module name in ``ASTAKOS_IM_MODULES``.
222

    
223
.. code-block:: python
224

    
225
    # settings from https://code.google.com/apis/console/
226
    ASTAKOS_GOOGLE_CLIENT_ID = '1111111111-epi60tvimgha63qqnjo40cljkojcann3.apps.googleusercontent.com'
227
    ASTAKOS_GOOGLE_SECRET = 'tNDQqTDKlTf7_LaeUcWTWwZM'
228
    
229
    # let users signup and login using their google account
230
    ASTAKOS_IM_MODULES = ['local', 'google']
231

    
232

    
233
.. _auth_methods_policies:
234

    
235
Authentication method policies
236
``````````````````````````````
237

    
238
Astakos allows you to override the default policies for each enabled provider 
239
separately by adding the approriate settings in your ``.conf`` files in the 
240
following format:
241

    
242
**ASTAKOS_AUTH_PROVIDER_<module>_<policy>_POLICY**
243

    
244
Available policies are:
245

    
246
    * **CREATE** Users can signup using that provider (default: ``True``) 
247
    * **REMOVE/ADD** Users can remove/add login method from their profile 
248
      (default: ``True``)
249
    * **AUTOMODERATE** Automatically activate users that signup using that
250
      provider (default: ``False``)
251
    * **LOGIN** Whether or not users can use the provider to login (default:
252
      ``True``).
253

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

    
257
.. code-block:: python
258

    
259
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_AUTOMODERATE_POLICY = True
260
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_REMOVE_POLICY = False
261

    
262

    
263
Setting quota limits
264
~~~~~~~~~~~~~~~~~~~~
265

    
266
Set default quota
267
`````````````````
268

    
269
In 20-snf-astakos-app-settings.conf, 
270
uncomment the default setting ``ASTAKOS_SERVICES``
271
and customize the ``'uplimit'`` values.
272
These are the default base quota for all users.
273

    
274
To apply your configuration run::
275

    
276
    # snf-manage astakos-init --load-service-resources
277
    # snf-manage quota --sync
278

    
279
Set base quota for individual users
280
```````````````````````````````````
281

    
282
For individual users that need different quota than the default
283
you can set it for each resource like this::
284

    
285
    # use this to display quota / uuid
286
    # snf-manage user-show 'uuid or email' --quota
287

    
288
    # snf-manage user-modify 'user-uuid' --set-base-quota 'cyclades.vm' 10
289

    
290

    
291
Enable the Projects feature
292
~~~~~~~~~~~~~~~~~~~~~~~~~~~
293

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

    
298
    # this will make the 'projects' page visible in the dashboard
299
    ASTAKOS_PROJECTS_VISIBLE = True
300

    
301
You can change the maximum allowed number of pending project applications
302
per user with::
303

    
304
    # snf-manage resource-modify astakos.pending_app --limit <number>
305

    
306
You can also set a user-specific limit with::
307

    
308
    # snf-manage user-modify 'user-uuid' --set-base-quota 'astakos.pending_app' 5
309

    
310
When users apply for projects they are not automatically granted
311
the resources. They must first be approved by the administrator.
312

    
313
To list pending project applications in astakos::
314

    
315
    # snf-manage project-list --pending
316

    
317
Note the last column, the application id. To approve it::
318

    
319
    # <app id> from the last column of project-list
320
    # snf-manage project-control --approve <app id>
321

    
322
To deny an application::
323

    
324
    # snf-manage project-control --deny <app id>
325

    
326
Users designated as *project admins* can approve, deny, or modify
327
an application through the web interface. In
328
``20-snf-astakos-app-settings.conf`` set::
329

    
330
    # UUIDs of users that can approve or deny project applications from the web.
331
    ASTAKOS_PROJECT_ADMINS = [<uuid>, ...]
332

    
333

    
334
Astakos advanced operations
335
---------------------------
336

    
337
Adding "Terms of Use"
338
~~~~~~~~~~~~~~~~~~~~~
339

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

    
344
.. code-block:: console
345

    
346
   <h1>~okeanos terms</h1>
347

    
348
   These are the example terms for ~okeanos
349

    
350
Then, add those terms-of-use with the snf-manage command:
351

    
352
.. code-block:: console
353

    
354
   $ snf-manage term-add /usr/share/synnefo/sample-terms.html
355

    
356
Your terms have been successfully added and you will see the corresponding link
357
appearing in the Astakos web pages' footer.
358

    
359
Enabling reCAPTCHA
360
~~~~~~~~~~~~~~~~~~
361

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

    
369
.. code-block:: console
370

    
371
   ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
372
   ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
373

    
374
   ASTAKOS_RECAPTCHA_ENABLED = True
375

    
376
Restart the service on the Astakos node(s) and you are ready:
377

    
378
.. code-block:: console
379

    
380
   # /etc/init.d/gunicorn restart
381

    
382
Checkout your new Sign up page. If you see the reCAPTCHA box, you have setup
383
everything correctly.
384

    
385

    
386

    
387
File Storage Service (Pithos)
388
=============================
389

    
390
Overview
391
--------
392

    
393
Architecture
394
------------
395

    
396
Prereqs
397
-------
398

    
399
Installation
400
------------
401

    
402
Configuration
403
-------------
404

    
405
Working with Pithos
406
-------------------
407

    
408
Pithos advanced operations
409
--------------------------
410

    
411

    
412

    
413
Compute/Network/Image Service (Cyclades)
414
========================================
415

    
416
Compute Overview
417
----------------
418

    
419
Network Overview
420
----------------
421

    
422
Image Overview
423
--------------
424

    
425
Architecture
426
------------
427

    
428
Asynchronous communication with Ganeti backends
429
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
430
Synnefo uses Google Ganeti backends for VM cluster management. In order for
431
Cyclades to be able to handle thousands of user requests, Cyclades and Ganeti
432
communicate asynchronously. Briefly, requests are submitted to Ganeti through
433
Ganeti's RAPI/HTTP interface, and then asynchronous notifications about the
434
progress of Ganeti jobs are being created and pushed upwards to Cyclades. The
435
architecture and communication with a Ganeti backend is shown in the graph
436
below:
437

    
438
.. image:: images/cyclades-ganeti-communication.png
439
   :width: 50%
440
   :target: _images/cyclades-ganeti-communication.png
441

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

    
448
While Ganeti executes the job, `snf-ganeti-eventd`, `snf-ganeti-hook` and
449
`snf-progress-monitor` are monitoring the progress of the job and send
450
corresponding messages to the RabbitMQ servers. These components are part
451
of `snf-cyclades-gtools` and must be installed on all Ganeti nodes. Specially:
452

    
453
* *snf-ganeti-eventd* sends messages about operations affecting the operating
454
  state of instances and networks. Works by monitoring the Ganeti job queue.
455
* *snf-ganeti_hook* sends messages about the NICs of instances. It includes a
456
  number of `Ganeti hooks <http://docs.ganeti.org/ganeti/2.2/html/hooks.html>`_
457
  for customisation of operations.
458
* *snf-progress_monitor* sends messages about the progress of the Image deployment
459
  phase which is done by the Ganeti OS Definition `snf-image`.
460

    
461
Finally, `snf-dispatcher` consumes messages from the RabbitMQ queues, processes
462
these messages and properly updates the state of the Cyclades DB. Subsequent
463
requests to the Cyclades API, will retrieve the updated state from the DB.
464

    
465

    
466
Prereqs
467
-------
468

    
469
Work in progress. Please refer to :ref:`quick administrator quide <quick-install-admin-guide>`.
470

    
471
Installation
472
------------
473

    
474
Work in progress. Please refer to :ref:`quick administrator quide <quick-install-admin-guide>`.
475

    
476
Configuration
477
-------------
478

    
479
Work in progress. Please refer to :ref:`quick administrator quide <quick-install-admin-guide>`.
480

    
481
Working with Cyclades
482
---------------------
483

    
484
Managing Ganeti Backends
485
~~~~~~~~~~~~~~~~~~~~~~~~
486

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

    
491
Each newly created VM is allocated to a Ganeti backend by the Cyclades backend
492
allocator. The VM is "pinned" to this backend, and can not change through its
493
lifetime. The backend allocator decides in which backend to spawn the VM based
494
on the available resources of each backend, trying to balance the load between
495
them.
496

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

    
503
Listing existing backends
504
`````````````````````````
505
To list all the Ganeti backends known to Synnefo, we run:
506

    
507
.. code-block:: console
508

    
509
   $ snf-manage backend-list
510

    
511
Adding a new Ganeti backend
512
```````````````````````````
513
Backends are dynamically added under the control of Synnefo with `snf-manage
514
backend-add` command. In this section it is assumed that a Ganeti cluster,
515
named ``cluster.example.com`` is already up and running and configured to be
516
able to host Synnefo VMs.
517

    
518
To add this Ganeti cluster, we run:
519

    
520
.. code-block:: console
521

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

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

    
530
``snf-manage backend-add`` will also create all existing private networks to
531
the new backend. You can verify that the backend is added, by running
532
`snf-manage backend-list`.
533

    
534
Note that no VMs will be spawned to this backend, since by default it is in a
535
``drained`` state after addition and also it has no public network assigned to
536
it.
537

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

    
542
.. code-block:: console
543

    
544
   $ snf-manage backend-modify --drained=False <backend_id>
545

    
546
Removing an existing Ganeti backend
547
```````````````````````````````````
548
In order to remove an existing backend from Synnefo, we run:
549

    
550
.. code-block:: console
551

    
552
   # snf-manage backend-remove <backend_id>
553

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

    
558
Allocation of VMs in Ganeti backends
559
````````````````````````````````````
560
As already mentioned, the Cyclades backend allocator is responsible for
561
allocating new VMs to backends. This allocator does not choose the exact Ganeti
562
node that will host the VM but just the Ganeti backend. The exact node is
563
chosen by the Ganeti cluster's allocator (hail).
564

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

    
570
.. code-block:: console
571

    
572
   $ snf-manage backend-modify --drained=True <backend_id>
573

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

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

    
586

    
587
Managing Virtual Machines
588
~~~~~~~~~~~~~~~~~~~~~~~~~
589

    
590
As mentioned, Cyclades uses Ganeti for management of VMs. The administrator can
591
handle Cyclades VMs just like any other Ganeti instance, via `gnt-instance`
592
commands. All Ganeti instances that belong to Synnefo, are separated from
593
others, by a prefix in their names. This prefix is defined in
594
``BACKEND_PREFIX_ID`` setting in
595
``/etc/synnefo/20-snf-cyclades-app-backend.conf``.
596

    
597
Apart from handling instances directly in the Ganeti level, a number of `snf-manage`
598
commands are available:
599

    
600
* ``snf-manage server-list``: List servers
601
* ``snf-manage server-show``: Show information about a server in the Cyclades DB
602
* ``snf-manage server-inspect``: Inspect the state of a server both in DB and Ganeti
603
* ``snf-manage server-modify``: Modify the state of a server in the Cycldes DB
604
* ``snf-manage server-create``: Create a new server
605
* ``snf-manage server-import``: Import an existing Ganeti instance to Cyclades
606

    
607

    
608
Managing Virtual Networks
609
~~~~~~~~~~~~~~~~~~~~~~~~~
610

    
611
Cyclades is able to create and manage Virtual Networks. Networking is
612
desployment specific and must be customized based on the specific needs of the
613
system administrator. For better understanding of networking please refer to
614
the :ref:`Network <networks>` section.
615

    
616
Exactly as Cyclades VMs can be handled like Ganeti instances, Cyclades Networks
617
can also by handled as Ganeti networks, via `gnt-network commands`. All Ganeti
618
networks that belong to Synnefo are named with the prefix
619
`${BACKEND_PREFIX_ID}-net-`.
620

    
621
There are also the following `snf-manage` commands for managing networks:
622

    
623
* ``snf-manage network-list``: List networks
624
* ``snf-manage network-show``: Show information about a network in the Cyclades DB
625
* ``snf-manage network-inspect``: Inspect the state of the network in DB and Ganeti backends
626
* ``snf-manage network-modify``: Modify the state of a network in the Cycldes DB
627
* ``snf-manage network-create``: Create a new network
628
* ``snf-manage network-remove``: Remove an existing network
629

    
630
Managing Network Resources
631
``````````````````````````
632

    
633
Proper operation of the Cyclades Network Service depends on the unique
634
assignment of specific resources to each type of virtual network. Specifically,
635
these resources are:
636

    
637
* IP addresses. Cyclades creates a Pool of IPs for each Network, and assigns a
638
  unique IP address to each VM, thus connecting it to this Network. You can see
639
  the IP pool of each network by running `snf-manage network-inspect
640
  <network_ID>`. IP pools are automatically created and managed by Cyclades,
641
  depending on the subnet of the Network.
642
* Bridges corresponding to physical VLANs, which are required for networks of
643
  type `PRIVATE_PHYSICAL_VLAN`.
644
* One Bridge corresponding to one physical VLAN which is required for networks of
645
  type `PRIVATE_MAC_PREFIX`.
646

    
647
Cyclades allocates those resources from pools that are created by the
648
administrator with the `snf-manage pool-create` management command.
649

    
650
Pool Creation
651
`````````````
652
Pools are created using the `snf-manage pool-create` command:
653

    
654
.. code-block:: console
655

    
656
   # snf-manage pool-create --type=bridge --base=prv --size=20
657

    
658
will create a pool of bridges, containing bridges prv1, prv2,..prv21.
659

    
660
You can verify the creation of the pool, and check its contents by running:
661

    
662
.. code-block:: console
663

    
664
   # snf-manage pool-list
665
   # snf-manage pool-show --type=bridge 1
666

    
667
With the same commands you can handle a pool of MAC prefixes. For example:
668

    
669
.. code-block:: console
670

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

    
673
will create a pool of MAC prefixes from ``aa:00:1`` to ``b9:ff:f``. The MAC
674
prefix pool is responsible for providing only unicast and locally administered
675
MAC addresses, so many of these prefixes will be externally reserved, to
676
exclude from allocation.
677

    
678
Cyclades advanced operations
679
----------------------------
680

    
681
Reconciliation mechanism
682
~~~~~~~~~~~~~~~~~~~~~~~~
683

    
684
On certain occasions, such as a Ganeti or RabbitMQ failure, the state of
685
Cyclades database may differ from the real state of VMs and networks in the
686
Ganeti backends. The reconciliation process is designed to synchronize
687
the state of the Cyclades DB with Ganeti. There are two management commands
688
for reconciling VMs and Networks
689

    
690
Reconciling Virtual Machines
691
````````````````````````````
692

    
693
Reconciliation of VMs detects the following conditions:
694

    
695
 * Stale DB servers without corresponding Ganeti instances
696
 * Orphan Ganeti instances, without corresponding DB entries
697
 * Out-of-sync state for DB entries wrt to Ganeti instances
698

    
699
To detect all inconsistencies you can just run:
700

    
701
.. code-block:: console
702

    
703
  $ snf-manage reconcile-servers
704

    
705
Adding the `--fix-all` option, will do the actual synchronization:
706

    
707
.. code-block:: console
708

    
709
  $ snf-manage reconcile --fix-all
710

    
711
Please see ``snf-manage reconcile --help`` for all the details.
712

    
713

    
714
Reconciling Networks
715
````````````````````
716

    
717
Reconciliation of Networks detects the following conditions:
718

    
719
  * Stale DB networks without corresponding Ganeti networks
720
  * Orphan Ganeti networks, without corresponding DB entries
721
  * Private networks that are not created to all Ganeti backends
722
  * Unsynchronized IP pools
723

    
724
To detect all inconsistencies you can just run:
725

    
726
.. code-block:: console
727

    
728
  $ snf-manage reconcile-networks
729

    
730
Adding the `--fix-all` option, will do the actual synchronization:
731

    
732
.. code-block:: console
733

    
734
  $ snf-manage reconcile-networks --fix-all
735

    
736
Please see ``snf-manage reconcile-networks --help`` for all the details.
737

    
738

    
739

    
740
Block Storage Service (Archipelago)
741
===================================
742

    
743
Overview
744
--------
745
Archipelago offers Copy-On-Write snapshotable volumes. Pithos images can be used
746
to provision a volume with Copy-On-Write semantics (i.e. a clone). Snapshots
747
offer a unique deduplicated image of a volume, that reflects the volume state
748
during snapshot creation and are indistinguishable from a Pithos image.
749

    
750
Archipelago is used by Cyclades and Ganeti for fast provisioning of VMs based on
751
CoW volumes. Moreover, it enables live migration of thinly-provisioned VMs with
752
no physically shared storage.
753

    
754
Archipelago Architecture
755
------------------------
756

    
757
.. image:: images/archipelago-architecture.png
758
   :width: 50%
759
   :target: _images/archipelago-architecture.png
760

    
761
.. _syn+archip+rados:
762

    
763
Overview of Synnefo + Archipelago + RADOS
764
-----------------------------------------
765

    
766
.. image:: images/synnefo-arch3.png
767
   :width: 100%
768
   :target: _images/synnefo-arch3.png
769

    
770
Prereqs
771
-------
772

    
773
The administrator must initialize the storage backend where archipelago volume
774
blocks will reside.
775

    
776
In case of a files backend, the administrator must create two directories. One
777
for the archipelago data blocks and one for the archipelago map blocks. These
778
should probably be over shared storage to enable sharing archipelago volumes
779
between multiple nodes. He or she, must also be able to supply a directory where
780
the pithos data and map blocks reside.
781

    
782
In case of a RADOS backend, the administrator must create two rados pools, one
783
for data blocks, and one for the map blocks. These pools, must be the same pools
784
used in pithos, in order to enable volume creation based on pithos images.
785

    
786
Installation
787
------------
788

    
789
Archipelago consists of
790

    
791
* ``libxseg0``: libxseg used to communicate over shared memory segments
792
* ``python-xseg``: python bindings for libxseg
793
* ``archipelago-kernel-dkms``: contains archipelago kernel modules to provide
794
  block devices to be used as vm disks
795
* ``python-archipelago``: archipelago python module. Includes archipelago and
796
  vlmc functionality.
797
* ``archipelago``: user space tools and peers for the archipelago management and
798
  volume composition
799
* ``archipelago-ganeti``: ganeti ext storage scripts, that enable ganeti to
800
  provision VMs over archipelago
801

    
802
Performing
803

    
804
.. code-block:: console
805

    
806
  $ apt-get install archipelago-ganeti 
807

    
808
should fetch all the required packages and get you up 'n going with archipelago
809

    
810
Bare in mind, that custom librados is required, which is provided in the apt
811
repo of GRNet.
812

    
813

    
814
For now, librados is a dependency of archipelago, even if you do not intend to
815
use archipelago over RADOS.
816

    
817
Configuration
818
-------------
819
Archipelago should work out of the box with a RADOS backend, but basic
820
configuration can be done in ``/etc/default/archipelago`` .
821

    
822
If you wish to change the storage backend to files, set
823

    
824
.. code-block:: console
825

    
826
   STORAGE="files"
827

    
828
and provide the appropriate settings for files storage backend in the conf file.
829

    
830
These are:
831

    
832
* ``FILED_IMAGES``: directory for archipelago data blocks.
833
* ``FILED_MAPS``: directory for archipelago map blocks.
834
* ``PITHOS``: directory of pithos data blocks.
835
* ``PITHOSMAPS``: directory of pithos map blocks.
836

    
837
The settings for RADOS storage backend are:
838

    
839
* ``RADOS_POOL_MAPS``: The pool where archipelago and pithos map blocks reside.
840
* ``RADOS_POOL_BLOCKS``: The pool where archipelago and pithos data blocks
841
  reside.
842

    
843
Examples can be found in the conf file.
844

    
845
Be aware that archipelago infrastructure doesn't provide default values for this
846
settings. If they are not set in the conf file, archipelago will not be able to
847
function.
848

    
849
Archipelago also provides ``VERBOSITY`` config options to control the output
850
generated by the userspace peers.
851

    
852
The available options are:
853

    
854
* ``VERBOSITY_BLOCKERB``
855
* ``VERBOSITY_BLOCKERM``
856
* ``VERBOSITY_MAPPER``
857
* ``VERBOSITY_VLMC``
858

    
859
and the available values are:
860

    
861
* 0 : Error only logging.
862
* 1 : Warning logging.
863
* 2 : Info logging.
864
* 3 : Debug logging. WARNING: This options produces tons of output, but the
865
  logrotate daemon should take care of it.
866

    
867
Working with Archipelago
868
------------------------
869

    
870
``archipelago`` provides basic functionality for archipelago.
871

    
872
Usage:
873

    
874
.. code-block:: console
875

    
876
  $ archipelago [-u] command
877

    
878

    
879
Currently it supports the following commands:
880

    
881
* ``start [peer]``
882
  Starts archipelago or the specified peer.
883
* ``stop [peer]``
884
  Stops archipelago or the specified peer.
885
* ``restart [peer]``
886
  Restarts archipelago or the specified peer.
887
* ``status``
888
  Show the status of archipelago.
889

    
890
Available peers: ``blockerm``, ``blockerb``, ``mapperd``, ``vlmcd``.
891

    
892

    
893
``start``, ``stop``, ``restart`` can be combined with the ``-u / --user`` option
894
to affect only the userspace peers supporting archipelago.
895

    
896

    
897

    
898
Archipelago advanced operations
899
-------------------------------
900
The ``vlmc`` tool provides a way to interact with archipelago volumes
901

    
902
* ``vlmc map <volumename>``: maps the volume to a xsegbd device.
903

    
904
* ``vlmc unmap </dev/xsegbd[1-..]>``: unmaps the specified device from the
905
  system.
906

    
907
* ``vlmc create <volumename> --snap <snapname> --size <size>``: creates a new
908
  volume named <volumename> from snapshot name <snapname> with size <size>.
909
  The ``--snap`` and ``--size`` are optional, but at least one of them is
910
  mandatory. e.g:
911

    
912
  ``vlmc create <volumename> --snap <snapname>`` creates a volume named
913
  volumename from snapshot snapname. The size of the volume is the same as
914
  the size of the snapshot.
915

    
916
  ``vlmc create <volumename> --size <size>`` creates an empty volume of size
917
  <size> named <volumename>.
918

    
919
* ``vlmc remove <volumename>``: removes the volume and all the related
920
  archipelago blocks from storage.
921

    
922
* ``vlmc list``: provides a list of archipelago volumes. Currently only works
923
  with RADOS storage backend.
924

    
925
* ``vlmc info <volumename>``: shows volume information. Currently returns only
926
  volume size.
927

    
928
* ``vlmc open <volumename>``: opens an archipelago volume. That is, taking all
929
  the necessary locks and also make the rest of the infrastructure aware of the
930
  operation.
931

    
932
  This operation succeeds if the volume is alread opened.
933

    
934
* ``vlmc close <volumename>``: closes an archipelago volume. That is, performing
935
  all the necessary functions in the insfrastrure to successfully release the
936
  volume. Also releases all the acquired locks.
937

    
938
  ``vlmc close`` should be performed after a ``vlmc open`` operation.
939

    
940
* ``vlmc lock <volumename>``: locks a volume. This step allow the administrator
941
  to lock an archipelago volume, independently from the rest of the
942
  infrastrure.
943

    
944
* ``vlmc unlock [-f] <volumename>``: unlocks a volume. This allow the
945
  administrator to unlock a volume, independently from the rest of the
946
  infrastructure.
947
  The unlock option can be performed only by the blocker that acquired the lock
948
  in the first place. To unlock a volume from another blocker, ``-f`` option
949
  must be used to break the lock.
950

    
951

    
952
Synnefo management commands ("snf-manage")
953
==========================================
954

    
955
Each Synnefo service, Astakos, Pithos and Cyclades are controlled by the
956
administrator using the "snf-manage" admin tool. This tool is an extension of
957
the Django command-line management utility. It is run on the host that runs
958
each service and provides different types of commands depending the services
959
running on the host. If you are running more than one service on the same host
960
"snf-manage" adds all the corresponding commands for each service dynamically,
961
providing a unified admin environment.
962

    
963
To run "snf-manage" you just type:
964

    
965
.. code-block:: console
966

    
967
   # snf-manage <command> [arguments]
968

    
969
on the corresponding host that runs the service. For example, if you have all
970
services running on different physical hosts you would do:
971

    
972
.. code-block:: console
973

    
974
   root@astakos-host # snf-manage <astakos-command> [argument]
975
   root@pithos-host # snf-manage <pithos-command> [argument]
976
   root@cyclades-host # snf-manage <cyclades-command> [argument]
977

    
978
If you have all services running on the same host you would do:
979

    
980
.. code-block:: console
981

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

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

    
988
.. code-block:: console
989

    
990
   root@astakos-host # snf-manage <cyclades-command> [argument]
991
   Unknown command: 'cyclades-command'
992
   Type 'snf-manage help' for usage.
993

    
994
This is the complete list of "snf-manage" commands for each service.
995

    
996
Astakos snf-manage commands
997
---------------------------
998

    
999
============================  ===========================
1000
Name                          Description
1001
============================  ===========================
1002
fix-superusers                Transform superusers created by syncdb into AstakosUser instances
1003
cleanup-full                  Cleanup sessions and session catalog
1004
commission-list               List pending commissions
1005
commission-show               Show details for a pending commission
1006
component-add                 Register a component
1007
component-list                List components
1008
component-modify              Modify component attributes
1009
project-control               Manage projects and applications
1010
project-list                  List projects
1011
project-show                  Show project details
1012
quota                         List and check the integrity of user quota
1013
reconcile-resources-astakos   Reconcile resource usage of Quotaholder with Astakos DB
1014
resource-export-astakos       Export astakos resources in json format
1015
resource-import               Register resources
1016
resource-list                 List resources
1017
resource-modify               Modify a resource's default base quota and boolean flags
1018
service-import                Register services
1019
service-list                  List services
1020
service-show                  Show service details
1021
term-add                      Add approval terms
1022
user-activation-send          Send user activation
1023
user-add                      Add user
1024
authpolicy-add                Create a new authentication provider policy profile
1025
authpolicy-list               List existing authentication provider policy profiles
1026
authpolicy-remove             Remove an authentication provider policy
1027
authpolicy-set                Assign an existing authentication provider policy profile to a user or group
1028
authpolicy-show               Show authentication provider profile details
1029
group-add                     Create a group with the given name
1030
group-list                    List available groups
1031
user-list                     List users
1032
user-modify                   Modify user
1033
user-show                     Show user details
1034
============================  ===========================
1035

    
1036
Pithos snf-manage commands
1037
--------------------------
1038

    
1039
============================  ===========================
1040
Name                          Description
1041
============================  ===========================
1042
reconcile-commissions-pithos  Display unresolved commissions and trigger their recovery
1043
resource-export-pithos        Export pithos resources in json format
1044
reconcile-resources-pithos    Detect unsynchronized usage between Astakos and Pithos DB resources and synchronize them if specified so.
1045
============================  ===========================
1046

    
1047
Cyclades snf-manage commands
1048
----------------------------
1049

    
1050
============================  ===========================
1051
Name                          Description
1052
============================  ===========================
1053
FIXME: list cyclades cmds
1054
============================  ===========================
1055

    
1056
Pithos managing accounts
1057
========================
1058

    
1059
Pithos provides a utility tool for managing accounts.
1060
To run you just type:
1061

    
1062
.. code-block:: console
1063

    
1064
   # pithos-manage-accounts <command> [arguments]
1065

    
1066
This is the list of the available commands:
1067

    
1068
============================  ===========================
1069
Name                          Description
1070
============================  ===========================
1071
delete                        Remove an account from the Pithos DB
1072
export-quota                  Export account quota in a file
1073
list                          List existing/dublicate accounts
1074
merge                         Move an account contents in another account
1075
set-container-quota           Set container quota for all or a specific account
1076
============================  ===========================
1077

    
1078

    
1079
The "kamaki" API client
1080
=======================
1081

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

    
1086
.. code-block:: console
1087

    
1088
   $ kamaki config list
1089

    
1090
To change a setting use ``kamaki config set``:
1091

    
1092
.. code-block:: console
1093

    
1094
   $ kamaki config set image.url https://cyclades.example.com/image
1095
   $ kamaki config set file.url https://pithos.example.com/v1
1096
   $ kamaki config set user.url https://accounts.example.com
1097
   $ kamaki config set token ...
1098

    
1099
To test that everything works, try authenticating the current account with
1100
kamaki:
1101

    
1102
.. code-block:: console
1103

    
1104
  $ kamaki user authenticate
1105

    
1106
This will output user information.
1107

    
1108
Upload Image
1109
------------
1110

    
1111
By convention, images are stored in a container called ``images``. Check if the
1112
container exists, by listing all containers in your account:
1113

    
1114
.. code-block:: console
1115

    
1116
   $ kamaki file list
1117

    
1118
If the container ``images`` does not exist, create it:
1119

    
1120
.. code-block:: console
1121

    
1122
  $ kamaki file create images
1123

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

    
1127
.. code-block:: console
1128

    
1129
   $ kamaki file upload ubuntu.iso images
1130

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

    
1134
.. code-block:: console
1135

    
1136
  $ kamaki file list images
1137

    
1138
The full Pithos URL for the previous example will be
1139
``pithos://u53r-un1qu3-1d/images/ubuntu.iso`` where ``u53r-un1qu3-1d`` is the
1140
unique user id (uuid).
1141

    
1142
Register Image
1143
--------------
1144

    
1145
To register an image you will need to use the full Pithos URL. To register as
1146
a public image the one from the previous example use:
1147

    
1148
.. code-block:: console
1149

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

    
1152
The ``--public`` flag is important, if missing the registered image will not
1153
be listed by ``kamaki image list``.
1154

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

    
1158
.. code-block:: console
1159

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

    
1163
To verify that the image was registered successfully use:
1164

    
1165
.. code-block:: console
1166

    
1167
   $ kamaki image list --name-like=ubuntu
1168

    
1169

    
1170
Miscellaneous
1171
=============
1172

    
1173
.. _branding:
1174

    
1175
Branding
1176
--------
1177

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

    
1183
Configuration
1184
~~~~~~~~~~~~~
1185

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

    
1191
By default, the global service name is "Synnefo" and the company name is
1192
"GRNET". These names and their respective logos and URLs are used throughout
1193
the Astakos, Pithos and Cyclades UI.
1194

    
1195
**Names and URLs:**
1196

    
1197
The first group of branding customization refers to the service's and company's
1198
information.
1199

    
1200
You can overwrite the company and the service name and URL respectively by
1201
uncommenting and setting the following:
1202

    
1203
.. code-block:: python
1204
  
1205
  # setting used in Astakos Dashboard/Projects pages
1206
  BRANDING_SERVICE_NAME = 'My cloud'
1207
  BRANDING_SERVICE_URL = 'http://www.mycloud.synnefo.org/'
1208

    
1209
  # settings used in Astakos, Pithos, Cyclades footer only if 
1210
  # BRANDING_SHOW_COPYRIGHT is set to True
1211
  BRANDING_SHOW_COPYRIGHT = True
1212
  BRANDING_COMPANY_NAME = 'Company LTD'
1213
  BRANDING_COMPANY_URL = 'https://www.company-ltd.synnefo.org/'
1214

    
1215

    
1216
**Copyright options:**
1217

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

    
1222
.. code-block:: python
1223

    
1224
  #BRANDING_SHOW_COPYRIGHT = False
1225

    
1226
Copyright message defaults to 'Copyright (c) 2011-<current_year>
1227
<BRANDING_COMPANY_NAME>.' but you can overwrite it to a completely custom one by
1228
setting the following option:
1229

    
1230
.. code-block:: python
1231

    
1232
  BRANDING_COPYRIGHT_MESSAGE = 'Copyright (c) 2011-2013 GRNET'
1233

    
1234

    
1235
**Images:**
1236

    
1237
The Astakos, Pithos and Cyclades Web UI has some logos and images.
1238
 
1239
The branding-related images are presented in  the following table:
1240

    
1241
===============  ============================  =========
1242
Image            Name/extension  convention    Usage
1243
===============  ============================  =========
1244
Favicon          favicon.ico                   Favicon for all services
1245
Dashboard logo   dashboard_logo.png            Visible in all Astakos UI pages
1246
Compute logo     compute_logo.png              Visible in all Cyclades UI pages
1247
Console logo     console_logo.png              Visible in the Cyclades Console Window
1248
Storage logo     storage_logo.png              Visible in all Pithos UI pages
1249
===============  ============================  =========
1250

    
1251
There are two methods  available for replacing all, or individual, 
1252
branding-related images:
1253

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

    
1257
   If you want to replace all of your images, keep the name/extension
1258
   conventions as indicated in the above table and change the
1259
   ``BRANDING_IMAGE_MEDIA_URL`` setting accordingly:
1260

    
1261
   .. code-block:: python
1262
        
1263
      # using relative path
1264
      BRANDING_IMAGE_MEDIA_URL= '/static/mybranding/images/' 
1265

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

    
1269

    
1270
   If you wish to replace individual images, **do not uncomment**
1271
   ``BRANDING_IMAGE_MEDIA_URL``, but instead provide a relative path, pointing to
1272
   the file inside your directory for each ``BRANDING_<image>_URL`` that you wish
1273
   to replace.
1274

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

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

    
1282
.. note:: Retina optimized images:
1283

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

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

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

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

    
1303
   In case that you don’t want to use a high-resolution image, the 
1304
   normal-resolution image will be visible.
1305

    
1306
More branding
1307
~~~~~~~~~~~~~
1308

    
1309
Although, it is not 100% branding-related, further verbal customization is
1310
feasible. 
1311

    
1312
**EMAILS**
1313

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

    
1318
In order to overwrite one or more email-templates you need to place your 
1319
modified <email-file>.txt files respecting the following structure:
1320
  
1321
  **/etc/synnefo/templates/**
1322
      **im/**
1323
          | activation_email.txt
1324
          | email.txt
1325
          | invitation.txt
1326
          | switch_accounts_email.txt
1327
          | welcome_email.txt
1328
          **projects/**
1329
              | project_approval_notification.txt
1330
              | project_denial_notification.txt    
1331
              | project_membership_change_notification.txt
1332
              | project_membership_enroll_notification.txt
1333
              | project_membership_leave_request_notification.txt
1334
              | project_membership_request_notification.txt
1335
              | project_suspension_notification.txt
1336
              | project_termination_notification.txt
1337
      **registration/**
1338
          | email_change_email.txt
1339
          | password_email.txt
1340

    
1341
Feel free to omit any of the above files you do not wish to overwrite.
1342

    
1343
Below is a list of all emails sent by Synnefo to users along with a short 
1344
description and a link to their content:
1345

    
1346
* ``snf-astakos-app/astakos/im/templates/im/email.txt``
1347
  Base email template. Contains a contact email and a “thank you” message.
1348
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/email.txt>`_)
1349
* ``snf-astakos-app/astakos/im/templates/im/activation_email.txt`` Email sent to
1350
  user that prompts  him/her to click on a link provided to activate the account.
1351
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/activation_email.txt>`_)
1352
* ``snf-astakos-app/astakos/im/templates/im/invitation.txt`` Email sent to an
1353
  invited user. He/she has to click on a link provided to activate the account.
1354
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/invitation.txt>`_)
1355
* ``snf-astakos-app/astakos/im/templates/im/switch_accounts_email.txt`` Email
1356
  sent to user upon his/her request to associate this email address with a
1357
  shibboleth account. He/she has to click on a link provided to activate the
1358
  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>`_)
1359
* ``snf-astakos-app/astakos/im/templates/im/welcome_email.txt`` Email sent to
1360
  inform the user that his/ her account has been activated. Extends “email.txt”
1361
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/welcome_email.txt>`_)
1362
* ``snf-astakos-app/astakos/im/templates/registration/email_change_email.txt``
1363
  Email sent to user when he/she has requested new email address assignment. The
1364
  user has to click on a link provided to validate this action. Extends
1365
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/registration/email_change_email.txt>`_)
1366
* ``snf-astakos-app/astakos/im/templates/registration/password_email.txt`` Email
1367
  sent for resetting password purpose. The user has to click on a link provided
1368
  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>`_)
1369
* ``snf-astakos-app/astakos/im/templates/im/projects/project_approval_notification.txt``
1370
  Informs  the project owner that his/her project has been approved. Extends
1371
  “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>`_)
1372
* ``snf-astakos-app/astakos/im/templates/im/projects/project_denial_notification.txt``
1373
  Informs the project owner that his/her  project application has been denied
1374
  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>`_)
1375
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt``
1376
  An email is sent to a user containing information about his project membership
1377
  (whether he has been accepted, rejected or removed). Extends “email.txt” (`Link
1378
  <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt>`_)
1379
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_enroll_notification.txt``
1380
  Informs a user that he/she  has been enrolled to a project. Extends
1381
  “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>`_)
1382
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_leave_request_notification.txt``
1383
  An email is sent to the project owner to make him aware of a  user having
1384
  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>`_)
1385
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_request_notification.txt``
1386
  An email is sent to the project owner to make him/her aware of a user having
1387
  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>`_)
1388
* ``snf-astakos-app/astakos/im/templates/im/projects/project_suspension_notification.txt``
1389
  An email is sent to the project owner to make him/her aware of his/her project
1390
  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>`_)
1391
* ``snf-astakos-app/astakos/im/templates/im/projects/project_termination_notification.txt``
1392
  An email is sent to the project owner to make him/her aware of his/her project
1393
  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>`_)
1394

    
1395
.. warning:: Django templates language:
1396

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

    
1402

    
1403
.. RabbitMQ
1404

    
1405
RabbitMQ Broker
1406
---------------
1407

    
1408
Queue nodes run the RabbitMQ sofware, which provides AMQP functionality. To
1409
guarantee high-availability, more than one Queue nodes should be deployed, each
1410
of them belonging to the same `RabbitMQ cluster
1411
<http://www.rabbitmq.com/clustering.html>`_. Synnefo uses the RabbitMQ
1412
active/active `High Available Queues <http://www.rabbitmq.com/ha.html>`_ which
1413
are mirrored between two nodes within a RabbitMQ cluster.
1414

    
1415
The RabbitMQ nodes that form the cluster, are declared to Synnefo through the
1416
`AMQP_HOSTS` setting. Each time a Synnefo component needs to connect to
1417
RabbitMQ, one of these nodes is chosen in a random way. The client that Synnefo
1418
uses to connect to RabbitMQ, handles connection failures transparently and
1419
tries to reconnect to a different node. As long as one of these nodes are up
1420
and running, functionality of Synnefo should not be downgraded by the RabbitMQ
1421
node failures.
1422

    
1423
All the queues that are being used are declared as durable, meaning that
1424
messages are persistently stored to RabbitMQ, until they get successfully
1425
processed by a client.
1426

    
1427
Currently, RabbitMQ is used by the following components:
1428

    
1429
* `snf-ganeti-eventd`, `snf-ganeti-hook` and `snf-progress-monitor`:
1430
  These components send messages concerning the status and progress of
1431
  jobs in the Ganeti backend.
1432
* `snf-dispatcher`: This daemon, consumes the messages that are sent from
1433
  the above components, and updates the Cyclades DB accordingly.
1434

    
1435

    
1436
Installation
1437
~~~~~~~~~~~~
1438

    
1439
Please check the RabbitMQ documentation which covers extensively the
1440
`installation of RabbitMQ server <http://www.rabbitmq.com/download.html>`_ and
1441
the setup of a `RabbitMQ cluster <http://www.rabbitmq.com/clustering.html>`_.
1442
Also, check out the `web management plugin
1443
<http://www.rabbitmq.com/management.html>`_ that can be useful for managing and
1444
monitoring RabbitMQ.
1445

    
1446
For a basic installation of RabbitMQ on two nodes (node1 and node2) you can do
1447
the following:
1448

    
1449
On both nodes, install rabbitmq-server and create a Synnefo user:
1450

    
1451
.. code-block:: console
1452

    
1453
  $ apt-get install rabbitmq-server
1454
  $ rabbitmqctl add_user synnefo "example_pass"
1455
  $ rabbitmqctl set_permissions synnefo  ".*" ".*" ".*"
1456

    
1457
Also guarantee that both nodes share the same cookie, by running:
1458

    
1459
.. code-block:: console
1460

    
1461
  $ scp node1:/var/lib/rabbitmq/.erlang.cookie node2:/var/lib/rabbitmq/.erlang.cookie
1462

    
1463
and restart the nodes:
1464

    
1465
.. code-block:: console
1466

    
1467
  $ /etc/init.d/rabbitmq-server restart
1468

    
1469

    
1470
To setup the RabbitMQ cluster run:
1471

    
1472
.. code-block:: console
1473

    
1474
  root@node2: rabbitmqctl stop_app
1475
  root@node2: rabbitmqctl reset
1476
  root@node2: rabbitmqctl cluster rabbit@node1 rabbit@node2
1477
  root@node2: rabbitmqctl start_app
1478

    
1479
You can verify that the cluster is set up correctly by running:
1480

    
1481
.. code-block:: console
1482

    
1483
  root@node2: rabbitmqctl cluster_status
1484

    
1485

    
1486
Logging
1487
-------
1488

    
1489
Logging in Synnefo is using Python's logging module. The module is configured
1490
using dictionary configuration, whose format is described here:
1491

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

    
1494
Note that this is a feature of Python 2.7 that we have backported for use in
1495
Python 2.6.
1496

    
1497
The logging configuration dictionary is defined in
1498
``/etc/synnefo/10-snf-webproject-logging.conf``
1499

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

    
1505
By default, the Django webapp and snf-manage logs to syslog, while
1506
`snf-dispatcher` logs to `/var/log/synnefo/dispatcher.log`.
1507

    
1508

    
1509
.. _scale-up:
1510

    
1511
Scaling up to multiple nodes
1512
============================
1513

    
1514
Here we will describe how should a large scale Synnefo deployment look like. Make
1515
sure you are familiar with Synnefo and Ganeti before proceeding with this section.
1516
This means you should at least have already set up successfully a working Synnefo
1517
deployment as described in the :ref:`Admin's Quick Installation Guide
1518
<quick-install-admin-guide>` and also read the Administrator's Guide until this
1519
section.
1520

    
1521
Graph of a scale-out Synnefo deployment
1522
---------------------------------------
1523

    
1524
Each box in the following graph corresponds to a distinct physical node:
1525

    
1526
.. image:: images/synnefo-arch2-roles.png
1527
   :width: 100%
1528
   :target: _images/synnefo-arch2-roles.png
1529

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

    
1535
.. _physical-node-roles:
1536

    
1537
Physical Node roles
1538
-------------------
1539

    
1540
As appears in the previous graph, a scale-out Synnefo deployment consists of
1541
multiple physical nodes that have the following roles:
1542

    
1543
* **WEBSERVER**: A web server running in front of gunicorn (e.g.: Apache, nginx)
1544
* **ASTAKOS**: The Astakos application (gunicorn)
1545
* **ASTAKOS_DB**: The Astakos database (postgresql)
1546
* **PITHOS**: The Pithos application (gunicorn)
1547
* **PITHOS_DB**: The Pithos database (postgresql)
1548
* **CYCLADES**: The Cyclades application (gunicorn)
1549
* **CYCLADES_DB**: The Cyclades database (postgresql)
1550
* **MQ**: The message queue (RabbitMQ)
1551
* **GANETI_MASTER**: The Ganeti master of a Ganeti cluster
1552
* **GANETI_NODE** : A VM-capable Ganeti node of a Ganeti cluster
1553

    
1554
You will probably also have:
1555

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

    
1561
From this point we will also refer to the following groups of roles:
1562

    
1563
* **SYNNEFO**: [ **ASTAKOS**, **ASTAKOS_DB**, **PITHOS**, **PITHOS_DB**, **CYCLADES**, **CYCLADES_DB**, **MQ**, **CMS**]
1564
* **G_BACKEND**: [**GANETI_MASTER**, **GANETI_NODE**]
1565

    
1566
Of course, when deploying Synnefo you can combine multiple of the above roles on a
1567
single physical node, but if you are trying to scale out, the above separation
1568
gives you significant advantages.
1569

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

    
1574
Components for each role
1575
------------------------
1576

    
1577
When deploying Synnefo in large scale, you need to install different Synnefo
1578
or/and third party components on different physical nodes according to their
1579
Synnefo role, as stated in the previous section.
1580

    
1581
Specifically:
1582

    
1583
Role **WEBSERVER**
1584
    * Synnefo components: `None`
1585
    * 3rd party components: Apache
1586
Role **ASTAKOS**
1587
    * Synnefo components: `snf-webproject`, `snf-astakos-app`
1588
    * 3rd party components: Django, Gunicorn
1589
Role **ASTAKOS_DB**
1590
    * Synnefo components: `None`
1591
    * 3rd party components: PostgreSQL
1592
Role **PITHOS**
1593
    * Synnefo components: `snf-webproject`, `snf-pithos-app`, `snf-pithos-webclient`
1594
    * 3rd party components: Django, Gunicorn
1595
Role **PITHOS_DB**
1596
    * Synnefo components: `None`
1597
    * 3rd party components: PostgreSQL
1598
Role **CYCLADES**
1599
    * Synnefo components: `snf-webproject`, `snf-cyclades-app`, `snf-vncauthproxy`
1600
    * 3rd party components: Django Gunicorn
1601
Role **CYCLADES_DB**
1602
    * Synnefo components: `None`
1603
    * 3rd party components: PostgreSQL
1604
Role **MQ**
1605
    * Synnefo components: `None`
1606
    * 3rd party components: RabbitMQ
1607
Role **GANETI_MASTER**
1608
    * Synnefo components: `snf-cyclades-gtools`
1609
    * 3rd party components: Ganeti
1610
Role **GANETI_NODE**
1611
    * Synnefo components: `snf-cyclades-gtools`, `snf-network`, `snf-image`, `nfdhcpd`
1612
    * 3rd party components: Ganeti
1613
Role **CMS**
1614
    * Synnefo components: `snf-webproject`, `snf-cloudcms`
1615
    * 3rd party components: Django, Gunicorn
1616
Role **NS**
1617
    * Synnefo components: `None`
1618
    * 3rd party components: BIND
1619
Role **CLIENT**
1620
    * Synnefo components: `kamaki`, `snf-image-creator`
1621
    * 3rd party components: `None`
1622

    
1623
Example scale out installation
1624
------------------------------
1625

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

    
1630
We assume that we have the following 10 physical nodes with the corresponding
1631
roles:
1632

    
1633
Node1:
1634
    **WEBSERVER**, **ASTAKOS**
1635
      Guide sections:
1636
        * :ref:`apt <i-apt>`
1637
        * :ref:`gunicorn <i-gunicorn>`
1638
        * :ref:`apache <i-apache>`
1639
        * :ref:`snf-webproject <i-webproject>`
1640
        * :ref:`snf-astakos-app <i-astakos>`
1641
Node2:
1642
    **WEBSERVER**, **PITHOS**
1643
      Guide sections:
1644
        * :ref:`apt <i-apt>`
1645
        * :ref:`gunicorn <i-gunicorn>`
1646
        * :ref:`apache <i-apache>`
1647
        * :ref:`snf-webproject <i-webproject>`
1648
        * :ref:`snf-pithos-app <i-pithos>`
1649
        * :ref:`snf-pithos-webclient <i-pithos>`
1650
Node3:
1651
    **WEBSERVER**, **CYCLADES**
1652
      Guide sections:
1653
        * :ref:`apt <i-apt>`
1654
        * :ref:`gunicorn <i-gunicorn>`
1655
        * :ref:`apache <i-apache>`
1656
        * :ref:`snf-webproject <i-webproject>`
1657
        * :ref:`snf-cyclades-app <i-cyclades>`
1658
        * :ref:`snf-vncauthproxy <i-cyclades>`
1659
Node4:
1660
    **WEBSERVER**, **CMS**
1661
      Guide sections:
1662
        * :ref:`apt <i-apt>`
1663
        * :ref:`gunicorn <i-gunicorn>`
1664
        * :ref:`apache <i-apache>`
1665
        * :ref:`snf-webproject <i-webproject>`
1666
        * :ref:`snf-cloudcms <i-cms>`
1667
Node5:
1668
    **ASTAKOS_DB**, **PITHOS_DB**, **CYCLADES_DB**
1669
      Guide sections:
1670
        * :ref:`apt <i-apt>`
1671
        * :ref:`postgresql <i-db>`
1672
Node6:
1673
    **MQ**
1674
      Guide sections:
1675
        * :ref:`apt <i-apt>`
1676
        * :ref:`rabbitmq <i-mq>`
1677
Node7:
1678
    **GANETI_MASTER**, **GANETI_NODE**
1679
      Guide sections:
1680
        * :ref:`apt <i-apt>`
1681
        * :ref:`general <i-backends>`
1682
        * :ref:`ganeti <i-ganeti>`
1683
        * :ref:`snf-cyclades-gtools <i-gtools>`
1684
        * :ref:`snf-network <i-network>`
1685
        * :ref:`snf-image <i-image>`
1686
        * :ref:`nfdhcpd <i-network>`
1687
Node8:
1688
    **GANETI_NODE**
1689
      Guide sections:
1690
        * :ref:`apt <i-apt>`
1691
        * :ref:`general <i-backends>`
1692
        * :ref:`ganeti <i-ganeti>`
1693
        * :ref:`snf-cyclades-gtools <i-gtools>`
1694
        * :ref:`snf-network <i-network>`
1695
        * :ref:`snf-image <i-image>`
1696
        * :ref:`nfdhcpd <i-network>`
1697
Node9:
1698
    **GANETI_NODE**
1699
      Guide sections:
1700
        `Same as Node8`
1701
Node10:
1702
    **GANETI_NODE**
1703
      Guide sections:
1704
        `Same as Node8`
1705

    
1706
All sections: :ref:`Scale out Guide <i-synnefo>`
1707

    
1708

    
1709
Upgrade Notes
1710
=============
1711

    
1712
.. toctree::
1713
   :maxdepth: 1
1714

    
1715
   v0.12 -> v0.13 <upgrade/upgrade-0.13>
1716

    
1717

    
1718
Changelog, NEWS
1719
===============
1720

    
1721
* v0.13 :ref:`Changelog <Changelog-0.13>`, :ref:`NEWS <NEWS-0.13>`