Statistics
| Branch: | Tag: | Revision:

root / docs / quick-install-admin-guide.rst @ 04427415

History | View | Annotate | Download (29.9 kB)

1
.. _quick-install-admin-guide:
2

    
3
Administrator's Quick Installation Guide
4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5

    
6
This is the Administrator's quick installation guide.
7

    
8
It describes how to install the whole synnefo stack on two (2) physical nodes,
9
with minimum configuration. It installs synnefo from Debian packages, and
10
assumes the nodes run Debian Squeeze. After successful installation, you will
11
have the following services running:
12

    
13
 * Identity Management (Astakos)
14
 * File Storage Service (Pithos+)
15
 * Compute Service (Cyclades)
16
 * Image Registry Service (Plankton)
17

    
18
and a single unified Web UI to manage them all.
19

    
20
The Volume Storage Service (Archipelago) and the Billing Service (Aquarium) are
21
not released yet.
22

    
23
If you just want to install the File Storage Service (Pithos+), follow the guide
24
and just stop after the "Testing of Pithos+" section.
25

    
26

    
27
Installation of Synnefo / Introduction
28
======================================
29

    
30
We will install the services with the above list's order. Cyclades and Plankton
31
will be installed in a single step (at the end), because at the moment they are
32
contained in the same software component. Furthermore, we will install all
33
services in the first physical node, except Pithos+ which will be installed in
34
the second, due to a conflict between the snf-pithos-app and snf-cyclades-app
35
component (scheduled to be fixed in the next version).
36

    
37
For the rest of the documentation we will refer to the first physical node as
38
"node1" and the second as "node2". We will also assume that their domain names
39
are "node1.example.com" and "node2.example.com" and their IPs are "4.3.2.1" and
40
"4.3.2.2" respectively.
41

    
42

    
43
General Prerequisites
44
=====================
45

    
46
These are the general synnefo prerequisites, that you need on node1 and node2
47
and are related to all the services (Astakos, Pithos+, Cyclades, Plankton).
48

    
49
To be able to download all synnefo components you need to add the following
50
lines in your ``/etc/apt/sources.list`` file:
51

    
52
| ``deb http://apt.dev.grnet.gr squeeze main``
53
| ``deb-src http://apt.dev.grnet.gr squeeze main``
54

    
55
| ``deb http://apt.noc.grnet.gr experimental main``
56
| ``deb-src http://apt.noc.grnet.gr experimental main``
57

    
58
| ``deb http://apt.noc.grnet.gr squeeze backports``
59
| ``deb-src http://apt.noc.grnet.gr squeeze backports``
60

    
61
You also need a shared directory visible by both nodes. Pithos+ will save all
62
data inside this directory. By 'all data', we mean files, images, and pithos
63
specific mapping data. If you plan to upload more than one basic image, this
64
directory should have at least 50GB of free space. During this guide, we will
65
assume that node1 acts as an NFS server and serves the directory ``/srv/pithos``
66
to node2. Node2 has this directory mounted under ``/srv/pithos``, too.
67

    
68
Before starting the synnefo installation, you will need basic third party
69
software to be installed and configured on the physical nodes. We will describe
70
each node's general prerequisites separately. Any additional configuration,
71
specific to a synnefo service for each node, will be described at the service's
72
section.
73

    
74
Node1
75
-----
76

    
77
General Synnefo dependencies
78
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79

    
80
 * apache (http server)
81
 * gunicorn (WSGI http server)
82
 * postgresql (database)
83
 * rabbitmq (message queue)
84

    
85
You can install the above by running:
86

    
87
.. code-block:: console
88

    
89
   # apt-get install apache2 gunicorn postgresql
90

    
91
Make sure you have installed gunicorn >= v0.12.2. On node1, we will create our
92
databases, so you will also need the python-psycopg2 package:
93

    
94
.. code-block:: console
95

    
96
   # apt-get install python-psycopg2
97

    
98
Database setup
99
~~~~~~~~~~~~~~
100

    
101
On node1, we create a database called ``snf_apps``, that will host all django
102
apps related tables. We also create the user ``synnefo`` and grant him all
103
privileges on the database. We do this by running:
104

    
105
.. code-block:: console
106

    
107
   root@node1:~ # su - postgres
108
   postgres@node1:~ $ psql
109
   postgres=# CREATE DATABASE snf_apps WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE=template0;
110
   postgres=# CREATE USER synnefo WITH PASSWORD 'example_passw0rd';
111
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_apps TO synnefo;
112

    
113
We also create the database ``snf_pithos`` needed by the pithos+ backend and
114
grant the ``synnefo`` user all privileges on the database. This database could
115
be created on node2 instead, but we do it on node1 for simplicity. We will
116
create all needed databases on node1 and then node2 will connect to them.
117

    
118
.. code-block:: console
119

    
120
   postgres=# CREATE DATABASE snf_pithos WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C'
121
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_pithos TO synnefo;
122

    
123
Configure the database to listen to all network interfaces. You can do this by
124
editting the file ``/etc/postgresql/8.4/main/postgresql.conf`` and change
125
``listen_addresses`` to ``'*'`` :
126

    
127
.. code-block:: console
128

    
129
   listen_addresses = '*'
130

    
131
Furthermore, edit ``/etc/postgresql/8.4/main/pg_hba.conf`` to allow node1 and
132
node2 to connect to the database. Add the following lines under ``#IPv4 local
133
connections:`` :
134

    
135
.. code-block:: console
136

    
137
   host		all	all	4.3.2.1/32	md5
138
   host		all	all	4.3.2.2/32	md5
139

    
140
Make sure to substitute "4.3.2.1" and "4.3.2.2" with node1's and node2's
141
actual IPs. Now, restart the server to apply the changes:
142

    
143
.. code-block:: console
144

    
145
   # /etc/init.d/postgresql restart
146

    
147
Gunicorn setup
148
~~~~~~~~~~~~~~
149

    
150
Create the file ``synnefo`` under ``/etc/gunicorn.d/`` containing the following:
151

    
152
.. code-block:: console
153

    
154
   CONFIG = {
155
    'mode': 'django',
156
    'environment': {
157
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
158
    },
159
    'working_dir': '/etc/synnefo',
160
    'user': 'www-data',
161
    'group': 'www-data',
162
    'args': (
163
      '--bind=127.0.0.1:8080',
164
      '--workers=4',
165
      '--log-level=debug',
166
    ),
167
   }
168

    
169
!!! Warning: Do NOT start the server yet, because it won't find the
170
``synnefo.settings`` module. We will start the server after successful
171
installation of astakos. If the server is running:
172

    
173
.. code-block:: console
174

    
175
   # /etc/init.d/gunicorn stop
176

    
177
Apache2 setup
178
~~~~~~~~~~~~~
179

    
180
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
181
the following:
182

    
183
.. code-block:: console
184

    
185
   <VirtualHost *:80>
186
     ServerName node1.example.com
187

    
188
     RewriteEngine On
189
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
190
   </VirtualHost>
191

    
192
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
193
containing the following:
194

    
195
.. code-block:: console
196

    
197
   <IfModule mod_ssl.c>
198
   <VirtualHost _default_:443>
199
     ServerName node1.example.com
200

    
201
     Alias /static "/usr/share/synnefo/static"
202

    
203
   #  SetEnv no-gzip
204
   #  SetEnv dont-vary
205

    
206
     AllowEncodedSlashes On
207

    
208
     RequestHeader set X-Forwarded-Protocol "https"
209

    
210
     <Proxy * >
211
       Order allow,deny
212
       Allow from all
213
     </Proxy>
214

    
215
     SetEnv                proxy-sendchunked
216
     SSLProxyEngine        off
217
     ProxyErrorOverride    off
218

    
219
     ProxyPass        /static !
220
     ProxyPass        / http://localhost:8080/ retry=0
221
     ProxyPassReverse / http://localhost:8080/
222

    
223
     RewriteEngine On
224
     RewriteRule ^/login(.*) /im/login/redirect$1 [PT,NE]
225

    
226
     SSLEngine on
227
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
228
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
229
   </VirtualHost>
230
   </IfModule>
231

    
232
Now enable sites and modules by running:
233

    
234
.. code-block:: console
235

    
236
   # a2enmod ssl
237
   # a2enmod rewrite
238
   # a2dissite default
239
   # a2ensite synnefo
240
   # a2ensite synnefo-ssl
241
   # a2enmod headers
242
   # a2enmod proxy_http
243

    
244
!!! Warning: Do NOT start/restart the server yet. If the server is running:
245

    
246
.. code-block:: console
247

    
248
   # /etc/init.d/apache2 stop
249

    
250
Pithos+ data directory setup
251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252

    
253
As mentioned in the General Prerequisites section, there is a directory called
254
``/srv/pithos`` visible by both nodes. We create and setup the ``data``
255
directory inside it:
256

    
257
.. code-block:: console
258

    
259
   # cd /srv/pithos
260
   # mkdir data
261
   # chown www-data:www-data data
262
   # chmod g+ws data
263

    
264
You are now ready with all general prerequisites concerning node1. Let's go to
265
node2.
266

    
267
Node2
268
-----
269

    
270
General Synnefo dependencies
271
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272

    
273
 * apache (http server)
274
 * gunicorn (WSGI http server)
275
 * postgresql (database)
276
 * rabbitmq (message queue)
277

    
278
You can install the above by running:
279

    
280
.. code-block:: console
281

    
282
   # apt-get install apache2 gunicorn postgresql
283

    
284
Make sure you have installed the same package versions as in node1. Node2 will
285
connect to the databases on node1, so you will also need the python-psycopg2
286
package:
287

    
288
.. code-block:: console
289

    
290
   # apt-get install python-psycopg2
291

    
292
Database setup
293
~~~~~~~~~~~~~~
294

    
295
All databases have been created and setup on node1, so we do not need to take
296
any action here. From node2, we will just connect to them. When you get familiar
297
with the software you may choose to run different databases on different nodes,
298
for performance/scalability/redundancy reasons, but those kind of setups are out
299
of the purpose of this guide.
300

    
301
Gunicorn setup
302
~~~~~~~~~~~~~~
303

    
304
Create the file ``synnefo`` under ``/etc/gunicorn.d/`` containing the following
305
(same contents as in node1; you can just copy/paste the file):
306

    
307
.. code-block:: console
308

    
309
   CONFIG = {
310
    'mode': 'django',
311
    'environment': {
312
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
313
    },
314
    'working_dir': '/etc/synnefo',
315
    'user': 'www-data',
316
    'group': 'www-data',
317
    'args': (
318
      '--bind=127.0.0.1:8080',
319
      '--workers=4',
320
      '--log-level=debug',
321
    ),
322
   }
323

    
324
!!! Warning: Do NOT start the server yet, because it won't find the
325
``synnefo.settings`` module. We will start the server after successful
326
installation of astakos. If the server is running:
327

    
328
.. code-block:: console
329

    
330
   # /etc/init.d/gunicorn stop
331

    
332
Apache2 setup
333
~~~~~~~~~~~~~
334

    
335
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
336
the following:
337

    
338
.. code-block:: console
339

    
340
   <VirtualHost *:80>
341
     ServerName node2.example.com
342

    
343
     RewriteEngine On
344
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
345
   </VirtualHost>
346

    
347
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
348
containing the following:
349

    
350
.. code-block:: console
351

    
352
   <IfModule mod_ssl.c>
353
   <VirtualHost _default_:443>
354
     ServerName node2.example.com
355

    
356
     Alias /static "/usr/share/synnefo/static"
357

    
358
     SetEnv no-gzip
359
     SetEnv dont-vary
360
     AllowEncodedSlashes On
361

    
362
     RequestHeader set X-Forwarded-Protocol "https"
363

    
364
     <Proxy * >
365
       Order allow,deny
366
       Allow from all
367
     </Proxy>
368

    
369
     SetEnv                proxy-sendchunked
370
     SSLProxyEngine        off
371
     ProxyErrorOverride    off
372

    
373
     ProxyPass        /static !
374
     ProxyPass        / http://localhost:8080/ retry=0
375
     ProxyPassReverse / http://localhost:8080/
376

    
377
     SSLEngine on
378
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
379
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
380
   </VirtualHost>
381
   </IfModule>
382

    
383
As in node1, enable sites and modules by running:
384

    
385
.. code-block:: console
386

    
387
   # a2enmod ssl
388
   # a2enmod rewrite
389
   # a2dissite default
390
   # a2ensite synnefo
391
   # a2ensite synnefo-ssl
392
   # a2enmod headers
393
   # a2enmod proxy_http
394

    
395
!!! Warning: Do NOT start/restart the server yet. If the server is running:
396

    
397
.. code-block:: console
398

    
399
   # /etc/init.d/apache2 stop
400

    
401
We are now ready with all general prerequisites for node2. Now that we have
402
finished with all general prerequisites for both nodes, we can start installing
403
the services. First, let's install Astakos on node1.
404

    
405

    
406
Installation of Astakos on node1
407
================================
408

    
409
To install astakos, grab the package from our repository (make sure  you made
410
the additions needed in your ``/etc/apt/sources.list`` file, as described
411
previously), by running:
412

    
413
.. code-block:: console
414

    
415
   # apt-get install snf-astakos-app
416

    
417
After successful installation of snf-astakos-app, make sure that also
418
snf-webproject has been installed (marked as "Recommended" package). By default
419
Debian installs "Recommended" packages, but if you have changed your
420
configuration and the package didn't install automatically, you should
421
explicitly install it manually running:
422

    
423
.. code-block:: console
424

    
425
   # apt-get install snf-webproject
426

    
427
The reason snf-webproject is "Recommended" and not a hard dependency, is to give
428
the experienced administrator the ability to install synnefo in a custom made
429
django project. This corner case concerns only very advanced users that know
430
what they are doing and want to experiment with synnefo.
431

    
432

    
433
Configuration of Astakos
434
========================
435

    
436
Conf Files
437
----------
438

    
439
After astakos is successfully installed, you will find the directory
440
``/etc/synnefo`` and some configuration files inside it. The files contain
441
commented configuration options, which are the default options. While installing
442
new snf-* components, new configuration files will appear inside the directory.
443
In this guide (and for all services), we will edit only the minimum necessary
444
configuration options, to reflect our setup. Everything else will remain as is.
445

    
446
After getting familiar with synnefo, you will be able to customize the software
447
as you wish and fits your needs. Many options are available, to empower the
448
administrator with extensively customizable setups.
449

    
450
For the snf-webproject component (installed as an astakos dependency), we
451
need the following:
452

    
453
Edit ``/etc/synnefo/10-snf-webproject-database.conf``. You will need to
454
uncomment and edit the ``DATABASES`` block to reflect our database:
455

    
456
.. code-block:: console
457

    
458
   DATABASES = {
459
    'default': {
460
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
461
        'ENGINE': 'postgresql_psycopg2',
462
         # ATTENTION: This *must* be the absolute path if using sqlite3.
463
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
464
        'NAME': 'snf_apps',
465
        'USER': 'synnefo',                      # Not used with sqlite3.
466
        'PASSWORD': 'examle_passw0rd',          # Not used with sqlite3.
467
        # Set to empty string for localhost. Not used with sqlite3.
468
        'HOST': '4.3.2.1',
469
        # Set to empty string for default. Not used with sqlite3.
470
        'PORT': '5432',
471
    }
472
   }
473

    
474
Edit ``/etc/synnefo/10-snf-webproject-deploy.conf``. Uncomment and edit
475
``SECRET_KEY``. This is a django specific setting which is used to provide a
476
seed in secret-key hashing algorithms. Set this to a random string of your
477
choise and keep it private:
478

    
479
.. code-block:: console
480

    
481
   SECRET_KEY = 'sy6)mw6a7x%n)-example_secret_key#zzk4jo6f2=uqu!1o%)'
482

    
483
For astakos specific configuration, edit the following options in
484
``/etc/synnefo/20-snf-astakos-setting.conf`` :
485

    
486
.. code-block:: console
487

    
488
   ASTAKOS_IM_MODULES = ['local']
489

    
490
   ASTAKOS_COOKIE_DOMAIN = '.example.com'
491

    
492
   ASTAKOS_BASEURL = 'https://node1.example.com'
493

    
494
   ASTAKOS_SITENAME = '~okeanos demo example'
495

    
496
   ASTAKOS_CLOUD_SERVICES = (
497
           { 'url':'https://node1.example.com/im/', 'name':'~okeanos home', 'id':'cloud', 'icon':'home-icon.png' },
498
           { 'url':'https://node1.example.com/ui/', 'name':'cyclades', 'id':'cyclades' },
499
           { 'url':'https://node2.example.com/ui/', 'name':'pithos+', 'id':'pithos' })
500

    
501
   ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
502
   ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
503

    
504
   ASTAKOS_RECAPTCHA_USE_SSL = True
505

    
506
``ASTAKOS_IM_MODULES`` refers to the astakos login methods. For now only local
507
is supported. The ``ASTAKOS_COOKIE_DOMAIN`` should be the base url of our
508
domain (for all services). ``ASTAKOS_BASEURL`` is the astakos home page.
509
``ASTAKOS_CLOUD_SERVICES`` contains all services visible to and served by
510
astakos. The first element of the dictionary is used to point to a generic
511
landing page for your services (cyclades, pithos). If you don't have such a
512
page it can be omitted. The second and third element point to our services
513
themselves (the apps) and should be set as above.
514

    
515
For the ``ASTAKOS_RECAPTCHA_PUBLIC_KEY`` and ``ASTAKOS_RECAPTCHA_PRIVATE_KEY``
516
go to https://www.google.com/recaptcha/admin/create and create your own pair.
517

    
518
Servers Initialization
519
----------------------
520

    
521
After configuration is done, we initialize the servers on node1:
522

    
523
.. code-block:: console
524

    
525
   root@node1:~ # /etc/init.d/gunicorn restart
526
   root@node1:~ # /etc/init.d/apache2 restart
527

    
528
Database Initialization
529
-----------------------
530

    
531
Then, we initialize the database by running:
532

    
533
.. code-block:: console
534

    
535
   # snf-manage syncdb
536

    
537
At this example we don't need to create a django superuser, so we select
538
``[no]`` to the question. After a successful sync, we run the migration needed
539
for astakos:
540

    
541
.. code-block:: console
542

    
543
   # snf-manage migrate im
544

    
545
You have now finished the Astakos setup. Let's test it now.
546

    
547

    
548
Testing of Astakos
549
==================
550

    
551
Open your favorite browser and go to:
552

    
553
``http://node1.example.com/im``
554

    
555
If this redirects you to ``https://node1.example.com/im`` and you can see
556
the "welcome" door of Astakos, then you have successfully setup Astakos.
557

    
558
Let's create our first user. At the homepage click the "CREATE ACCOUNT" button
559
and fill all your data at the sign up form. Then click "SUBMIT". You should now
560
see a green box on the top, which informs you that you made a successful request
561
and the request has been sent to the administrators. So far so good.
562

    
563
Now we need to activate that user. Return to a command prompt at node1 and run:
564

    
565
.. code-block:: console
566

    
567
   root@node1:~ # snf-manage listusers
568

    
569
This command should show you a list with only one user; the one we just created.
570
This user should have an id with a value of ``1``. It should also have an
571
"active" status with the value of ``0`` (inactive). Now run:
572

    
573
.. code-block:: console
574

    
575
   root@node1:~ # snf-manage modifyuser --set-active 1
576

    
577
This modifies the active value to ``1``, and actually activates the user.
578
When running in production, the activation is done automatically with different
579
types of moderation, that Astakos supports. You can see the moderation methods
580
(by invitation, whitelists, matching regexp, etc.) at the Astakos specific
581
documentation.
582

    
583
Now let's go back to the homepage. Open ``http://node1.example.com/im`` with
584
your browser again. Try to sign in using your new credentials. If the astakos
585
menu appears and you can see your profile, then you have successfully setup
586
Astakos.
587

    
588
Let's continue to install Pithos+ now.
589

    
590

    
591
Installation of Pithos+ on node2
592
================================
593

    
594
To install pithos+, grab the packages from our repository (make sure  you made
595
the additions needed in your ``/etc/apt/sources.list`` file, as described
596
previously), by running:
597

    
598
.. code-block:: console
599

    
600
   # apt-get install snf-pithos-app
601

    
602
After successful installation of snf-pithos-app, make sure that also
603
snf-webproject has been installed (marked as "Recommended" package). Refer to
604
the "Installation of Astakos on node1" section, if you don't remember why this
605
should happen. Now, install the pithos web interface:
606

    
607
.. code-block:: console
608

    
609
   # apt-get install snf-pithos-webclient
610

    
611
This package provides the standalone pithos web client. The web client is the
612
web UI for pithos+ and will be accessible by clicking "pithos+" on the Astakos
613
interface's cloudbar, at the top of the Astakos homepage.
614

    
615
Configuration of Pithos+
616
========================
617

    
618
Conf Files
619
----------
620

    
621
After pithos+ is successfully installed, you will find the directory
622
``/etc/synnefo`` and some configuration files inside it, as you did in node1
623
after installation of astakos. Here, you will not have to change anything that
624
has to do with snf-common or snf-webproject. Everything is set at node1. You
625
only need to change settings that have to do with pithos+. Specifically:
626

    
627
Edit ``/etc/synnefo/20-snf-pithos-app-settings.conf``. There you need to set
628
only the two options:
629

    
630
.. code-block:: console
631

    
632
   PITHOS_BACKEND_DB_CONNECTION = 'postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos'
633

    
634
   PITHOS_BACKEND_BLOCK_PATH = '/srv/pithos/data'
635

    
636
The ``PITHOS_BACKEND_DB_CONNECTION`` option tells to the pithos+ backend where
637
to find its database. Above we tell pithos+ that its database is ``snf_pithos``
638
at node1 and to connect as user ``synnefo`` with password ``example_passw0rd``.
639
All those settings where setup during node1's "Database setup" section.
640

    
641
The ``PITHOS_BACKEND_BLOCK_PATH`` option tells to the pithos+ backend where to
642
store its data. Above we tell pithos+ to store its data under
643
``/srv/pithos/data``, which is visible by both nodes. We have already setup this
644
directory at node1's "Pithos+ data directory setup" section.
645

    
646
Then we need to setup the web UI and connect it to astakos. To do so, edit
647
``/etc/synnefo/20-snf-pithos-webclient-settings.conf``:
648

    
649
.. code-block:: console
650

    
651
   PITHOS_UI_LOGIN_URL = "https://node1.example.com/im/login?next="
652
   PITHOS_UI_FEEDBACK_URL = "https://node1.example.com/im/feedback"
653

    
654
The ``PITHOS_UI_LOGIN_URL`` option tells the client where to redirect you, if
655
you are not logged in. The ``PITHOS_UI_FEEDBACK_URL`` option points at the
656
pithos+ feedback form. Astakos already provides a generic feedback form for all
657
services, so we use this one.
658

    
659
Then edit ``/etc/synnefo/20-snf-pithos-webclient-cloudbar.conf``, to connect the
660
pithos+ web UI with the astakos web UI (through the top cloudbar):
661

    
662
.. code-block:: console
663

    
664
   CLOUDBAR_LOCATION = 'https://node1.example.com/static/im/cloudbar/'
665
   CLOUDBAR_ACTIVE_SERVICE = 'pithos'
666
   CLOUDBAR_SERVICES_URL = 'https://node1.example.com/im/get_services'
667
   CLOUDBAR_MENU_URL = 'https://node1.example.com/im/get_menu'
668

    
669
The ``CLOUDBAR_LOCATION`` tells the client where to find the astakos common
670
cloudbar.
671

    
672
The ``CLOUDBAR_ACTIVE_SERVICE`` registers the client as a new service served by
673
astakos. It's name should be identical with the ``id`` name given at the
674
astakos' ``ASTAKOS_CLOUD_SERVICES`` variable. Note that at the Astakos "Conf
675
Files" section, we actually set the third item of the ``ASTAKOS_CLOUD_SERVICES``
676
list, to the dictionary:
677
``{ 'url':'https://nod...', 'name':'pithos+', 'id':'pithos }``. This item
678
represents the pithos+ service. The ``id`` we set there, is the ``id`` we want
679
here.
680

    
681
The ``CLOUDBAR_SERVICES_URL`` and ``CLOUDBAR_MENU_URL`` options are used by the
682
pithos+ web client to get from astakos all the information needed to fill its
683
own cloudbar.  So we put our astakos deployment urls there.
684

    
685
Servers Initialization
686
----------------------
687

    
688
After configuration is done, we initialize the servers on node2:
689

    
690
.. code-block:: console
691

    
692
   root@node2:~ # /etc/init.d/gunicorn restart
693
   root@node2:~ # /etc/init.d/apache2 restart
694

    
695
You have now finished the Pithos+ setup. Let's test it now.
696

    
697

    
698
Testing of Pithos+
699
==================
700

    
701

    
702
Installation of Cyclades (and Plankton) on node1
703
================================================
704

    
705
Installation of cyclades is a two step process:
706

    
707
1. install the external services (prerequisites) on which cyclades depends
708
2. install the synnefo software components associated with cyclades
709

    
710
Prerequisites
711
-------------
712
.. _cyclades-install-ganeti:
713

    
714
Ganeti installation
715
~~~~~~~~~~~~~~~~~~~
716

    
717
Synnefo requires a working Ganeti installation at the backend. Installation
718
of Ganeti is not covered by this document, please refer to
719
`ganeti documentation <http://docs.ganeti.org/ganeti/current/html>`_ for all the
720
gory details. A successful Ganeti installation concludes with a working
721
:ref:`GANETI-MASTER <GANETI_NODES>` and a number of :ref:`GANETI-NODEs <GANETI_NODES>`.
722

    
723
.. _cyclades-install-db:
724

    
725
Database
726
~~~~~~~~
727

    
728
Database installation is done as part of the
729
:ref:`snf-webproject <snf-webproject>` component.
730

    
731
.. _cyclades-install-rabbitmq:
732

    
733
RabbitMQ
734
~~~~~~~~
735

    
736
RabbitMQ is used as a generic message broker for cyclades. It should be
737
installed on two seperate :ref:`QUEUE <QUEUE_NODE>` nodes in a high availability
738
configuration as described here:
739

    
740
    http://www.rabbitmq.com/pacemaker.html
741

    
742
After installation, create a user and set its permissions:
743

    
744
.. code-block:: console
745

    
746
    $ rabbitmqctl add_user <username> <password>
747
    $ rabbitmqctl set_permissions -p / <username>  "^.*" ".*" ".*"
748

    
749
The values set for the user and password must be mirrored in the
750
``RABBIT_*`` variables in your settings, as managed by
751
:ref:`snf-common <snf-common>`.
752

    
753
.. todo:: Document an active-active configuration based on the latest version
754
   of RabbitMQ.
755

    
756
.. _cyclades-install-vncauthproxy:
757

    
758
vncauthproxy
759
~~~~~~~~~~~~
760

    
761
To support OOB console access to the VMs over VNC, the vncauthproxy
762
daemon must be running on every :ref:`APISERVER <APISERVER_NODE>` node.
763

    
764
.. note:: The Debian package for vncauthproxy undertakes all configuration
765
   automatically.
766

    
767
Download and install the latest vncauthproxy from its own repository,
768
at `https://code.grnet.gr/git/vncauthproxy`, or a specific commit:
769

    
770
.. code-block:: console
771

    
772
    $ bin/pip install -e git+https://code.grnet.gr/git/vncauthproxy@INSERT_COMMIT_HERE#egg=vncauthproxy
773

    
774
Create ``/var/log/vncauthproxy`` and set its permissions appropriately.
775

    
776
Alternatively, build and install Debian packages.
777

    
778
.. code-block:: console
779

    
780
    $ git checkout debian
781
    $ dpkg-buildpackage -b -uc -us
782
    # dpkg -i ../vncauthproxy_1.0-1_all.deb
783

    
784
.. warning::
785
    **Failure to build the package on the Mac.**
786

    
787
    ``libevent``, a requirement for gevent which in turn is a requirement for
788
    vncauthproxy is not included in `MacOSX` by default and installing it with
789
    MacPorts does not lead to a version that can be found by the gevent
790
    build process. A quick workaround is to execute the following commands::
791

    
792
        $ cd $SYNNEFO
793
        $ sudo pip install -e git+https://code.grnet.gr/git/vncauthproxy@5a196d8481e171a#egg=vncauthproxy
794
        <the above fails>
795
        $ cd build/gevent
796
        $ sudo python setup.py -I/opt/local/include -L/opt/local/lib build
797
        $ cd $SYNNEFO
798
        $ sudo pip install -e git+https://code.grnet.gr/git/vncauthproxy@5a196d8481e171a#egg=vncauthproxy
799

    
800
.. todo:: Mention vncauthproxy bug, snf-vncauthproxy, inability to install using pip
801
.. todo:: kpap: fix installation commands
802

    
803
.. _cyclades-install-nfdhcpd:
804

    
805
NFDHCPD
806
~~~~~~~
807

    
808
Setup Synnefo-specific networking on the Ganeti backend.
809
This part is deployment-specific and must be customized based on the
810
specific needs of the system administrators.
811

    
812
A reference installation will use a Synnefo-specific KVM ifup script,
813
NFDHCPD and pre-provisioned Linux bridges to support public and private
814
network functionality. For this:
815

    
816
Grab NFDHCPD from its own repository (https://code.grnet.gr/git/nfdhcpd),
817
install it, modify ``/etc/nfdhcpd/nfdhcpd.conf`` to reflect your network
818
configuration.
819

    
820
Install a custom KVM ifup script for use by Ganeti, as
821
``/etc/ganeti/kvm-vif-bridge``, on GANETI-NODEs. A sample implementation is
822
provided under ``/contrib/ganeti-hooks``. Set ``NFDHCPD_STATE_DIR`` to point
823
to NFDHCPD's state directory, usually ``/var/lib/nfdhcpd``.
824

    
825
.. todo:: soc: document NFDHCPD installation, settle on KVM ifup script
826

    
827
.. _cyclades-install-snfimage:
828

    
829
snf-image
830
~~~~~~~~~
831

    
832
Install the :ref:`snf-image <snf-image>` Ganeti OS provider for image
833
deployment.
834

    
835
For :ref:`cyclades <cyclades>` to be able to launch VMs from specified
836
Images, you need the snf-image OS Provider installed on *all* Ganeti nodes.
837

    
838
Please see `https://code.grnet.gr/projects/snf-image/wiki`_
839
for installation instructions and documentation on the design
840
and implementation of snf-image.
841

    
842
Please see `https://code.grnet.gr/projects/snf-image/files`
843
for the latest packages.
844

    
845
Images should be stored in ``extdump``, or ``diskdump`` format in a directory
846
of your choice, configurable as ``IMAGE_DIR`` in
847
:file:`/etc/default/snf-image`.
848

    
849
synnefo components
850
------------------
851

    
852
You need to install the appropriate synnefo software components on each node,
853
depending on its type, see :ref:`Architecture <cyclades-architecture>`.
854

    
855
Most synnefo components have dependencies on additional Python packages.
856
The dependencies are described inside each package, and are setup
857
automatically when installing using :command:`pip`, or when installing
858
using your system's package manager.
859

    
860
Please see the page of each synnefo software component for specific
861
installation instructions, where applicable.
862

    
863
Install the following synnefo components:
864

    
865
Nodes of type :ref:`APISERVER <APISERVER_NODE>`
866
    Components
867
    :ref:`snf-common <snf-common>`,
868
    :ref:`snf-webproject <snf-webproject>`,
869
    :ref:`snf-cyclades-app <snf-cyclades-app>`
870
Nodes of type :ref:`GANETI-MASTER <GANETI_MASTER>` and :ref:`GANETI-NODE <GANETI_NODE>`
871
    Components
872
    :ref:`snf-common <snf-common>`,
873
    :ref:`snf-cyclades-gtools <snf-cyclades-gtools>`
874
Nodes of type :ref:`LOGIC <LOGIC_NODE>`
875
    Components
876
    :ref:`snf-common <snf-common>`,
877
    :ref:`snf-webproject <snf-webproject>`,
878
    :ref:`snf-cyclades-app <snf-cyclades-app>`.
879

    
880

    
881
Configuration of Cyclades (and Plankton)
882
========================================
883

    
884
This section targets the configuration of the prerequisites for cyclades,
885
and the configuration of the associated synnefo software components.
886

    
887
synnefo components
888
------------------
889

    
890
cyclades uses :ref:`snf-common <snf-common>` for settings.
891
Please refer to the configuration sections of
892
:ref:`snf-webproject <snf-webproject>`,
893
:ref:`snf-cyclades-app <snf-cyclades-app>`,
894
:ref:`snf-cyclades-gtools <snf-cyclades-gtools>` for more
895
information on their configuration.
896

    
897
Ganeti
898
~~~~~~
899

    
900
Set ``GANETI_NODES``, ``GANETI_MASTER_IP``, ``GANETI_CLUSTER_INFO`` based on
901
your :ref:`Ganeti installation <cyclades-install-ganeti>` and change the
902
`BACKEND_PREFIX_ID`` setting, using an custom ``PREFIX_ID``.
903

    
904
Database
905
~~~~~~~~
906

    
907
Once all components are installed and configured,
908
initialize the Django DB:
909

    
910
.. code-block:: console
911

    
912
   $ snf-manage syncdb
913
   $ snf-manage migrate
914

    
915
and load fixtures ``{users, flavors, images}``,
916
which make the API usable by end users by defining a sample set of users,
917
hardware configurations (flavors) and OS images:
918

    
919
.. code-block:: console
920

    
921
   $ snf-manage loaddata /path/to/users.json
922
   $ snf-manage loaddata flavors
923
   $ snf-manage loaddata images
924

    
925
.. warning::
926
    Be sure to load a custom users.json and select a unique token
927
    for each of the initial and any other users defined in this file.
928
    **DO NOT LEAVE THE SAMPLE AUTHENTICATION TOKENS** enabled in deployed
929
    configurations.
930

    
931
sample users.json file:
932

    
933
.. literalinclude:: ../../synnefo/db/fixtures/users.json
934

    
935
`download <../_static/users.json>`_
936

    
937
RabbitMQ
938
~~~~~~~~
939

    
940
Change ``RABBIT_*`` settings to match your :ref:`RabbitMQ setup
941
<cyclades-install-rabbitmq>`.
942

    
943
.. include:: ../../Changelog
944

    
945

    
946
Testing of Cyclades (and Plankton)
947
==================================
948

    
949

    
950
General Testing
951
===============
952

    
953

    
954
Notes
955
=====