Statistics
| Branch: | Tag: | Revision:

root / docs / admin-guide.rst @ b4109758

History | View | Annotate | Download (64 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 Administrator's Guide
17
before proceeding.
18

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

    
23

    
24

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

    
28

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

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

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

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

    
41
.. _shibboleth-auth:
42

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

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

    
48
To setup shibboleth, install package::
49

    
50
  apt-get install libapache2-mod-shib2
51

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

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

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

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

    
66
and before the line containing::
67

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

    
70
add::
71

    
72
  ProxyPass /Shibboleth.sso !
73

    
74
Then, enable the shibboleth module::
75

    
76
  a2enmod shib2
77

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

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

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

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

    
95
Prereqs
96
-------
97

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

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

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

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

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

    
113
.. code-block:: console
114

    
115
   $ snf-manage user-list
116

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

    
120
.. code-block:: console
121

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

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

    
130

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

    
135

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

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

    
144

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

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

    
152
At this stage:
153

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

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

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

    
165

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

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

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

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

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

    
188
.. code-block:: console
189

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

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

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

    
201

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

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

    
209
Currently astakos supports the following identity providers:
210

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

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

    
223
.. code-block:: python
224

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

    
232

    
233
.. _auth_methods_policies:
234

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

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

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

    
244
Available policies are:
245

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

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

    
257
.. code-block:: python
258

    
259
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_AUTOMODERATE_POLICY = True
260
    ASTAKOS_AUTH_PROVIDER_SHIBBOLETH_REMOVE_POLICY = False
261

    
262

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

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

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

    
274
To apply your configuration run::
275

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

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

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

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

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

    
290

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

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

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

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

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

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

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

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

    
313
To list pending project applications in astakos::
314

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

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

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

    
322
To deny an application::
323

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

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

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

    
333

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

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

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

    
344
.. code-block:: console
345

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

    
348
   These are the example terms for ~okeanos
349

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

    
352
.. code-block:: console
353

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

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

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

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

    
369
.. code-block:: console
370

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

    
374
   ASTAKOS_RECAPTCHA_ENABLED = True
375

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

    
378
.. code-block:: console
379

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

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

    
385

    
386

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

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

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

    
396
Prereqs
397
-------
398

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

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

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

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

    
411

    
412

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

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

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

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

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

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

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

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

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

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

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

    
465

    
466
Prereqs
467
-------
468

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

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

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

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

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

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

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

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

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

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

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

    
507
.. code-block:: console
508

    
509
   $ snf-manage backend-list
510

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

    
518
To add this Ganeti cluster, we run:
519

    
520
.. code-block:: console
521

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

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

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

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

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

    
542
.. code-block:: console
543

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

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

    
550
.. code-block:: console
551

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

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

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

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

    
570
.. code-block:: console
571

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

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

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

    
586

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

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

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

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

    
607

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

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

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

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

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

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

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

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

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

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

    
654
.. code-block:: console
655

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

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

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

    
662
.. code-block:: console
663

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

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

    
669
.. code-block:: console
670

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

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

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

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

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

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

    
693
Reconciliation of VMs detects the following conditions:
694

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

    
699
To detect all inconsistencies you can just run:
700

    
701
.. code-block:: console
702

    
703
  $ snf-manage reconcile-servers
704

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

    
707
.. code-block:: console
708

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

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

    
713

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

    
717
Reconciliation of Networks detects the following conditions:
718

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

    
724
To detect all inconsistencies you can just run:
725

    
726
.. code-block:: console
727

    
728
  $ snf-manage reconcile-networks
729

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

    
732
.. code-block:: console
733

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

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

    
738

    
739

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

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

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

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

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

    
761
.. _syn+archip+rados:
762

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

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

    
770
Prereqs
771
-------
772

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

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

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

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

    
789
Archipelago consists of
790

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

    
802
Performing
803

    
804
.. code-block:: console
805

    
806
  $ apt-get install archipelago-ganeti 
807

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

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

    
813

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

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

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

    
824
.. code-block:: console
825

    
826
   STORAGE="files"
827

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

    
830
These are:
831

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

    
837
The settings for RADOS storage backend are:
838

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

    
843
Examples can be found in the conf file.
844

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

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

    
852
The available options are:
853

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

    
859
and the available values are:
860

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

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

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

    
872
Usage:
873

    
874
.. code-block:: console
875

    
876
  $ archipelago [-u] command
877

    
878

    
879
Currently it supports the following commands:
880

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

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

    
892

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

    
896

    
897

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
951

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

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

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

    
965
.. code-block:: console
966

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

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

    
972
.. code-block:: console
973

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

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

    
980
.. code-block:: console
981

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

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

    
988
.. code-block:: console
989

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

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

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

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

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

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

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

    
1050
============================== ===========================
1051
Name                           Description
1052
============================== ===========================
1053
backend-add                    Add a new Ganeti backend
1054
backend-list                   List backends
1055
backend-modify                 Modify a backend
1056
backend-update-status          Update backend statistics for instance allocation
1057
backend-remove                 Remove a Ganeti backend
1058
server-create                  Create a new server
1059
server-show                    Show server details
1060
server-list                    List servers
1061
server-modify                  Modify a server
1062
server-import                  Import an existing Ganeti VM into synnefo
1063
server-inspect                 Inspect a server in DB and Ganeti
1064
network-create                 Create a new network
1065
network-list                   List networks
1066
network-modify                 Modify a network
1067
network-inspect                Inspect network state in DB and Ganeti
1068
network-remove                 Delete a network
1069
flavor-create                  Create a new flavor
1070
flavor-list                    List flavors
1071
flavor-modify                  Modify a flavor
1072
image-list                     List images
1073
image-show                     Show image details
1074
pool-create                    Create a bridge or mac-prefix pool
1075
pool-show                      Show pool details
1076
pool-list                      List pools
1077
pool-modify                    Modify a pool
1078
pool-remove                    Delete a pool
1079
queue-inspect                  Inspect the messages of a RabbitMQ queue
1080
queue-retry                    Resend messages from Dead Letter queues to original exchanges
1081
resource-export-cyclades       Export Cyclades resources in JSON format.
1082
service-export-cyclades        Export Cyclades services in JSON format.
1083
reconcile-servers              Reconcile servers of Synnefo DB with state of Ganeti backend
1084
reconcile-networks             Reconcile networks of Synnefo DB with state of Ganeti backend
1085
reconcile-pools                Check consistency of pool resources
1086
reconcile-commissions-cyclades Detect and resolve pending commissions to Quotaholder
1087
reconcile-resources-cyclades   Reconcile resource usage of Astakos with Cyclades DB.
1088
============================== ===========================
1089

    
1090
Astakos helper scripts
1091
======================
1092

    
1093
Astakos includes two scripts to facilitate the installation procedure.
1094
Running:
1095

    
1096
.. code-block:: console
1097

    
1098
   snf-component-register [<component_name>]
1099

    
1100
automates the registration of the standard Synnefo components (astakos,
1101
cyclades, and pithos) in astakos database. It internally uses the script:
1102

    
1103
.. code-block:: console
1104

    
1105
   snf-service-export <component_name> <base_url>
1106

    
1107
which simulates the export of service and resource definitions of the
1108
standard Synnefo components.
1109

    
1110
Pithos managing accounts
1111
========================
1112

    
1113
Pithos provides a utility tool for managing accounts.
1114
To run you just type:
1115

    
1116
.. code-block:: console
1117

    
1118
   # pithos-manage-accounts <command> [arguments]
1119

    
1120
This is the list of the available commands:
1121

    
1122
============================  ===========================
1123
Name                          Description
1124
============================  ===========================
1125
delete                        Remove an account from the Pithos DB
1126
export-quota                  Export account quota in a file
1127
list                          List existing/dublicate accounts
1128
merge                         Move an account contents in another account
1129
set-container-quota           Set container quota for all or a specific account
1130
============================  ===========================
1131

    
1132

    
1133
The "kamaki" API client
1134
=======================
1135

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

    
1140
.. code-block:: console
1141

    
1142
   $ kamaki config list
1143

    
1144
To change a setting use ``kamaki config set``:
1145

    
1146
.. code-block:: console
1147

    
1148
   $ kamaki config set image.url https://cyclades.example.com/image
1149
   $ kamaki config set file.url https://pithos.example.com/v1
1150
   $ kamaki config set user.url https://accounts.example.com
1151
   $ kamaki config set token ...
1152

    
1153
To test that everything works, try authenticating the current account with
1154
kamaki:
1155

    
1156
.. code-block:: console
1157

    
1158
  $ kamaki user authenticate
1159

    
1160
This will output user information.
1161

    
1162
Upload Image
1163
------------
1164

    
1165
By convention, images are stored in a container called ``images``. Check if the
1166
container exists, by listing all containers in your account:
1167

    
1168
.. code-block:: console
1169

    
1170
   $ kamaki file list
1171

    
1172
If the container ``images`` does not exist, create it:
1173

    
1174
.. code-block:: console
1175

    
1176
  $ kamaki file create images
1177

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

    
1181
.. code-block:: console
1182

    
1183
   $ kamaki file upload ubuntu.iso images
1184

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

    
1188
.. code-block:: console
1189

    
1190
  $ kamaki file list images
1191

    
1192
The full Pithos URL for the previous example will be
1193
``pithos://u53r-un1qu3-1d/images/ubuntu.iso`` where ``u53r-un1qu3-1d`` is the
1194
unique user id (uuid).
1195

    
1196
Register Image
1197
--------------
1198

    
1199
To register an image you will need to use the full Pithos URL. To register as
1200
a public image the one from the previous example use:
1201

    
1202
.. code-block:: console
1203

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

    
1206
The ``--public`` flag is important, if missing the registered image will not
1207
be listed by ``kamaki image list``.
1208

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

    
1212
.. code-block:: console
1213

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

    
1217
To verify that the image was registered successfully use:
1218

    
1219
.. code-block:: console
1220

    
1221
   $ kamaki image list --name-like=ubuntu
1222

    
1223

    
1224
Miscellaneous
1225
=============
1226

    
1227
.. _branding:
1228

    
1229
Branding
1230
--------
1231

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

    
1237
Configuration
1238
~~~~~~~~~~~~~
1239

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

    
1245
By default, the global service name is "Synnefo" and the company name is
1246
"GRNET". These names and their respective logos and URLs are used throughout
1247
the Astakos, Pithos and Cyclades UI.
1248

    
1249
**Names and URLs:**
1250

    
1251
The first group of branding customization refers to the service's and company's
1252
information.
1253

    
1254
You can overwrite the company and the service name and URL respectively by
1255
uncommenting and setting the following:
1256

    
1257
.. code-block:: python
1258
  
1259
  # setting used in Astakos Dashboard/Projects pages
1260
  BRANDING_SERVICE_NAME = 'My cloud'
1261
  BRANDING_SERVICE_URL = 'http://www.mycloud.synnefo.org/'
1262

    
1263
  # settings used in Astakos, Pithos, Cyclades footer only if 
1264
  # BRANDING_SHOW_COPYRIGHT is set to True
1265
  BRANDING_SHOW_COPYRIGHT = True
1266
  BRANDING_COMPANY_NAME = 'Company LTD'
1267
  BRANDING_COMPANY_URL = 'https://www.company-ltd.synnefo.org/'
1268

    
1269

    
1270
**Copyright options:**
1271

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

    
1276
.. code-block:: python
1277

    
1278
  #BRANDING_SHOW_COPYRIGHT = False
1279

    
1280
Copyright message defaults to 'Copyright (c) 2011-<current_year>
1281
<BRANDING_COMPANY_NAME>.' but you can overwrite it to a completely custom one by
1282
setting the following option:
1283

    
1284
.. code-block:: python
1285

    
1286
  BRANDING_COPYRIGHT_MESSAGE = 'Copyright (c) 2011-2013 GRNET'
1287

    
1288

    
1289
**Images:**
1290

    
1291
The Astakos, Pithos and Cyclades Web UI has some logos and images.
1292
 
1293
The branding-related images are presented in  the following table:
1294

    
1295
===============  ============================  =========
1296
Image            Name/extension  convention    Usage
1297
===============  ============================  =========
1298
Favicon          favicon.ico                   Favicon for all services
1299
Dashboard logo   dashboard_logo.png            Visible in all Astakos UI pages
1300
Compute logo     compute_logo.png              Visible in all Cyclades UI pages
1301
Console logo     console_logo.png              Visible in the Cyclades Console Window
1302
Storage logo     storage_logo.png              Visible in all Pithos UI pages
1303
===============  ============================  =========
1304

    
1305
There are two methods  available for replacing all, or individual, 
1306
branding-related images:
1307

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

    
1311
   If you want to replace all of your images, keep the name/extension
1312
   conventions as indicated in the above table and change the
1313
   ``BRANDING_IMAGE_MEDIA_URL`` setting accordingly:
1314

    
1315
   .. code-block:: python
1316
        
1317
      # using relative path
1318
      BRANDING_IMAGE_MEDIA_URL= '/static/mybranding/images/' 
1319

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

    
1323

    
1324
   If you wish to replace individual images, **do not uncomment**
1325
   ``BRANDING_IMAGE_MEDIA_URL``, but instead provide a relative path, pointing to
1326
   the file inside your directory for each ``BRANDING_<image>_URL`` that you wish
1327
   to replace.
1328

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

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

    
1336
.. note:: Retina optimized images:
1337

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

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

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

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

    
1357
   In case that you don’t want to use a high-resolution image, the 
1358
   normal-resolution image will be visible.
1359

    
1360
More branding
1361
~~~~~~~~~~~~~
1362

    
1363
Although, it is not 100% branding-related, further verbal customization is
1364
feasible. 
1365

    
1366
**EMAILS**
1367

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

    
1372
In order to overwrite one or more email-templates you need to place your 
1373
modified <email-file>.txt files respecting the following structure:
1374
  
1375
  **/etc/synnefo/templates/**
1376
      **im/**
1377
          | activation_email.txt
1378
          | email.txt
1379
          | invitation.txt
1380
          | switch_accounts_email.txt
1381
          | welcome_email.txt
1382
          **projects/**
1383
              | project_approval_notification.txt
1384
              | project_denial_notification.txt    
1385
              | project_membership_change_notification.txt
1386
              | project_membership_enroll_notification.txt
1387
              | project_membership_leave_request_notification.txt
1388
              | project_membership_request_notification.txt
1389
              | project_suspension_notification.txt
1390
              | project_termination_notification.txt
1391
      **registration/**
1392
          | email_change_email.txt
1393
          | password_email.txt
1394

    
1395
Feel free to omit any of the above files you do not wish to overwrite.
1396

    
1397
Below is a list of all emails sent by Synnefo to users along with a short 
1398
description and a link to their content:
1399

    
1400
* ``snf-astakos-app/astakos/im/templates/im/email.txt``
1401
  Base email template. Contains a contact email and a “thank you” message.
1402
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/email.txt>`_)
1403
* ``snf-astakos-app/astakos/im/templates/im/activation_email.txt`` Email sent to
1404
  user that prompts  him/her to click on a link provided to activate the account.
1405
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/activation_email.txt>`_)
1406
* ``snf-astakos-app/astakos/im/templates/im/invitation.txt`` Email sent to an
1407
  invited user. He/she has to click on a link provided to activate the account.
1408
  Extends “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/invitation.txt>`_)
1409
* ``snf-astakos-app/astakos/im/templates/im/switch_accounts_email.txt`` Email
1410
  sent to user upon his/her request to associate this email address with a
1411
  shibboleth account. He/she has to click on a link provided to activate the
1412
  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>`_)
1413
* ``snf-astakos-app/astakos/im/templates/im/welcome_email.txt`` Email sent to
1414
  inform the user that his/ her account has been activated. Extends “email.txt”
1415
  (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/welcome_email.txt>`_)
1416
* ``snf-astakos-app/astakos/im/templates/registration/email_change_email.txt``
1417
  Email sent to user when he/she has requested new email address assignment. The
1418
  user has to click on a link provided to validate this action. Extends
1419
  “email.txt” (`Link <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/registration/email_change_email.txt>`_)
1420
* ``snf-astakos-app/astakos/im/templates/registration/password_email.txt`` Email
1421
  sent for resetting password purpose. The user has to click on a link provided
1422
  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>`_)
1423
* ``snf-astakos-app/astakos/im/templates/im/projects/project_approval_notification.txt``
1424
  Informs  the project owner that his/her project has been approved. Extends
1425
  “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>`_)
1426
* ``snf-astakos-app/astakos/im/templates/im/projects/project_denial_notification.txt``
1427
  Informs the project owner that his/her  project application has been denied
1428
  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>`_)
1429
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt``
1430
  An email is sent to a user containing information about his project membership
1431
  (whether he has been accepted, rejected or removed). Extends “email.txt” (`Link
1432
  <https://code.grnet.gr/projects/synnefo/repository/revisions/master/changes/snf-astakos-app/astakos/im/templates/im/projects/project_membership_change_notification.txt>`_)
1433
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_enroll_notification.txt``
1434
  Informs a user that he/she  has been enrolled to a project. Extends
1435
  “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>`_)
1436
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_leave_request_notification.txt``
1437
  An email is sent to the project owner to make him aware of a  user having
1438
  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>`_)
1439
* ``snf-astakos-app/astakos/im/templates/im/projects/project_membership_request_notification.txt``
1440
  An email is sent to the project owner to make him/her aware of a user having
1441
  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>`_)
1442
* ``snf-astakos-app/astakos/im/templates/im/projects/project_suspension_notification.txt``
1443
  An email is sent to the project owner to make him/her aware of his/her project
1444
  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>`_)
1445
* ``snf-astakos-app/astakos/im/templates/im/projects/project_termination_notification.txt``
1446
  An email is sent to the project owner to make him/her aware of his/her project
1447
  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>`_)
1448

    
1449
.. warning:: Django templates language:
1450

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

    
1456

    
1457
.. RabbitMQ
1458

    
1459
RabbitMQ Broker
1460
---------------
1461

    
1462
Queue nodes run the RabbitMQ sofware, which provides AMQP functionality. To
1463
guarantee high-availability, more than one Queue nodes should be deployed, each
1464
of them belonging to the same `RabbitMQ cluster
1465
<http://www.rabbitmq.com/clustering.html>`_. Synnefo uses the RabbitMQ
1466
active/active `High Available Queues <http://www.rabbitmq.com/ha.html>`_ which
1467
are mirrored between two nodes within a RabbitMQ cluster.
1468

    
1469
The RabbitMQ nodes that form the cluster, are declared to Synnefo through the
1470
`AMQP_HOSTS` setting. Each time a Synnefo component needs to connect to
1471
RabbitMQ, one of these nodes is chosen in a random way. The client that Synnefo
1472
uses to connect to RabbitMQ, handles connection failures transparently and
1473
tries to reconnect to a different node. As long as one of these nodes are up
1474
and running, functionality of Synnefo should not be downgraded by the RabbitMQ
1475
node failures.
1476

    
1477
All the queues that are being used are declared as durable, meaning that
1478
messages are persistently stored to RabbitMQ, until they get successfully
1479
processed by a client.
1480

    
1481
Currently, RabbitMQ is used by the following components:
1482

    
1483
* `snf-ganeti-eventd`, `snf-ganeti-hook` and `snf-progress-monitor`:
1484
  These components send messages concerning the status and progress of
1485
  jobs in the Ganeti backend.
1486
* `snf-dispatcher`: This daemon, consumes the messages that are sent from
1487
  the above components, and updates the Cyclades DB accordingly.
1488

    
1489

    
1490
Installation
1491
~~~~~~~~~~~~
1492

    
1493
Please check the RabbitMQ documentation which covers extensively the
1494
`installation of RabbitMQ server <http://www.rabbitmq.com/download.html>`_ and
1495
the setup of a `RabbitMQ cluster <http://www.rabbitmq.com/clustering.html>`_.
1496
Also, check out the `web management plugin
1497
<http://www.rabbitmq.com/management.html>`_ that can be useful for managing and
1498
monitoring RabbitMQ.
1499

    
1500
For a basic installation of RabbitMQ on two nodes (node1 and node2) you can do
1501
the following:
1502

    
1503
On both nodes, install rabbitmq-server and create a Synnefo user:
1504

    
1505
.. code-block:: console
1506

    
1507
  $ apt-get install rabbitmq-server
1508
  $ rabbitmqctl add_user synnefo "example_pass"
1509
  $ rabbitmqctl set_permissions synnefo  ".*" ".*" ".*"
1510

    
1511
Also guarantee that both nodes share the same cookie, by running:
1512

    
1513
.. code-block:: console
1514

    
1515
  $ scp node1:/var/lib/rabbitmq/.erlang.cookie node2:/var/lib/rabbitmq/.erlang.cookie
1516

    
1517
and restart the nodes:
1518

    
1519
.. code-block:: console
1520

    
1521
  $ /etc/init.d/rabbitmq-server restart
1522

    
1523

    
1524
To setup the RabbitMQ cluster run:
1525

    
1526
.. code-block:: console
1527

    
1528
  root@node2: rabbitmqctl stop_app
1529
  root@node2: rabbitmqctl reset
1530
  root@node2: rabbitmqctl cluster rabbit@node1 rabbit@node2
1531
  root@node2: rabbitmqctl start_app
1532

    
1533
You can verify that the cluster is set up correctly by running:
1534

    
1535
.. code-block:: console
1536

    
1537
  root@node2: rabbitmqctl cluster_status
1538

    
1539

    
1540
Logging
1541
-------
1542

    
1543
Logging in Synnefo is using Python's logging module. The module is configured
1544
using dictionary configuration, whose format is described here:
1545

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

    
1548
Note that this is a feature of Python 2.7 that we have backported for use in
1549
Python 2.6.
1550

    
1551
The logging configuration dictionary is defined in
1552
``/etc/synnefo/10-snf-webproject-logging.conf``
1553

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

    
1559
By default, the Django webapp and snf-manage logs to syslog, while
1560
`snf-dispatcher` logs to `/var/log/synnefo/dispatcher.log`.
1561

    
1562

    
1563
.. _scale-up:
1564

    
1565
Scaling up to multiple nodes
1566
============================
1567

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

    
1575
Graph of a scale-out Synnefo deployment
1576
---------------------------------------
1577

    
1578
Each box in the following graph corresponds to a distinct physical node:
1579

    
1580
.. image:: images/synnefo-arch2-roles.png
1581
   :width: 100%
1582
   :target: _images/synnefo-arch2-roles.png
1583

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

    
1589
.. _physical-node-roles:
1590

    
1591
Physical Node roles
1592
-------------------
1593

    
1594
As appears in the previous graph, a scale-out Synnefo deployment consists of
1595
multiple physical nodes that have the following roles:
1596

    
1597
* **WEBSERVER**: A web server running in front of gunicorn (e.g.: Apache, nginx)
1598
* **ASTAKOS**: The Astakos application (gunicorn)
1599
* **ASTAKOS_DB**: The Astakos database (postgresql)
1600
* **PITHOS**: The Pithos application (gunicorn)
1601
* **PITHOS_DB**: The Pithos database (postgresql)
1602
* **CYCLADES**: The Cyclades application (gunicorn)
1603
* **CYCLADES_DB**: The Cyclades database (postgresql)
1604
* **MQ**: The message queue (RabbitMQ)
1605
* **GANETI_MASTER**: The Ganeti master of a Ganeti cluster
1606
* **GANETI_NODE** : A VM-capable Ganeti node of a Ganeti cluster
1607

    
1608
You will probably also have:
1609

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

    
1615
From this point we will also refer to the following groups of roles:
1616

    
1617
* **SYNNEFO**: [ **ASTAKOS**, **ASTAKOS_DB**, **PITHOS**, **PITHOS_DB**, **CYCLADES**, **CYCLADES_DB**, **MQ**, **CMS**]
1618
* **G_BACKEND**: [**GANETI_MASTER**, **GANETI_NODE**]
1619

    
1620
Of course, when deploying Synnefo you can combine multiple of the above roles on a
1621
single physical node, but if you are trying to scale out, the above separation
1622
gives you significant advantages.
1623

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

    
1628
Components for each role
1629
------------------------
1630

    
1631
When deploying Synnefo in large scale, you need to install different Synnefo
1632
or/and third party components on different physical nodes according to their
1633
Synnefo role, as stated in the previous section.
1634

    
1635
Specifically:
1636

    
1637
Role **WEBSERVER**
1638
    * Synnefo components: `None`
1639
    * 3rd party components: Apache
1640
Role **ASTAKOS**
1641
    * Synnefo components: `snf-webproject`, `snf-astakos-app`
1642
    * 3rd party components: Django, Gunicorn
1643
Role **ASTAKOS_DB**
1644
    * Synnefo components: `None`
1645
    * 3rd party components: PostgreSQL
1646
Role **PITHOS**
1647
    * Synnefo components: `snf-webproject`, `snf-pithos-app`, `snf-pithos-webclient`
1648
    * 3rd party components: Django, Gunicorn
1649
Role **PITHOS_DB**
1650
    * Synnefo components: `None`
1651
    * 3rd party components: PostgreSQL
1652
Role **CYCLADES**
1653
    * Synnefo components: `snf-webproject`, `snf-cyclades-app`, `snf-vncauthproxy`
1654
    * 3rd party components: Django Gunicorn
1655
Role **CYCLADES_DB**
1656
    * Synnefo components: `None`
1657
    * 3rd party components: PostgreSQL
1658
Role **MQ**
1659
    * Synnefo components: `None`
1660
    * 3rd party components: RabbitMQ
1661
Role **GANETI_MASTER**
1662
    * Synnefo components: `snf-cyclades-gtools`
1663
    * 3rd party components: Ganeti
1664
Role **GANETI_NODE**
1665
    * Synnefo components: `snf-cyclades-gtools`, `snf-network`, `snf-image`, `nfdhcpd`
1666
    * 3rd party components: Ganeti
1667
Role **CMS**
1668
    * Synnefo components: `snf-webproject`, `snf-cloudcms`
1669
    * 3rd party components: Django, Gunicorn
1670
Role **NS**
1671
    * Synnefo components: `None`
1672
    * 3rd party components: BIND
1673
Role **CLIENT**
1674
    * Synnefo components: `kamaki`, `snf-image-creator`
1675
    * 3rd party components: `None`
1676

    
1677
Example scale out installation
1678
------------------------------
1679

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

    
1684
We assume that we have the following 10 physical nodes with the corresponding
1685
roles:
1686

    
1687
Node1:
1688
    **WEBSERVER**, **ASTAKOS**
1689
      Guide sections:
1690
        * :ref:`apt <i-apt>`
1691
        * :ref:`gunicorn <i-gunicorn>`
1692
        * :ref:`apache <i-apache>`
1693
        * :ref:`snf-webproject <i-webproject>`
1694
        * :ref:`snf-astakos-app <i-astakos>`
1695
Node2:
1696
    **WEBSERVER**, **PITHOS**
1697
      Guide sections:
1698
        * :ref:`apt <i-apt>`
1699
        * :ref:`gunicorn <i-gunicorn>`
1700
        * :ref:`apache <i-apache>`
1701
        * :ref:`snf-webproject <i-webproject>`
1702
        * :ref:`snf-pithos-app <i-pithos>`
1703
        * :ref:`snf-pithos-webclient <i-pithos>`
1704
Node3:
1705
    **WEBSERVER**, **CYCLADES**
1706
      Guide sections:
1707
        * :ref:`apt <i-apt>`
1708
        * :ref:`gunicorn <i-gunicorn>`
1709
        * :ref:`apache <i-apache>`
1710
        * :ref:`snf-webproject <i-webproject>`
1711
        * :ref:`snf-cyclades-app <i-cyclades>`
1712
        * :ref:`snf-vncauthproxy <i-cyclades>`
1713
Node4:
1714
    **WEBSERVER**, **CMS**
1715
      Guide sections:
1716
        * :ref:`apt <i-apt>`
1717
        * :ref:`gunicorn <i-gunicorn>`
1718
        * :ref:`apache <i-apache>`
1719
        * :ref:`snf-webproject <i-webproject>`
1720
        * :ref:`snf-cloudcms <i-cms>`
1721
Node5:
1722
    **ASTAKOS_DB**, **PITHOS_DB**, **CYCLADES_DB**
1723
      Guide sections:
1724
        * :ref:`apt <i-apt>`
1725
        * :ref:`postgresql <i-db>`
1726
Node6:
1727
    **MQ**
1728
      Guide sections:
1729
        * :ref:`apt <i-apt>`
1730
        * :ref:`rabbitmq <i-mq>`
1731
Node7:
1732
    **GANETI_MASTER**, **GANETI_NODE**
1733
      Guide sections:
1734
        * :ref:`apt <i-apt>`
1735
        * :ref:`general <i-backends>`
1736
        * :ref:`ganeti <i-ganeti>`
1737
        * :ref:`snf-cyclades-gtools <i-gtools>`
1738
        * :ref:`snf-network <i-network>`
1739
        * :ref:`snf-image <i-image>`
1740
        * :ref:`nfdhcpd <i-network>`
1741
Node8:
1742
    **GANETI_NODE**
1743
      Guide sections:
1744
        * :ref:`apt <i-apt>`
1745
        * :ref:`general <i-backends>`
1746
        * :ref:`ganeti <i-ganeti>`
1747
        * :ref:`snf-cyclades-gtools <i-gtools>`
1748
        * :ref:`snf-network <i-network>`
1749
        * :ref:`snf-image <i-image>`
1750
        * :ref:`nfdhcpd <i-network>`
1751
Node9:
1752
    **GANETI_NODE**
1753
      Guide sections:
1754
        `Same as Node8`
1755
Node10:
1756
    **GANETI_NODE**
1757
      Guide sections:
1758
        `Same as Node8`
1759

    
1760
All sections: :ref:`Scale out Guide <i-synnefo>`
1761

    
1762

    
1763
Upgrade Notes
1764
=============
1765

    
1766
.. toctree::
1767
   :maxdepth: 1
1768

    
1769
   v0.12 -> v0.13 <upgrade/upgrade-0.13>
1770

    
1771

    
1772
Changelog, NEWS
1773
===============
1774

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