Statistics
| Branch: | Tag: | Revision:

root / docs / admin-guide.rst @ 73ebcd68

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 /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 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
project-control               Manage projects and applications
1007
project-list                  List projects
1008
project-show                  Show project details
1009
quota                         List and check the integrity of user quota
1010
reconcile-resources-astakos   Reconcile resource usage of Quotaholder with Astakos DB
1011
resource-add                  Add resource
1012
resource-export-astakos       Export astakos resources in json format
1013
resource-import               Register service resources
1014
resource-list                 List resources
1015
resource-modify               Modify a resource's default base quota and boolean flags
1016
service-add                   Register a service
1017
service-list                  List services
1018
service-modify                Modify service attributes
1019
service-show                  Show service details
1020
term-add                      Add approval terms
1021
user-activation-send          Send user activation
1022
user-add                      Add user
1023
authpolicy-add                Create a new authentication provider policy profile
1024
authpolicy-list               List existing authentication provider policy profiles
1025
authpolicy-remove             Remove an authentication provider policy
1026
authpolicy-set                Assign an existing authentication provider policy profile to a user or group
1027
authpolicy-show               Show authentication provider profile details
1028
group-add                     Create a group with the given name
1029
group-list                    List available groups
1030
user-list                     List users
1031
user-modify                   Modify user
1032
user-show                     Show user details
1033
============================  ===========================
1034

    
1035
Pithos snf-manage commands
1036
--------------------------
1037

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

    
1046
Cyclades snf-manage commands
1047
----------------------------
1048

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

    
1055
Pithos managing accounts
1056
========================
1057

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

    
1061
.. code-block:: console
1062

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

    
1065
This is the list of the available commands:
1066

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

    
1077

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

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

    
1085
.. code-block:: console
1086

    
1087
   $ kamaki config list
1088

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

    
1091
.. code-block:: console
1092

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

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

    
1101
.. code-block:: console
1102

    
1103
  $ kamaki user authenticate
1104

    
1105
This will output user information.
1106

    
1107
Upload Image
1108
------------
1109

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

    
1113
.. code-block:: console
1114

    
1115
   $ kamaki file list
1116

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

    
1119
.. code-block:: console
1120

    
1121
  $ kamaki file create images
1122

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

    
1126
.. code-block:: console
1127

    
1128
   $ kamaki file upload ubuntu.iso images
1129

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

    
1133
.. code-block:: console
1134

    
1135
  $ kamaki file list images
1136

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

    
1141
Register Image
1142
--------------
1143

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

    
1147
.. code-block:: console
1148

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

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

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

    
1157
.. code-block:: console
1158

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

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

    
1164
.. code-block:: console
1165

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

    
1168

    
1169
Miscellaneous
1170
=============
1171

    
1172
.. _branding:
1173

    
1174
Branding
1175
--------
1176

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

    
1182
Configuration
1183
~~~~~~~~~~~~~
1184

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

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

    
1194
**Names and URLs:**
1195

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

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

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

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

    
1214

    
1215
**Copyright options:**
1216

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

    
1221
.. code-block:: python
1222

    
1223
  #BRANDING_SHOW_COPYRIGHT = False
1224

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

    
1229
.. code-block:: python
1230

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

    
1233

    
1234
**Images:**
1235

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

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

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

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

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

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

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

    
1268

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

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

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

    
1281
.. note:: Retina optimized images:
1282

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

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

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

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

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

    
1305
More branding
1306
~~~~~~~~~~~~~
1307

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

    
1311
**EMAILS**
1312

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

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

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

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

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

    
1394
.. warning:: Django templates language:
1395

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

    
1401

    
1402
.. RabbitMQ
1403

    
1404
RabbitMQ Broker
1405
---------------
1406

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

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

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

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

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

    
1434

    
1435
Installation
1436
~~~~~~~~~~~~
1437

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

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

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

    
1450
.. code-block:: console
1451

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

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

    
1458
.. code-block:: console
1459

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

    
1462
and restart the nodes:
1463

    
1464
.. code-block:: console
1465

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

    
1468

    
1469
To setup the RabbitMQ cluster run:
1470

    
1471
.. code-block:: console
1472

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

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

    
1480
.. code-block:: console
1481

    
1482
  root@node2: rabbitmqctl cluster_status
1483

    
1484

    
1485
Logging
1486
-------
1487

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

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

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

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

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

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

    
1507

    
1508
.. _scale-up:
1509

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

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

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

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

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

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

    
1534
.. _physical-node-roles:
1535

    
1536
Physical Node roles
1537
-------------------
1538

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

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

    
1553
You will probably also have:
1554

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

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

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

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

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

    
1573
Components for each role
1574
------------------------
1575

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

    
1580
Specifically:
1581

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

    
1622
Example scale out installation
1623
------------------------------
1624

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

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

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

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

    
1707

    
1708
Upgrade Notes
1709
=============
1710

    
1711
.. toctree::
1712
   :maxdepth: 1
1713

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

    
1716

    
1717
Changelog, NEWS
1718
===============
1719

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