Statistics
| Branch: | Tag: | Revision:

root / docs / admin-guide.rst @ a39b3e16

History | View | Annotate | Download (56.7 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 /im/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 activation methods
108
~~~~~~~~~~~~~~~~~~~~~~~
109

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

    
113
.. code-block:: console
114

    
115
   $ snf-manage user-list
116

    
117
There are two different ways to activate a new user. Both need access to a
118
running :ref:`mail server <mail-server>`.
119

    
120
Manual activation
121
`````````````````
122

    
123
You can manually activate a new user that has already signed up, by sending
124
him/her an activation email. The email will contain an approriate activation
125
link, which will complete the activation process if followed. You can send the
126
email by running:
127

    
128
.. code-block:: console
129

    
130
   $ snf-manage user-activation-send <user ID or email>
131

    
132
Be sure to have already setup your mail server and defined it in your Synnefo
133
settings, before running the command.
134

    
135
Automatic activation
136
````````````````````
137

    
138
FIXME: Describe Regex activation method
139

    
140
Setting quota limits
141
~~~~~~~~~~~~~~~~~~~~
142

    
143
Set default quota
144
`````````````````
145

    
146
In 20-snf-astakos-app-settings.conf, 
147
uncomment the default setting ``ASTAKOS_SERVICES``
148
and customize the ``'uplimit'`` values.
149
These are the default base quota for all users.
150

    
151
To apply your configuration run::
152

    
153
    # snf-manage astakos-init --load-service-resources
154
    # snf-manage quota --sync
155

    
156
Set base quota for individual users
157
```````````````````````````````````
158

    
159
For individual users that need different quota than the default
160
you can set it for each resource like this::
161

    
162
    # use this to display quota / uuid
163
    # snf-manage user-show 'uuid or email' --quota
164

    
165
    # snf-manage user-modify 'user-uuid' --set-base-quota 'cyclades.vm' 10
166

    
167

    
168
Enable the Projects feature
169
~~~~~~~~~~~~~~~~~~~~~~~~~~~
170

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

    
175
    # this will make the 'projects' page visible in the dashboard
176
    ASTAKOS_PROJECTS_VISIBLE = True
177

    
178
You can change the maximum allowed number of pending project applications
179
per user with::
180

    
181
    # snf-manage resource-modify astakos.pending_app --limit <number>
182

    
183
You can also set a user-specific limit with::
184

    
185
    # snf-manage user-modify 'user-uuid' --set-base-quota 'astakos.pending_app' 5
186

    
187
When users apply for projects they are not automatically granted
188
the resources. They must first be approved by the administrator.
189

    
190
To list pending project applications in astakos::
191

    
192
    # snf-manage project-list --pending
193

    
194
Note the last column, the application id. To approve it::
195

    
196
    # <app id> from the last column of project-list
197
    # snf-manage project-control --approve <app id>
198

    
199
To deny an application::
200

    
201
    # snf-manage project-control --deny <app id>
202

    
203
Users designated as *project admins* can approve, deny, or modify
204
an application through the web interface. In
205
``20-snf-astakos-app-settings.conf`` set::
206

    
207
    # UUIDs of users that can approve or deny project applications from the web.
208
    ASTAKOS_PROJECT_ADMINS = [<uuid>, ...]
209

    
210

    
211
Astakos advanced operations
212
---------------------------
213

    
214
Adding "Terms of Use"
215
~~~~~~~~~~~~~~~~~~~~~
216

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

    
221
.. code-block:: console
222

    
223
   <h1>~okeanos terms</h1>
224

    
225
   These are the example terms for ~okeanos
226

    
227
Then, add those terms-of-use with the snf-manage command:
228

    
229
.. code-block:: console
230

    
231
   $ snf-manage term-add /usr/share/synnefo/sample-terms.html
232

    
233
Your terms have been successfully added and you will see the corresponding link
234
appearing in the Astakos web pages' footer.
235

    
236
Enabling reCAPTCHA
237
~~~~~~~~~~~~~~~~~~
238

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

    
246
.. code-block:: console
247

    
248
   ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
249
   ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
250

    
251
   ASTAKOS_RECAPTCHA_ENABLED = True
252

    
253
Restart the service on the Astakos node(s) and you are ready:
254

    
255
.. code-block:: console
256

    
257
   # /etc/init.d/gunicorn restart
258

    
259
Checkout your new Sign up page. If you see the reCAPTCHA box, you have setup
260
everything correctly.
261

    
262

    
263

    
264
File Storage Service (Pithos)
265
=============================
266

    
267
Overview
268
--------
269

    
270
Architecture
271
------------
272

    
273
Prereqs
274
-------
275

    
276
Installation
277
------------
278

    
279
Configuration
280
-------------
281

    
282
Working with Pithos
283
-------------------
284

    
285
Pithos advanced operations
286
--------------------------
287

    
288

    
289

    
290
Compute/Network/Image Service (Cyclades)
291
========================================
292

    
293
Compute Overview
294
----------------
295

    
296
Network Overview
297
----------------
298

    
299
Image Overview
300
--------------
301

    
302
Architecture
303
------------
304

    
305
Asynchronous communication with Ganeti backends
306
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307
Synnefo uses Google Ganeti backends for VM cluster management. In order for
308
Cyclades to be able to handle thousands of user requests, Cyclades and Ganeti
309
communicate asynchronously. Briefly, requests are submitted to Ganeti through
310
Ganeti's RAPI/HTTP interface, and then asynchronous notifications about the
311
progress of Ganeti jobs are being created and pushed upwards to Cyclades. The
312
architecture and communication with a Ganeti backend is shown in the graph
313
below:
314

    
315
.. image:: images/cyclades-ganeti-communication.png
316
   :width: 50%
317
   :target: _images/cyclades-ganeti-communication.png
318

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

    
325
While Ganeti executes the job, `snf-ganeti-eventd`, `snf-ganeti-hook` and
326
`snf-progress-monitor` are monitoring the progress of the job and send
327
corresponding messages to the RabbitMQ servers. These components are part
328
of `snf-cyclades-gtools` and must be installed on all Ganeti nodes. Specially:
329

    
330
* *snf-ganeti-eventd* sends messages about operations affecting the operating
331
  state of instances and networks. Works by monitoring the Ganeti job queue.
332
* *snf-ganeti_hook* sends messages about the NICs of instances. It includes a
333
  number of `Ganeti hooks <http://docs.ganeti.org/ganeti/2.2/html/hooks.html>`_
334
  for customisation of operations.
335
* *snf-progress_monitor* sends messages about the progress of the Image deployment
336
  phase which is done by the Ganeti OS Definition `snf-image`.
337

    
338
Finally, `snf-dispatcher` consumes messages from the RabbitMQ queues, processes
339
these messages and properly updates the state of the Cyclades DB. Subsequent
340
requests to the Cyclades API, will retrieve the updated state from the DB.
341

    
342

    
343
Prereqs
344
-------
345

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

    
348
Installation
349
------------
350

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

    
353
Configuration
354
-------------
355

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

    
358
Working with Cyclades
359
---------------------
360

    
361
Managing Ganeti Backends
362
~~~~~~~~~~~~~~~~~~~~~~~~
363

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

    
368
Each newly created VM is allocated to a Ganeti backend by the Cyclades backend
369
allocator. The VM is "pinned" to this backend, and can not change through its
370
lifetime. The backend allocator decides in which backend to spawn the VM based
371
on the available resources of each backend, trying to balance the load between
372
them.
373

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

    
380
Listing existing backends
381
`````````````````````````
382
To list all the Ganeti backends known to Synnefo, we run:
383

    
384
.. code-block:: console
385

    
386
   $ snf-manage backend-list
387

    
388
Adding a new Ganeti backend
389
```````````````````````````
390
Backends are dynamically added under the control of Synnefo with `snf-manage
391
backend-add` command. In this section it is assumed that a Ganeti cluster,
392
named ``cluster.example.com`` is already up and running and configured to be
393
able to host Synnefo VMs.
394

    
395
To add this Ganeti cluster, we run:
396

    
397
.. code-block:: console
398

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

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

    
407
``snf-manage backend-add`` will also create all existing private networks to
408
the new backend. You can verify that the backend is added, by running
409
`snf-manage backend-list`.
410

    
411
Note that no VMs will be spawned to this backend, since by default it is in a
412
``drained`` state after addition and also it has no public network assigned to
413
it.
414

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

    
419
.. code-block:: console
420

    
421
   $ snf-manage backend-modify --drained=False <backend_id>
422

    
423
Removing an existing Ganeti backend
424
```````````````````````````````````
425
In order to remove an existing backend from Synnefo, we run:
426

    
427
.. code-block:: console
428

    
429
   # snf-manage backend-remove <backend_id>
430

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

    
435
Allocation of VMs in Ganeti backends
436
````````````````````````````````````
437
As already mentioned, the Cyclades backend allocator is responsible for
438
allocating new VMs to backends. This allocator does not choose the exact Ganeti
439
node that will host the VM but just the Ganeti backend. The exact node is
440
chosen by the Ganeti cluster's allocator (hail).
441

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

    
447
.. code-block:: console
448

    
449
   $ snf-manage backend-modify --drained=True <backend_id>
450

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

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

    
463

    
464
Managing Virtual Machines
465
~~~~~~~~~~~~~~~~~~~~~~~~~
466

    
467
As mentioned, Cyclades uses Ganeti for management of VMs. The administrator can
468
handle Cyclades VMs just like any other Ganeti instance, via `gnt-instance`
469
commands. All Ganeti instances that belong to Synnefo, are separated from
470
others, by a prefix in their names. This prefix is defined in
471
``BACKEND_PREFIX_ID`` setting in
472
``/etc/synnefo/20-snf-cyclades-app-backend.conf``.
473

    
474
Apart from handling instances directly in the Ganeti level, a number of `snf-manage`
475
commands are available:
476

    
477
* ``snf-manage server-list``: List servers
478
* ``snf-manage server-show``: Show information about a server in the Cyclades DB
479
* ``snf-manage server-inspect``: Inspect the state of a server both in DB and Ganeti
480
* ``snf-manage server-modify``: Modify the state of a server in the Cycldes DB
481
* ``snf-manage server-create``: Create a new server
482
* ``snf-manage server-import``: Import an existing Ganeti instance to Cyclades
483

    
484

    
485
Managing Virtual Networks
486
~~~~~~~~~~~~~~~~~~~~~~~~~
487

    
488
Cyclades is able to create and manage Virtual Networks. Networking is
489
desployment specific and must be customized based on the specific needs of the
490
system administrator. For better understanding of networking please refer to
491
the :ref:`Network <networks>` section.
492

    
493
Exactly as Cyclades VMs can be handled like Ganeti instances, Cyclades Networks
494
can also by handled as Ganeti networks, via `gnt-network commands`. All Ganeti
495
networks that belong to Synnefo are named with the prefix
496
`${BACKEND_PREFIX_ID}-net-`.
497

    
498
There are also the following `snf-manage` commands for managing networks:
499

    
500
* ``snf-manage network-list``: List networks
501
* ``snf-manage network-show``: Show information about a network in the Cyclades DB
502
* ``snf-manage network-inspect``: Inspect the state of the network in DB and Ganeti backends
503
* ``snf-manage network-modify``: Modify the state of a network in the Cycldes DB
504
* ``snf-manage network-create``: Create a new network
505
* ``snf-manage network-remove``: Remove an existing network
506

    
507
Managing Network Resources
508
``````````````````````````
509

    
510
Proper operation of the Cyclades Network Service depends on the unique
511
assignment of specific resources to each type of virtual network. Specifically,
512
these resources are:
513

    
514
* IP addresses. Cyclades creates a Pool of IPs for each Network, and assigns a
515
  unique IP address to each VM, thus connecting it to this Network. You can see
516
  the IP pool of each network by running `snf-manage network-inspect
517
  <network_ID>`. IP pools are automatically created and managed by Cyclades,
518
  depending on the subnet of the Network.
519
* Bridges corresponding to physical VLANs, which are required for networks of
520
  type `PRIVATE_PHYSICAL_VLAN`.
521
* One Bridge corresponding to one physical VLAN which is required for networks of
522
  type `PRIVATE_MAC_PREFIX`.
523

    
524
Cyclades allocates those resources from pools that are created by the
525
administrator with the `snf-manage pool-create` management command.
526

    
527
Pool Creation
528
`````````````
529
Pools are created using the `snf-manage pool-create` command:
530

    
531
.. code-block:: console
532

    
533
   # snf-manage pool-create --type=bridge --base=prv --size=20
534

    
535
will create a pool of bridges, containing bridges prv1, prv2,..prv21.
536

    
537
You can verify the creation of the pool, and check its contents by running:
538

    
539
.. code-block:: console
540

    
541
   # snf-manage pool-list
542
   # snf-manage pool-show --type=bridge 1
543

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

    
546
.. code-block:: console
547

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

    
550
will create a pool of MAC prefixes from ``aa:00:1`` to ``b9:ff:f``. The MAC
551
prefix pool is responsible for providing only unicast and locally administered
552
MAC addresses, so many of these prefixes will be externally reserved, to
553
exclude from allocation.
554

    
555
Cyclades advanced operations
556
----------------------------
557

    
558
Reconciliation mechanism
559
~~~~~~~~~~~~~~~~~~~~~~~~
560

    
561
On certain occasions, such as a Ganeti or RabbitMQ failure, the state of
562
Cyclades database may differ from the real state of VMs and networks in the
563
Ganeti backends. The reconciliation process is designed to synchronize
564
the state of the Cyclades DB with Ganeti. There are two management commands
565
for reconciling VMs and Networks
566

    
567
Reconciling Virtual Machines
568
````````````````````````````
569

    
570
Reconciliation of VMs detects the following conditions:
571

    
572
 * Stale DB servers without corresponding Ganeti instances
573
 * Orphan Ganeti instances, without corresponding DB entries
574
 * Out-of-sync state for DB entries wrt to Ganeti instances
575

    
576
To detect all inconsistencies you can just run:
577

    
578
.. code-block:: console
579

    
580
  $ snf-manage reconcile-servers
581

    
582
Adding the `--fix-all` option, will do the actual synchronization:
583

    
584
.. code-block:: console
585

    
586
  $ snf-manage reconcile --fix-all
587

    
588
Please see ``snf-manage reconcile --help`` for all the details.
589

    
590

    
591
Reconciling Networks
592
````````````````````
593

    
594
Reconciliation of Networks detects the following conditions:
595

    
596
  * Stale DB networks without corresponding Ganeti networks
597
  * Orphan Ganeti networks, without corresponding DB entries
598
  * Private networks that are not created to all Ganeti backends
599
  * Unsynchronized IP pools
600

    
601
To detect all inconsistencies you can just run:
602

    
603
.. code-block:: console
604

    
605
  $ snf-manage reconcile-networks
606

    
607
Adding the `--fix-all` option, will do the actual synchronization:
608

    
609
.. code-block:: console
610

    
611
  $ snf-manage reconcile-networks --fix-all
612

    
613
Please see ``snf-manage reconcile-networks --help`` for all the details.
614

    
615

    
616

    
617
Block Storage Service (Archipelago)
618
===================================
619

    
620
Overview
621
--------
622
Archipelago offers Copy-On-Write snapshotable volumes. Pithos images can be used
623
to provision a volume with Copy-On-Write semantics (i.e. a clone). Snapshots
624
offer a unique deduplicated image of a volume, that reflects the volume state
625
during snapshot creation and are indistinguishable from a Pithos image.
626

    
627
Archipelago is used by Cyclades and Ganeti for fast provisioning of VMs based on
628
CoW volumes. Moreover, it enables live migration of thinly-provisioned VMs with
629
no physically shared storage.
630

    
631
Archipelago Architecture
632
------------------------
633

    
634
.. image:: images/archipelago-architecture.png
635
   :width: 50%
636
   :target: _images/archipelago-architecture.png
637

    
638
.. _syn+archip+rados:
639

    
640
Overview of Synnefo + Archipelago + RADOS
641
-----------------------------------------
642

    
643
.. image:: images/synnefo-arch3.png
644
   :width: 100%
645
   :target: _images/synnefo-arch3.png
646

    
647
Prereqs
648
-------
649

    
650
The administrator must initialize the storage backend where archipelago volume
651
blocks will reside.
652

    
653
In case of a files backend, the administrator must create two directories. One
654
for the archipelago data blocks and one for the archipelago map blocks. These
655
should probably be over shared storage to enable sharing archipelago volumes
656
between multiple nodes. He or she, must also be able to supply a directory where
657
the pithos data and map blocks reside.
658

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

    
663
Installation
664
------------
665

    
666
Archipelago consists of
667

    
668
* ``libxseg0``: libxseg used to communicate over shared memory segments
669
* ``python-xseg``: python bindings for libxseg
670
* ``archipelago-kernel-dkms``: contains archipelago kernel modules to provide
671
  block devices to be used as vm disks
672
* ``python-archipelago``: archipelago python module. Includes archipelago and
673
  vlmc functionality.
674
* ``archipelago``: user space tools and peers for the archipelago management and
675
  volume composition
676
* ``archipelago-ganeti``: ganeti ext storage scripts, that enable ganeti to
677
  provision VMs over archipelago
678

    
679
Performing
680

    
681
.. code-block:: console
682

    
683
  $ apt-get install archipelago-ganeti 
684

    
685
should fetch all the required packages and get you up 'n going with archipelago
686

    
687
Bare in mind, that custom librados is required, which is provided in the apt
688
repo of GRNet.
689

    
690

    
691
For now, librados is a dependency of archipelago, even if you do not intend to
692
use archipelago over RADOS.
693

    
694
Configuration
695
-------------
696
Archipelago should work out of the box with a RADOS backend, but basic
697
configuration can be done in ``/etc/default/archipelago`` .
698

    
699
If you wish to change the storage backend to files, set
700

    
701
.. code-block:: console
702

    
703
   STORAGE="files"
704

    
705
and provide the appropriate settings for files storage backend in the conf file.
706

    
707
These are:
708

    
709
* ``FILED_IMAGES``: directory for archipelago data blocks.
710
* ``FILED_MAPS``: directory for archipelago map blocks.
711
* ``PITHOS``: directory of pithos data blocks.
712
* ``PITHOSMAPS``: directory of pithos map blocks.
713

    
714
The settings for RADOS storage backend are:
715

    
716
* ``RADOS_POOL_MAPS``: The pool where archipelago and pithos map blocks reside.
717
* ``RADOS_POOL_BLOCKS``: The pool where archipelago and pithos data blocks
718
  reside.
719

    
720
Examples can be found in the conf file.
721

    
722
Be aware that archipelago infrastructure doesn't provide default values for this
723
settings. If they are not set in the conf file, archipelago will not be able to
724
function.
725

    
726
Archipelago also provides ``VERBOSITY`` config options to control the output
727
generated by the userspace peers.
728

    
729
The available options are:
730

    
731
* ``VERBOSITY_BLOCKERB``
732
* ``VERBOSITY_BLOCKERM``
733
* ``VERBOSITY_MAPPER``
734
* ``VERBOSITY_VLMC``
735

    
736
and the available values are:
737

    
738
* 0 : Error only logging.
739
* 1 : Warning logging.
740
* 2 : Info logging.
741
* 3 : Debug logging. WARNING: This options produces tons of output, but the
742
  logrotate daemon should take care of it.
743

    
744
Working with Archipelago
745
------------------------
746

    
747
``archipelago`` provides basic functionality for archipelago.
748

    
749
Usage:
750

    
751
.. code-block:: console
752

    
753
  $ archipelago [-u] command
754

    
755

    
756
Currently it supports the following commands:
757

    
758
* ``start [peer]``
759
  Starts archipelago or the specified peer.
760
* ``stop [peer]``
761
  Stops archipelago or the specified peer.
762
* ``restart [peer]``
763
  Restarts archipelago or the specified peer.
764
* ``status``
765
  Show the status of archipelago.
766

    
767
Available peers: ``blockerm``, ``blockerb``, ``mapperd``, ``vlmcd``.
768

    
769

    
770
``start``, ``stop``, ``restart`` can be combined with the ``-u / --user`` option
771
to affect only the userspace peers supporting archipelago.
772

    
773

    
774

    
775
Archipelago advanced operations
776
-------------------------------
777
The ``vlmc`` tool provides a way to interact with archipelago volumes
778

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

    
781
* ``vlmc unmap </dev/xsegbd[1-..]>``: unmaps the specified device from the
782
  system.
783

    
784
* ``vlmc create <volumename> --snap <snapname> --size <size>``: creates a new
785
  volume named <volumename> from snapshot name <snapname> with size <size>.
786
  The ``--snap`` and ``--size`` are optional, but at least one of them is
787
  mandatory. e.g:
788

    
789
  ``vlmc create <volumename> --snap <snapname>`` creates a volume named
790
  volumename from snapshot snapname. The size of the volume is the same as
791
  the size of the snapshot.
792

    
793
  ``vlmc create <volumename> --size <size>`` creates an empty volume of size
794
  <size> named <volumename>.
795

    
796
* ``vlmc remove <volumename>``: removes the volume and all the related
797
  archipelago blocks from storage.
798

    
799
* ``vlmc list``: provides a list of archipelago volumes. Currently only works
800
  with RADOS storage backend.
801

    
802
* ``vlmc info <volumename>``: shows volume information. Currently returns only
803
  volume size.
804

    
805
* ``vlmc open <volumename>``: opens an archipelago volume. That is, taking all
806
  the necessary locks and also make the rest of the infrastructure aware of the
807
  operation.
808

    
809
  This operation succeeds if the volume is alread opened.
810

    
811
* ``vlmc close <volumename>``: closes an archipelago volume. That is, performing
812
  all the necessary functions in the insfrastrure to successfully release the
813
  volume. Also releases all the acquired locks.
814

    
815
  ``vlmc close`` should be performed after a ``vlmc open`` operation.
816

    
817
* ``vlmc lock <volumename>``: locks a volume. This step allow the administrator
818
  to lock an archipelago volume, independently from the rest of the
819
  infrastrure.
820

    
821
* ``vlmc unlock [-f] <volumename>``: unlocks a volume. This allow the
822
  administrator to unlock a volume, independently from the rest of the
823
  infrastructure.
824
  The unlock option can be performed only by the blocker that acquired the lock
825
  in the first place. To unlock a volume from another blocker, ``-f`` option
826
  must be used to break the lock.
827

    
828

    
829
Synnefo management commands ("snf-manage")
830
==========================================
831

    
832
Each Synnefo service, Astakos, Pithos and Cyclades are controlled by the
833
administrator using the "snf-manage" admin tool. This tool is an extension of
834
the Django command-line management utility. It is run on the host that runs
835
each service and provides different types of commands depending the services
836
running on the host. If you are running more than one service on the same host
837
"snf-manage" adds all the corresponding commands for each service dynamically,
838
providing a unified admin environment.
839

    
840
To run "snf-manage" you just type:
841

    
842
.. code-block:: console
843

    
844
   # snf-manage <command> [arguments]
845

    
846
on the corresponding host that runs the service. For example, if you have all
847
services running on different physical hosts you would do:
848

    
849
.. code-block:: console
850

    
851
   root@astakos-host # snf-manage <astakos-command> [argument]
852
   root@pithos-host # snf-manage <pithos-command> [argument]
853
   root@cyclades-host # snf-manage <cyclades-command> [argument]
854

    
855
If you have all services running on the same host you would do:
856

    
857
.. code-block:: console
858

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

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

    
865
.. code-block:: console
866

    
867
   root@astakos-host # snf-manage <cyclades-command> [argument]
868
   Unknown command: 'cyclades-command'
869
   Type 'snf-manage help' for usage.
870

    
871
This is the complete list of "snf-manage" commands for each service.
872

    
873
Astakos snf-manage commands
874
---------------------------
875

    
876
============================  ===========================
877
Name                          Description
878
============================  ===========================
879
fix-superusers                Transform superusers created by syncdb into AstakosUser instances
880
cleanup-full                  Cleanup sessions and session catalog
881
project-control               Manage projects and applications
882
project-list                  List projects
883
project-show                  Show project details
884
quota                         List and check the integrity of user quota
885
reconcile-resources-astakos   Reconcile resource usage of Quotaholder with Astakos DB
886
resource-add                  Add resource
887
resource-export-astakos       Export astakos resources in json format
888
resource-import               Register service resources
889
resource-list                 List resources
890
resource-modify               Modify a resource's default base quota and boolean flags
891
service-add                   Register a service
892
service-list                  List services
893
service-modify                Modify service attributes
894
service-show                  Show service details
895
term-add                      Add approval terms
896
user-activation-send          Send user activation
897
user-add                      Add user
898
authpolicy-add                Create a new authentication provider policy profile
899
authpolicy-list               List existing authentication provider policy profiles
900
authpolicy-remove             Remove an authentication provider policy
901
authpolicy-set                Assign an existing authentication provider policy profile to a user or group
902
authpolicy-show               Show authentication provider profile details
903
group-add                     Create a group with the given name
904
group-list                    List available groups
905
user-list                     List users
906
user-modify                   Modify user
907
user-show                     Show user details
908
============================  ===========================
909

    
910
Pithos snf-manage commands
911
--------------------------
912

    
913
============================  ===========================
914
Name                          Description
915
============================  ===========================
916
reconcile-commissions-pithos  Display unresolved commissions and trigger their recovery
917
resource-export-pithos        Export pithos resources in json format
918
reconcile-resources-pithos    Detect unsynchronized usage between Astakos and Pithos DB resources and synchronize them if specified so.
919
============================  ===========================
920

    
921
Cyclades snf-manage commands
922
----------------------------
923

    
924
============================  ===========================
925
Name                          Description
926
============================  ===========================
927
FIXME: list cyclades cmds
928
============================  ===========================
929

    
930
Pithos managing accounts
931
========================
932

    
933
Pithos provides a utility tool for managing accounts.
934
To run you just type:
935

    
936
.. code-block:: console
937

    
938
   # pithos-manage-accounts <command> [arguments]
939

    
940
This is the list of the available commands:
941

    
942
============================  ===========================
943
Name                          Description
944
============================  ===========================
945
delete                        Remove an account from the Pithos DB
946
export-quota                  Export account quota in a file
947
list                          List existing/dublicate accounts
948
merge                         Move an account contents in another account
949
set-container-quota           Set container quota for all or a specific account
950
============================  ===========================
951

    
952

    
953
The "kamaki" API client
954
=======================
955

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

    
960
.. code-block:: console
961

    
962
   $ kamaki config list
963

    
964
To chage a setting use ``kamaki config set``:
965

    
966
.. code-block:: console
967

    
968
   $ kamaki config set image.url https://cyclades.example.com/plankton
969
   $ kamaki config set file.url https://pithos.example.com/v1
970
   $ kamaki config set user.url https://accounts.example.com
971
   $ kamaki config set token ...
972

    
973
To test that everything works, try authenticating the current account with
974
kamaki:
975

    
976
.. code-block:: console
977

    
978
  $ kamaki user authenticate
979

    
980
This will output user information.
981

    
982
Upload Image
983
------------
984

    
985
By convention, images are stored in a container called ``images``. Check if the
986
container exists, by listing all containers in your account:
987

    
988
.. code-block:: console
989

    
990
   $ kamaki file list
991

    
992
If the container ``images`` does not exist, create it:
993

    
994
.. code-block:: console
995

    
996
  $ kamaki file create images
997

    
998
You are now ready to upload an image to container ``images``. You can upload it
999
with a Pithos+ client, or use kamaki directly:
1000

    
1001
.. code-block:: console
1002

    
1003
   $ kamaki file upload ubuntu.iso images
1004

    
1005
You can use any Pithos+ client to verify that the image was uploaded correctly,
1006
or you can list the contents of the container with kamaki:
1007

    
1008
.. code-block:: console
1009

    
1010
  $ kamaki file list images
1011

    
1012
The full Pithos URL for the previous example will be
1013
``pithos://u53r-un1qu3-1d/images/ubuntu.iso`` where ``u53r-un1qu3-1d`` is the
1014
unique user id (uuid).
1015

    
1016
Register Image
1017
--------------
1018

    
1019
To register an image you will need to use the full Pithos+ URL. To register as
1020
a public image the one from the previous example use:
1021

    
1022
.. code-block:: console
1023

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

    
1026
The ``--public`` flag is important, if missing the registered image will not
1027
be listed by ``kamaki image list``.
1028

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

    
1032
.. code-block:: console
1033

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

    
1037
To verify that the image was registered successfully use:
1038

    
1039
.. code-block:: console
1040

    
1041
   $ kamaki image list --name-like=ubuntu
1042

    
1043

    
1044
Miscellaneous
1045
=============
1046

    
1047
.. _branding:
1048

    
1049
Branding
1050
--------
1051

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

    
1057
Configuration
1058
~~~~~~~~~~~~~
1059

    
1060
This can be done by changing only the settings of the snf-branding component.
1061
The settings for the snf-branding application can be found inside the
1062
configuration file ``/etc/synnefo/15-snf-branding.conf`` on the nodes that have
1063
Astakos, Pithos and Cyclades installed.
1064

    
1065
By default, the global service name is "Synnefo" and the company name is
1066
"GRNET". These names and their respective logos and URLs are used throughout
1067
the Astakos, Pithos and Cyclades UI.
1068

    
1069
**Names and URLs:**
1070

    
1071
The first group of branding customization refers to the service's and company's
1072
information.
1073

    
1074
You can overwrite the company and the service name and URL respectively by
1075
uncommenting and setting the following:
1076

    
1077
.. code-block:: console
1078

    
1079
  #BRANDING_SERVICE_NAME = 'Synnefo'
1080
  #BRANDING_SERVICE_URL = 'http://www.synnefo.org/'
1081
  #BRANDING_COMPANY_NAME = 'GRNET'
1082
  #BRANDING_COMPANY_URL = 'https://www.grnet.gr/en/'
1083

    
1084
| ``BRANDING_SERVICE_NAME`` appears in Astakos Dashboard/Projects pages.
1085
| ``BRANDING_COMPANY_NAME`` and ``BRANDING_COMPANY_URL`` appear in Astakos,
1086
  Pithos and Cyclades footer only if ``BRANDING_SHOW_COPYRIGHT`` is set to True.
1087

    
1088
**Copyright options:**
1089

    
1090
By default, no Copyright message is shown in the UI footer. If you want to make
1091
it visible in the footer of Astakos, Pithos and Cyclades UI, you can uncomment
1092
and set to ``True`` the setting:
1093

    
1094
.. code-block:: console
1095

    
1096
  #BRANDING_SHOW_COPYRIGHT = False
1097

    
1098
Copyright message defaults to 'Copyright (c) 2011-<current_year> 
1099
<BRANDING_COMPANY_NAME>.' but you can overwrite it to a completely custom one by
1100
setting the following option:
1101

    
1102
.. code-block:: console
1103

    
1104
  #BRANDING_COPYRIGHT_MESSAGE = 'Copyright (c) 2011-<current_year> GRNET'
1105

    
1106
**Images:**
1107

    
1108
The Astakos, Pithos and Cyclades Web UI has some logos and images.
1109
 
1110
The branding-related images are presented in  the following table:
1111

    
1112
===============  ============================  =========
1113
Image            Name/extension  convention    Usage
1114
===============  ============================  =========
1115
Favicon          favicon.ico                   Favicon for all services
1116
Dashboard logo   dashboard_logo.png            Visible in all Astakos UI pages
1117
Compute logo     compute_logo.png              Visible in all Cyclades UI pages
1118
Console logo     console_logo.png              Visible in the Cyclades Console Window
1119
Storage logo     storage_logo.png              Visible in all Pithos UI pages
1120
===============  ============================  =========
1121

    
1122
There are two methods  available for replacing all, or individual, 
1123
branding-related images:
1124

    
1125
1. Create a new directory and  place there some or all of your images.
1126

    
1127
   If you want to replace all of your images, keep the name/extension
1128
   conventions as indicated in the above table and set:
1129

    
1130
.. code-block:: console
1131

    
1132
  #BRANDING_IMAGE_MEDIA_URL= MEDIA_URL + 'branding/images/' 
1133

    
1134
to the relative path of your directory. 
1135
You could also use an absolute path to a directory and set for example 
1136
``BRANDING_IMAGE_MEDIA_URL`` = 'https://www.synnefo.org/images/'
1137

    
1138
   If you wish to replace individual images, **do not uncomment**
1139
   ``BRANDING_IMAGE_MEDIA_URL``, but instead provide a relative path, pointing to
1140
   the file inside your directory for each ``BRANDING_<image>_URL`` that you wish
1141
   to replace.
1142

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

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

    
1150
.. note:: Retina optimized images:
1151

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

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

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

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

    
1171
   In case that you don’t want to use a high-resolution image, the 
1172
   normal-resolution image will be visible.
1173

    
1174
More branding
1175
~~~~~~~~~~~~~
1176

    
1177
Although, it is not 100% branding-related, further verbal customization is
1178
feasible. 
1179

    
1180
**EMAILS**
1181

    
1182
The output of all email *.txt files will be already customized to contain your 
1183
company and service names but you can further alter their content if you feel 
1184
it best fits your needs  using django’s TEMPLATE_DIRS setting.    
1185

    
1186
For more information visit  
1187
https://docs.djangoproject.com/en/1.2/ref/settings/#template-dirs.                           
1188

    
1189
In order to overwrite one or more email-templates you need to create a new one 
1190
directory and  provide its path to the TEMPLATE_DIRS. Inside this directory, you
1191
must place your <email-file>.txt files respecting the following structure:
1192
  
1193
  *<emails-dir>*/
1194
      *im*/
1195
          | activation_email.txt
1196
          | email.txt
1197
          | invitation.txt
1198
          | switch_accounts_email.txt
1199
          | welcome_email.txt
1200
          *projects*/
1201
              | project_approval_notification.txt
1202
              | project_denial_notification.txt    
1203
              | project_membership_change_notification.txt
1204
              | project_membership_enroll_notification.txt
1205
              | project_membership_leave_request_notification.txt
1206
              | project_membership_request_notification.txt
1207
              | project_suspension_notification.txt
1208
              | project_termination_notification.txt
1209
      *registration*/
1210
          | email_change_email.txt
1211
          | password_email.txt
1212

    
1213
Feel free to omit any of the above files you do not wish to overwrite.
1214

    
1215
Below is a list of all emails sent by Synnefo to users along with a short 
1216
description and a link to their content:
1217

    
1218
* ``snf-astakos-app/astakos/im/templates/im/email.txt``
1219
  Base email template. Contains a contact email and a “thank you” message.
1220
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/email.txt>`_)
1221
* ``snf-astakos-app/astakos/im/templates/im/activation_email.txt`` Email sent to
1222
  user that prompts  him/her to click on a link provided to activate the account.
1223
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/activation_email.txt>`_)
1224
* ``snf-astakos-app/astakos/im/templates/im/invitation.txt`` Email sent to an
1225
  invited user. He/she has to click on a link provided to activate the account.
1226
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/invitation.txt>`_)
1227
* ``snf-astakos-app/astakos/im/templates/im/switch_accounts_email.txt`` Email
1228
  sent to user upon his/her request to associate this email address with a
1229
  shibboleth account. He/she has to click on a link provided to activate the
1230
  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>`_)
1231
* ``snf-astakos-app/astakos/im/templates/im/welcome_email.txt`` Email sent to
1232
  inform the user that his/ her account has been activated. Extends “email.txt”
1233
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/welcome_email.txt>`_)
1234
* ``snf-astakos-app/astakos/im/templates/registration/email_change_email.txt``
1235
  Email sent to user when he/she has requested new email address assignment. The
1236
  user has to click on a link provided to validate this action. Extends
1237
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/registration/email_change_email.txt>`_)
1238
* ``snf-astakos-app/astakos/im/templates/registration/password_email.txt`` Email
1239
  sent for resetting password purpose. The user has to click on a link provided
1240
  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>`_)
1241
* ``snf-astakos-app/astakos/im/templates/im/projects/project_approval_notification.txt``
1242
  Informs  the project owner that his/her project has been approved. Extends
1243
  “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>`_)
1244
* ``snf-astakos-app/astakos/im/templates/im/projects/project_denial_notification.txt``
1245
  Informs the project owner that his/her  project application has been denied
1246
  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>`_)
1247
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt``
1248
  An email is sent to a user containing information about his project membership
1249
  (whether he has been accepted, rejected or removed). Extends “email.txt” (`Link
1250
  <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt>`_)
1251
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_enroll_notification.txt``
1252
  Informs a user that he/she  has been enrolled to a project. Extends
1253
  “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>`_)
1254
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_leave_request_notification.txt``
1255
  An email is sent to the project owner to make him aware of a  user having
1256
  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>`_)
1257
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_request_notification.txt``
1258
  An email is sent to the project owner to make him/her aware of a user having
1259
  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>`_)
1260
* ``snf-astakos-app/astakos/im/templates/im/projects/project_suspension_notification.txt``
1261
  An email is sent to the project owner to make him/her aware of his/her project
1262
  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>`_)
1263
* ``snf-astakos-app/astakos/im/templates/im/projects/project_termination_notification.txt``
1264
  An email is sent to the project owner to make him/her aware of his/her project
1265
  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>`_)
1266

    
1267
.. warning:: Django templates language:
1268

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

    
1274

    
1275
.. RabbitMQ
1276

    
1277
RabbitMQ Broker
1278
---------------
1279

    
1280
Queue nodes run the RabbitMQ sofware, which provides AMQP functionality. To
1281
guarantee high-availability, more than one Queue nodes should be deployed, each
1282
of them belonging to the same `RabbitMQ cluster
1283
<http://www.rabbitmq.com/clustering.html>`_. Synnefo uses the RabbitMQ
1284
active/active `High Available Queues <http://www.rabbitmq.com/ha.html>`_ which
1285
are mirrored between two nodes within a RabbitMQ cluster.
1286

    
1287
The RabbitMQ nodes that form the cluster, are declared to Synnefo through the
1288
`AMQP_HOSTS` setting. Each time a Synnefo component needs to connect to
1289
RabbitMQ, one of these nodes is chosen in a random way. The client that Synnefo
1290
uses to connect to RabbitMQ, handles connection failures transparently and
1291
tries to reconnect to a different node. As long as one of these nodes are up
1292
and running, functionality of Synnefo should not be downgraded by the RabbitMQ
1293
node failures.
1294

    
1295
All the queues that are being used are declared as durable, meaning that
1296
messages are persistently stored to RabbitMQ, until they get successfully
1297
processed by a client.
1298

    
1299
Currently, RabbitMQ is used by the following components:
1300

    
1301
* `snf-ganeti-eventd`, `snf-ganeti-hook` and `snf-progress-monitor`:
1302
  These components send messages concerning the status and progress of
1303
  jobs in the Ganeti backend.
1304
* `snf-dispatcher`: This daemon, consumes the messages that are sent from
1305
  the above components, and updates the Cyclades DB accordingly.
1306

    
1307

    
1308
Installation
1309
~~~~~~~~~~~~
1310

    
1311
Please check the RabbitMQ documentation which covers extensively the
1312
`installation of RabbitMQ server <http://www.rabbitmq.com/download.html>`_ and
1313
the setup of a `RabbitMQ cluster <http://www.rabbitmq.com/clustering.html>`_.
1314
Also, check out the `web management plugin
1315
<http://www.rabbitmq.com/management.html>`_ that can be useful for managing and
1316
monitoring RabbitMQ.
1317

    
1318
For a basic installation of RabbitMQ on two nodes (node1 and node2) you can do
1319
the following:
1320

    
1321
On both nodes, install rabbitmq-server and create a Synnefo user:
1322

    
1323
.. code-block:: console
1324

    
1325
  $ apt-get install rabbitmq-server
1326
  $ rabbitmqctl add_user synnefo "example_pass"
1327
  $ rabbitmqctl set_permissions synnefo  ".*" ".*" ".*"
1328

    
1329
Also guarantee that both nodes share the same cookie, by running:
1330

    
1331
.. code-block:: console
1332

    
1333
  $ scp node1:/var/lib/rabbitmq/.erlang.cookie node2:/var/lib/rabbitmq/.erlang.cookie
1334

    
1335
and restart the nodes:
1336

    
1337
.. code-block:: console
1338

    
1339
  $ /etc/init.d/rabbitmq-server restart
1340

    
1341

    
1342
To setup the RabbitMQ cluster run:
1343

    
1344
.. code-block:: console
1345

    
1346
  root@node2: rabbitmqctl stop_app
1347
  root@node2: rabbitmqctl reset
1348
  root@node2: rabbitmqctl cluster rabbit@node1 rabbit@node2
1349
  root@node2: rabbitmqctl start_app
1350

    
1351
You can verify that the cluster is set up correctly by running:
1352

    
1353
.. code-block:: console
1354

    
1355
  root@node2: rabbitmqctl cluster_status
1356

    
1357

    
1358
Logging
1359
-------
1360

    
1361
Logging in Synnefo is using Python's logging module. The module is configured
1362
using dictionary configuration, whose format is described here:
1363

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

    
1366
Note that this is a feature of Python 2.7 that we have backported for use in
1367
Python 2.6.
1368

    
1369
The logging configuration dictionary is defined in
1370
``/etc/synnefo/10-snf-webproject-logging.conf``
1371

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

    
1377
By default, the Django webapp and snf-manage logs to syslog, while
1378
`snf-dispatcher` logs to `/var/log/synnefo/dispatcher.log`.
1379

    
1380

    
1381
.. _scale-up:
1382

    
1383
Scaling up to multiple nodes
1384
============================
1385

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

    
1393
Graph of a scale-out Synnefo deployment
1394
---------------------------------------
1395

    
1396
Each box in the following graph corresponds to a distinct physical node:
1397

    
1398
.. image:: images/synnefo-arch2-roles.png
1399
   :width: 100%
1400
   :target: _images/synnefo-arch2-roles.png
1401

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

    
1407
.. _physical-node-roles:
1408

    
1409
Physical Node roles
1410
-------------------
1411

    
1412
As appears in the previous graph, a scale-out Synnefo deployment consists of
1413
multiple physical nodes that have the following roles:
1414

    
1415
* **WEBSERVER**: A web server running in front of gunicorn (e.g.: Apache, nginx)
1416
* **ASTAKOS**: The Astakos application (gunicorn)
1417
* **ASTAKOS_DB**: The Astakos database (postgresql)
1418
* **PITHOS**: The Pithos application (gunicorn)
1419
* **PITHOS_DB**: The Pithos database (postgresql)
1420
* **CYCLADES**: The Cyclades application (gunicorn)
1421
* **CYCLADES_DB**: The Cyclades database (postgresql)
1422
* **MQ**: The message queue (RabbitMQ)
1423
* **GANETI_MASTER**: The Ganeti master of a Ganeti cluster
1424
* **GANETI_NODE** : A VM-capable Ganeti node of a Ganeti cluster
1425

    
1426
You will probably also have:
1427

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

    
1433
From this point we will also refer to the following groups of roles:
1434

    
1435
* **SYNNEFO**: [ **ASTAKOS**, **ASTAKOS_DB**, **PITHOS**, **PITHOS_DB**, **CYCLADES**, **CYCLADES_DB**, **MQ**, **CMS**]
1436
* **G_BACKEND**: [**GANETI_MASTER**, **GANETI_NODE**]
1437

    
1438
Of course, when deploying Synnefo you can combine multiple of the above roles on a
1439
single physical node, but if you are trying to scale out, the above separation
1440
gives you significant advantages.
1441

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

    
1446
Components for each role
1447
------------------------
1448

    
1449
When deploying Synnefo in large scale, you need to install different Synnefo
1450
or/and third party components on different physical nodes according to their
1451
Synnefo role, as stated in the previous section.
1452

    
1453
Specifically:
1454

    
1455
Role **WEBSERVER**
1456
    * Synnefo components: `None`
1457
    * 3rd party components: Apache
1458
Role **ASTAKOS**
1459
    * Synnefo components: `snf-webproject`, `snf-astakos-app`
1460
    * 3rd party components: Django, Gunicorn
1461
Role **ASTAKOS_DB**
1462
    * Synnefo components: `None`
1463
    * 3rd party components: PostgreSQL
1464
Role **PITHOS**
1465
    * Synnefo components: `snf-webproject`, `snf-pithos-app`, `snf-pithos-webclient`
1466
    * 3rd party components: Django, Gunicorn
1467
Role **PITHOS_DB**
1468
    * Synnefo components: `None`
1469
    * 3rd party components: PostgreSQL
1470
Role **CYCLADES**
1471
    * Synnefo components: `snf-webproject`, `snf-cyclades-app`, `snf-vncauthproxy`
1472
    * 3rd party components: Django Gunicorn
1473
Role **CYCLADES_DB**
1474
    * Synnefo components: `None`
1475
    * 3rd party components: PostgreSQL
1476
Role **MQ**
1477
    * Synnefo components: `None`
1478
    * 3rd party components: RabbitMQ
1479
Role **GANETI_MASTER**
1480
    * Synnefo components: `snf-cyclades-gtools`
1481
    * 3rd party components: Ganeti
1482
Role **GANETI_NODE**
1483
    * Synnefo components: `snf-cyclades-gtools`, `snf-network`, `snf-image`, `nfdhcpd`
1484
    * 3rd party components: Ganeti
1485
Role **CMS**
1486
    * Synnefo components: `snf-webproject`, `snf-cloudcms`
1487
    * 3rd party components: Django, Gunicorn
1488
Role **NS**
1489
    * Synnefo components: `None`
1490
    * 3rd party components: BIND
1491
Role **CLIENT**
1492
    * Synnefo components: `kamaki`, `snf-image-creator`
1493
    * 3rd party components: `None`
1494

    
1495
Example scale out installation
1496
------------------------------
1497

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

    
1502
We assume that we have the following 10 physical nodes with the corresponding
1503
roles:
1504

    
1505
Node1:
1506
    **WEBSERVER**, **ASTAKOS**
1507
      Guide sections:
1508
        * :ref:`apt <i-apt>`
1509
        * :ref:`gunicorn <i-gunicorn>`
1510
        * :ref:`apache <i-apache>`
1511
        * :ref:`snf-webproject <i-webproject>`
1512
        * :ref:`snf-astakos-app <i-astakos>`
1513
Node2:
1514
    **WEBSERVER**, **PITHOS**
1515
      Guide sections:
1516
        * :ref:`apt <i-apt>`
1517
        * :ref:`gunicorn <i-gunicorn>`
1518
        * :ref:`apache <i-apache>`
1519
        * :ref:`snf-webproject <i-webproject>`
1520
        * :ref:`snf-pithos-app <i-pithos>`
1521
        * :ref:`snf-pithos-webclient <i-pithos>`
1522
Node3:
1523
    **WEBSERVER**, **CYCLADES**
1524
      Guide sections:
1525
        * :ref:`apt <i-apt>`
1526
        * :ref:`gunicorn <i-gunicorn>`
1527
        * :ref:`apache <i-apache>`
1528
        * :ref:`snf-webproject <i-webproject>`
1529
        * :ref:`snf-cyclades-app <i-cyclades>`
1530
        * :ref:`snf-vncauthproxy <i-cyclades>`
1531
Node4:
1532
    **WEBSERVER**, **CMS**
1533
      Guide sections:
1534
        * :ref:`apt <i-apt>`
1535
        * :ref:`gunicorn <i-gunicorn>`
1536
        * :ref:`apache <i-apache>`
1537
        * :ref:`snf-webproject <i-webproject>`
1538
        * :ref:`snf-cloudcms <i-cms>`
1539
Node5:
1540
    **ASTAKOS_DB**, **PITHOS_DB**, **CYCLADES_DB**
1541
      Guide sections:
1542
        * :ref:`apt <i-apt>`
1543
        * :ref:`postgresql <i-db>`
1544
Node6:
1545
    **MQ**
1546
      Guide sections:
1547
        * :ref:`apt <i-apt>`
1548
        * :ref:`rabbitmq <i-mq>`
1549
Node7:
1550
    **GANETI_MASTER**, **GANETI_NODE**
1551
      Guide sections:
1552
        * :ref:`apt <i-apt>`
1553
        * :ref:`general <i-backends>`
1554
        * :ref:`ganeti <i-ganeti>`
1555
        * :ref:`snf-cyclades-gtools <i-gtools>`
1556
        * :ref:`snf-network <i-network>`
1557
        * :ref:`snf-image <i-image>`
1558
        * :ref:`nfdhcpd <i-network>`
1559
Node8:
1560
    **GANETI_NODE**
1561
      Guide sections:
1562
        * :ref:`apt <i-apt>`
1563
        * :ref:`general <i-backends>`
1564
        * :ref:`ganeti <i-ganeti>`
1565
        * :ref:`snf-cyclades-gtools <i-gtools>`
1566
        * :ref:`snf-network <i-network>`
1567
        * :ref:`snf-image <i-image>`
1568
        * :ref:`nfdhcpd <i-network>`
1569
Node9:
1570
    **GANETI_NODE**
1571
      Guide sections:
1572
        `Same as Node8`
1573
Node10:
1574
    **GANETI_NODE**
1575
      Guide sections:
1576
        `Same as Node8`
1577

    
1578
All sections: :ref:`Scale out Guide <i-synnefo>`
1579

    
1580

    
1581
Upgrade Notes
1582
=============
1583

    
1584
.. toctree::
1585
   :maxdepth: 1
1586

    
1587
   v0.12 -> v0.13 <upgrade/upgrade-0.13>
1588

    
1589

    
1590
Changelog, NEWS
1591
===============
1592

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