Statistics
| Branch: | Tag: | Revision:

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

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
 * Object 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 Object 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
You also need a shared directory visible by both nodes. Pithos+ will save all
56
data inside this directory. By 'all data', we mean files, images, and pithos
57
specific mapping data. If you plan to upload more than one basic image, this
58
directory should have at least 50GB of free space. During this guide, we will
59
assume that node1 acts as an NFS server and serves the directory ``/srv/pithos``
60
to node2. Node2 has this directory mounted under ``/srv/pithos``, too.
61

    
62
Before starting the synnefo installation, you will need basic third party
63
software to be installed and configured on the physical nodes. We will describe
64
each node's general prerequisites separately. Any additional configuration,
65
specific to a synnefo service for each node, will be described at the service's
66
section.
67

    
68
Node1
69
-----
70

    
71
General Synnefo dependencies
72
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73

    
74
 * apache (http server)
75
 * gunicorn (WSGI http server)
76
 * postgresql (database)
77
 * rabbitmq (message queue)
78

    
79
You can install the above by running:
80

    
81
.. code-block:: console
82

    
83
   # apt-get install apache2 gunicorn postgresql
84

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

    
88
.. code-block:: console
89

    
90
   # apt-get install python-psycopg2
91

    
92
Database setup
93
~~~~~~~~~~~~~~
94

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

    
99
.. code-block:: console
100

    
101
   root@node1:~ # su - postgres
102
   postgres@node1:~ $ psql
103
   postgres=# CREATE DATABASE snf_apps WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE=template0;
104
   postgres=# CREATE USER synnefo WITH PASSWORD 'example_passw0rd';
105
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_apps TO synnefo;
106

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

    
112
.. code-block:: console
113

    
114
   postgres=# CREATE DATABASE snf_pithos WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C'
115
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_pithos TO synnefo;
116

    
117
Configure the database to listen to all network interfaces. You can do this by
118
editting the file ``/etc/postgresql/8.4/main/postgresql.conf`` and change
119
``listen_addresses`` to ``'*'`` :
120

    
121
.. code-block:: console
122

    
123
   listen_addresses = '*'
124

    
125
Furthermore, edit ``/etc/postgresql/8.4/main/pg_hba.conf`` to allow node1 and
126
node2 to connect to the database. Add the following lines under ``#IPv4 local
127
connections:`` :
128

    
129
.. code-block:: console
130

    
131
   host		all	all	4.3.2.1/32	md5
132
   host		all	all	4.3.2.2/32	md5
133

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

    
137
.. code-block:: console
138

    
139
   # /etc/init.d/postgresql restart
140

    
141
Gunicorn setup
142
~~~~~~~~~~~~~~
143

    
144
Create the file ``synnefo`` under ``/etc/gunicorn.d/`` containing the following:
145

    
146
.. code-block:: console
147

    
148
   CONFIG = {
149
    'mode': 'django',
150
    'environment': {
151
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
152
    },
153
    'working_dir': '/etc/synnefo',
154
    'user': 'www-data',
155
    'group': 'www-data',
156
    'args': (
157
      '--bind=127.0.0.1:8080',
158
      '--workers=4',
159
      '--log-level=debug',
160
    ),
161
   }
162

    
163
.. warning:: Do NOT start the server yet, because it won't find the
164
``synnefo.settings`` module. We will start the server after successful
165
installation of astakos. If the server is running:
166

    
167
.. code-block:: console
168

    
169
   # /etc/init.d/gunicorn stop
170

    
171
Apache2 setup
172
~~~~~~~~~~~~~
173

    
174
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
175
the following:
176

    
177
.. code-block:: console
178

    
179
   <VirtualHost *:80>
180
     ServerName node1.example.com
181

    
182
     RewriteEngine On
183
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
184
   </VirtualHost>
185

    
186
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
187
containing the following:
188

    
189
.. code-block:: console
190

    
191
   <IfModule mod_ssl.c>
192
   <VirtualHost _default_:443>
193
     ServerName node1.example.com
194

    
195
     Alias /static "/usr/share/synnefo/static"
196

    
197
   #  SetEnv no-gzip
198
   #  SetEnv dont-vary
199

    
200
     AllowEncodedSlashes On
201

    
202
     RequestHeader set X-Forwarded-Protocol "https"
203

    
204
     <Proxy * >
205
       Order allow,deny
206
       Allow from all
207
     </Proxy>
208

    
209
     SetEnv                proxy-sendchunked
210
     SSLProxyEngine        off
211
     ProxyErrorOverride    off
212

    
213
     ProxyPass        /static !
214
     ProxyPass        / http://localhost:8080/ retry=0
215
     ProxyPassReverse / http://localhost:8080/
216

    
217
     RewriteEngine On
218
     RewriteRule ^/login(.*) /im/login/redirect$1 [PT,NE]
219

    
220
     SSLEngine on
221
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
222
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
223
   </VirtualHost>
224
   </IfModule>
225

    
226
Now enable sites and modules by running:
227

    
228
.. code-block:: console
229

    
230
   # a2enmod ssl
231
   # a2enmod rewrite
232
   # a2dissite default
233
   # a2ensite synnefo
234
   # a2ensite synnefo-ssl
235
   # a2enmod headers
236
   # a2enmod proxy_http
237

    
238
.. warning:: Do NOT start/restart the server yet. If the server is running:
239

    
240
.. code-block:: console
241

    
242
   # /etc/init.d/apache2 stop
243

    
244
Pithos+ data directory setup
245
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246

    
247
As mentioned in the General Prerequisites section, there is a directory called
248
``/srv/pithos`` visible by both nodes. We create and setup the ``data``
249
directory inside it:
250

    
251
.. code-block:: console
252

    
253
   # cd /srv/pithos
254
   # mkdir data
255
   # chown www-data:www-data data
256
   # chmod g+ws data
257

    
258
You are now ready with all general prerequisites concerning node1. Let's go to
259
node2.
260

    
261
Node2
262
-----
263

    
264
General Synnefo dependencies
265
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266

    
267
 * apache (http server)
268
 * gunicorn (WSGI http server)
269
 * postgresql (database)
270
 * rabbitmq (message queue)
271

    
272
You can install the above by running:
273

    
274
.. code-block:: console
275

    
276
   # apt-get install apache2 gunicorn postgresql
277

    
278
Make sure you have installed the same package versions as in node1. Node2 will
279
connect to the databases on node1, so you will also need the python-psycopg2
280
package:
281

    
282
.. code-block:: console
283

    
284
   # apt-get install python-psycopg2
285

    
286
Database setup
287
~~~~~~~~~~~~~~
288

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

    
295
Gunicorn setup
296
~~~~~~~~~~~~~~
297

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

    
301
.. code-block:: console
302

    
303
   CONFIG = {
304
    'mode': 'django',
305
    'environment': {
306
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
307
    },
308
    'working_dir': '/etc/synnefo',
309
    'user': 'www-data',
310
    'group': 'www-data',
311
    'args': (
312
      '--bind=127.0.0.1:8080',
313
      '--workers=4',
314
      '--log-level=debug',
315
    ),
316
   }
317

    
318
.. warning:: Do NOT start the server yet, because it won't find the
319
``synnefo.settings`` module. We will start the server after successful
320
installation of astakos. If the server is running:
321

    
322
.. code-block:: console
323

    
324
   # /etc/init.d/gunicorn stop
325

    
326
Apache2 setup
327
~~~~~~~~~~~~~
328

    
329
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
330
the following:
331

    
332
.. code-block:: console
333

    
334
   <VirtualHost *:80>
335
     ServerName node2.example.com
336

    
337
     RewriteEngine On
338
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
339
   </VirtualHost>
340

    
341
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
342
containing the following:
343

    
344
.. code-block:: console
345

    
346
   <IfModule mod_ssl.c>
347
   <VirtualHost _default_:443>
348
     ServerName node2.example.com
349

    
350
     Alias /static "/usr/share/synnefo/static"
351

    
352
     SetEnv no-gzip
353
     SetEnv dont-vary
354
     AllowEncodedSlashes On
355

    
356
     RequestHeader set X-Forwarded-Protocol "https"
357

    
358
     <Proxy * >
359
       Order allow,deny
360
       Allow from all
361
     </Proxy>
362

    
363
     SetEnv                proxy-sendchunked
364
     SSLProxyEngine        off
365
     ProxyErrorOverride    off
366

    
367
     ProxyPass        /static !
368
     ProxyPass        / http://localhost:8080/ retry=0
369
     ProxyPassReverse / http://localhost:8080/
370

    
371
     SSLEngine on
372
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
373
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
374
   </VirtualHost>
375
   </IfModule>
376

    
377
As in node1, enable sites and modules by running:
378

    
379
.. code-block:: console
380

    
381
   # a2enmod ssl
382
   # a2enmod rewrite
383
   # a2dissite default
384
   # a2ensite synnefo
385
   # a2ensite synnefo-ssl
386
   # a2enmod headers
387
   # a2enmod proxy_http
388

    
389
.. warning:: Do NOT start/restart the server yet. If the server is running:
390

    
391
.. code-block:: console
392

    
393
   # /etc/init.d/apache2 stop
394

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

    
399

    
400
Installation of Astakos on node1
401
================================
402

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

    
407
.. code-block:: console
408

    
409
   # apt-get install snf-astakos-app
410

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

    
417
.. code-block:: console
418

    
419
   # apt-get install snf-webproject
420

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

    
426

    
427
Configuration of Astakos
428
========================
429

    
430
Conf Files
431
----------
432

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

    
440
After getting familiar with synnefo, you will be able to customize the software
441
as you wish and fits your needs. Many options are available, to empower the
442
administrator with extensively customizable setups.
443

    
444
For the snf-webproject component (installed as an astakos dependency), we
445
need the following:
446

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

    
450
.. code-block:: console
451

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

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

    
473
.. code-block:: console
474

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

    
477
For astakos specific configuration, edit the following options in
478
``/etc/synnefo/20-snf-astakos-setting.conf`` :
479

    
480
.. code-block:: console
481

    
482
   ASTAKOS_IM_MODULES = ['local']
483

    
484
   ASTAKOS_COOKIE_DOMAIN = '.example.com'
485

    
486
   ASTAKOS_BASEURL = 'https://node1.example.com'
487

    
488
   ASTAKOS_SITENAME = '~okeanos demo example'
489

    
490
   ASTAKOS_CLOUD_SERVICES = (
491
           { 'url':'https://node1.example.com/im/', 'name':'~okeanos home', 'id':'cloud', 'icon':'home-icon.png' },
492
           { 'url':'https://node1.example.com/ui/', 'name':'cyclades', 'id':'cyclades' },
493
           { 'url':'https://node2.example.com/ui/', 'name':'pithos+', 'id':'pithos' })
494

    
495
   ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
496
   ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
497

    
498
   ASTAKOS_RECAPTCHA_USE_SSL = True
499

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

    
509
For the ``ASTAKOS_RECAPTCHA_PUBLIC_KEY`` and ``ASTAKOS_RECAPTCHA_PRIVATE_KEY``
510
go to https://www.google.com/recaptcha/admin/create and create your own pair.
511

    
512
Servers Initialization
513
----------------------
514

    
515
After configuration is done, we initialize the servers on node1:
516

    
517
.. code-block:: console
518

    
519
   root@node1:~ # /etc/init.d/gunicorn restart
520
   root@node1:~ # /etc/init.d/apache2 restart
521

    
522
Database Initialization
523
-----------------------
524

    
525
Then, we initialize the database by running:
526

    
527
.. code-block:: console
528

    
529
   # snf-manage syncdb
530

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

    
535
.. code-block:: console
536

    
537
   # snf-manage migrate im
538

    
539
You have now finished the Astakos setup. Let's test it now.
540

    
541

    
542
Testing of Astakos
543
==================
544

    
545
Open your favorite browser and go to:
546

    
547
``http://node1.example.com/im``
548

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

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

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

    
559
.. code-block:: console
560

    
561
   root@node1:~ # snf-manage listusers
562

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

    
567
.. code-block:: console
568

    
569
   root@node1:~ # snf-manage modifyuser --set-active 1
570

    
571
This modifies the active value to ``1``, and actually activates the user.
572
When running in production, the activation is done automatically with different
573
types of moderation, that Astakos supports. You can see the moderation methods
574
(by invitation, whitelists, matching regexp, etc.) at the Astakos specific
575
documentation. In production, you can also manually activate a user, by sending
576
him/her an activation email. See how to do this at the :ref:`User
577
activation <user_activation>` section.
578

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

    
584
Let's continue to install Pithos+ now.
585

    
586

    
587
Installation of Pithos+ on node2
588
================================
589

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

    
594
.. code-block:: console
595

    
596
   # apt-get install snf-pithos-app
597

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

    
603
.. code-block:: console
604

    
605
   # apt-get install snf-pithos-webclient
606

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

    
611
Configuration of Pithos+
612
========================
613

    
614
Conf Files
615
----------
616

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

    
623
Edit ``/etc/synnefo/20-snf-pithos-app-settings.conf``. There you need to set
624
only the two options:
625

    
626
.. code-block:: console
627

    
628
   PITHOS_BACKEND_DB_CONNECTION = 'postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos'
629

    
630
   PITHOS_BACKEND_BLOCK_PATH = '/srv/pithos/data'
631

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

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

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

    
645
.. code-block:: console
646

    
647
   PITHOS_UI_LOGIN_URL = "https://node1.example.com/im/login?next="
648
   PITHOS_UI_FEEDBACK_URL = "https://node1.example.com/im/feedback"
649

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

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

    
658
.. code-block:: console
659

    
660
   CLOUDBAR_LOCATION = 'https://node1.example.com/static/im/cloudbar/'
661
   CLOUDBAR_ACTIVE_SERVICE = 'pithos'
662
   CLOUDBAR_SERVICES_URL = 'https://node1.example.com/im/get_services'
663
   CLOUDBAR_MENU_URL = 'https://node1.example.com/im/get_menu'
664

    
665
The ``CLOUDBAR_LOCATION`` tells the client where to find the astakos common
666
cloudbar.
667

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

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

    
681
Servers Initialization
682
----------------------
683

    
684
After configuration is done, we initialize the servers on node2:
685

    
686
.. code-block:: console
687

    
688
   root@node2:~ # /etc/init.d/gunicorn restart
689
   root@node2:~ # /etc/init.d/apache2 restart
690

    
691
You have now finished the Pithos+ setup. Let's test it now.
692

    
693

    
694
Testing of Pithos+
695
==================
696

    
697

    
698
Installation of Cyclades (and Plankton) on node1
699
================================================
700

    
701
Installation of cyclades is a two step process:
702

    
703
1. install the external services (prerequisites) on which cyclades depends
704
2. install the synnefo software components associated with cyclades
705

    
706
Prerequisites
707
-------------
708
.. _cyclades-install-ganeti:
709

    
710
Ganeti installation
711
~~~~~~~~~~~~~~~~~~~
712

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

    
719
.. _cyclades-install-db:
720

    
721
Database
722
~~~~~~~~
723

    
724
Database installation is done as part of the
725
:ref:`snf-webproject <snf-webproject>` component.
726

    
727
.. _cyclades-install-rabbitmq:
728

    
729
RabbitMQ
730
~~~~~~~~
731

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

    
736
    http://www.rabbitmq.com/pacemaker.html
737

    
738
After installation, create a user and set its permissions:
739

    
740
.. code-block:: console
741

    
742
    $ rabbitmqctl add_user <username> <password>
743
    $ rabbitmqctl set_permissions -p / <username>  "^.*" ".*" ".*"
744

    
745
The values set for the user and password must be mirrored in the
746
``RABBIT_*`` variables in your settings, as managed by
747
:ref:`snf-common <snf-common>`.
748

    
749
.. todo:: Document an active-active configuration based on the latest version
750
   of RabbitMQ.
751

    
752
.. _cyclades-install-vncauthproxy:
753

    
754
vncauthproxy
755
~~~~~~~~~~~~
756

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

    
760
.. note:: The Debian package for vncauthproxy undertakes all configuration
761
   automatically.
762

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

    
766
.. code-block:: console
767

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

    
770
Create ``/var/log/vncauthproxy`` and set its permissions appropriately.
771

    
772
Alternatively, build and install Debian packages.
773

    
774
.. code-block:: console
775

    
776
    $ git checkout debian
777
    $ dpkg-buildpackage -b -uc -us
778
    # dpkg -i ../vncauthproxy_1.0-1_all.deb
779

    
780
.. warning::
781
    **Failure to build the package on the Mac.**
782

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

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

    
796
.. todo:: Mention vncauthproxy bug, snf-vncauthproxy, inability to install using pip
797
.. todo:: kpap: fix installation commands
798

    
799
.. _cyclades-install-nfdhcpd:
800

    
801
NFDHCPD
802
~~~~~~~
803

    
804
Setup Synnefo-specific networking on the Ganeti backend.
805
This part is deployment-specific and must be customized based on the
806
specific needs of the system administrators.
807

    
808
A reference installation will use a Synnefo-specific KVM ifup script,
809
NFDHCPD and pre-provisioned Linux bridges to support public and private
810
network functionality. For this:
811

    
812
Grab NFDHCPD from its own repository (https://code.grnet.gr/git/nfdhcpd),
813
install it, modify ``/etc/nfdhcpd/nfdhcpd.conf`` to reflect your network
814
configuration.
815

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

    
821
.. todo:: soc: document NFDHCPD installation, settle on KVM ifup script
822

    
823
.. _cyclades-install-snfimage:
824

    
825
snf-image
826
~~~~~~~~~
827

    
828
Install the :ref:`snf-image <snf-image>` Ganeti OS provider for image
829
deployment.
830

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

    
834
Please see `https://code.grnet.gr/projects/snf-image/wiki`_
835
for installation instructions and documentation on the design
836
and implementation of snf-image.
837

    
838
Please see `https://code.grnet.gr/projects/snf-image/files`
839
for the latest packages.
840

    
841
Images should be stored in ``extdump``, or ``diskdump`` format in a directory
842
of your choice, configurable as ``IMAGE_DIR`` in
843
:file:`/etc/default/snf-image`.
844

    
845
synnefo components
846
------------------
847

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

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

    
856
Please see the page of each synnefo software component for specific
857
installation instructions, where applicable.
858

    
859
Install the following synnefo components:
860

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

    
876

    
877
Configuration of Cyclades (and Plankton)
878
========================================
879

    
880
This section targets the configuration of the prerequisites for cyclades,
881
and the configuration of the associated synnefo software components.
882

    
883
synnefo components
884
------------------
885

    
886
cyclades uses :ref:`snf-common <snf-common>` for settings.
887
Please refer to the configuration sections of
888
:ref:`snf-webproject <snf-webproject>`,
889
:ref:`snf-cyclades-app <snf-cyclades-app>`,
890
:ref:`snf-cyclades-gtools <snf-cyclades-gtools>` for more
891
information on their configuration.
892

    
893
Ganeti
894
~~~~~~
895

    
896
Set ``GANETI_NODES``, ``GANETI_MASTER_IP``, ``GANETI_CLUSTER_INFO`` based on
897
your :ref:`Ganeti installation <cyclades-install-ganeti>` and change the
898
`BACKEND_PREFIX_ID`` setting, using an custom ``PREFIX_ID``.
899

    
900
Database
901
~~~~~~~~
902

    
903
Once all components are installed and configured,
904
initialize the Django DB:
905

    
906
.. code-block:: console
907

    
908
   $ snf-manage syncdb
909
   $ snf-manage migrate
910

    
911
and load fixtures ``{users, flavors, images}``,
912
which make the API usable by end users by defining a sample set of users,
913
hardware configurations (flavors) and OS images:
914

    
915
.. code-block:: console
916

    
917
   $ snf-manage loaddata /path/to/users.json
918
   $ snf-manage loaddata flavors
919
   $ snf-manage loaddata images
920

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

    
927
sample users.json file:
928

    
929
.. literalinclude:: ../../synnefo/db/fixtures/users.json
930

    
931
`download <../_static/users.json>`_
932

    
933
RabbitMQ
934
~~~~~~~~
935

    
936
Change ``RABBIT_*`` settings to match your :ref:`RabbitMQ setup
937
<cyclades-install-rabbitmq>`.
938

    
939
.. include:: ../../Changelog
940

    
941

    
942
Testing of Cyclades (and Plankton)
943
==================================
944

    
945

    
946
General Testing
947
===============
948

    
949

    
950
Notes
951
=====