Statistics
| Branch: | Tag: | Revision:

root / docs / quick-install-admin-guide.rst @ 980190ae

History | View | Annotate | Download (71.2 kB)

1 bdb83fd6 cven
.. _quick-install-admin-guide:
2 bdb83fd6 cven
3 bdb83fd6 cven
Administrator's Quick Installation Guide
4 a96ec00f Constantinos Venetsanopoulos
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 a96ec00f Constantinos Venetsanopoulos
6 a96ec00f Constantinos Venetsanopoulos
This is the Administrator's quick installation guide.
7 a96ec00f Constantinos Venetsanopoulos
8 a96ec00f Constantinos Venetsanopoulos
It describes how to install the whole synnefo stack on two (2) physical nodes,
9 a96ec00f Constantinos Venetsanopoulos
with minimum configuration. It installs synnefo from Debian packages, and
10 a96ec00f Constantinos Venetsanopoulos
assumes the nodes run Debian Squeeze. After successful installation, you will
11 a96ec00f Constantinos Venetsanopoulos
have the following services running:
12 a96ec00f Constantinos Venetsanopoulos
13 a96ec00f Constantinos Venetsanopoulos
 * Identity Management (Astakos)
14 dad708b4 Antony Chazapis
 * Object Storage Service (Pithos+)
15 a96ec00f Constantinos Venetsanopoulos
 * Compute Service (Cyclades)
16 a96ec00f Constantinos Venetsanopoulos
 * Image Registry Service (Plankton)
17 a96ec00f Constantinos Venetsanopoulos
18 a96ec00f Constantinos Venetsanopoulos
and a single unified Web UI to manage them all.
19 a96ec00f Constantinos Venetsanopoulos
20 a96ec00f Constantinos Venetsanopoulos
The Volume Storage Service (Archipelago) and the Billing Service (Aquarium) are
21 a96ec00f Constantinos Venetsanopoulos
not released yet.
22 a96ec00f Constantinos Venetsanopoulos
23 dad708b4 Antony Chazapis
If you just want to install the Object Storage Service (Pithos+), follow the guide
24 a96ec00f Constantinos Venetsanopoulos
and just stop after the "Testing of Pithos+" section.
25 a96ec00f Constantinos Venetsanopoulos
26 a96ec00f Constantinos Venetsanopoulos
27 a96ec00f Constantinos Venetsanopoulos
Installation of Synnefo / Introduction
28 a96ec00f Constantinos Venetsanopoulos
======================================
29 a96ec00f Constantinos Venetsanopoulos
30 a96ec00f Constantinos Venetsanopoulos
We will install the services with the above list's order. Cyclades and Plankton
31 a96ec00f Constantinos Venetsanopoulos
will be installed in a single step (at the end), because at the moment they are
32 a96ec00f Constantinos Venetsanopoulos
contained in the same software component. Furthermore, we will install all
33 a96ec00f Constantinos Venetsanopoulos
services in the first physical node, except Pithos+ which will be installed in
34 a96ec00f Constantinos Venetsanopoulos
the second, due to a conflict between the snf-pithos-app and snf-cyclades-app
35 a96ec00f Constantinos Venetsanopoulos
component (scheduled to be fixed in the next version).
36 a96ec00f Constantinos Venetsanopoulos
37 a96ec00f Constantinos Venetsanopoulos
For the rest of the documentation we will refer to the first physical node as
38 a96ec00f Constantinos Venetsanopoulos
"node1" and the second as "node2". We will also assume that their domain names
39 a96ec00f Constantinos Venetsanopoulos
are "node1.example.com" and "node2.example.com" and their IPs are "4.3.2.1" and
40 a96ec00f Constantinos Venetsanopoulos
"4.3.2.2" respectively.
41 a96ec00f Constantinos Venetsanopoulos
42 04308336 Ilias Tsitsimpis
.. note:: It is import that the two machines are under the same domain name.
43 04308336 Ilias Tsitsimpis
    If they are not, you can do this by editting the file ``/etc/hosts``
44 04308336 Ilias Tsitsimpis
    on both machines, and add the following lines:
45 04308336 Ilias Tsitsimpis
46 04308336 Ilias Tsitsimpis
    .. code-block:: console
47 04308336 Ilias Tsitsimpis
48 04308336 Ilias Tsitsimpis
        4.3.2.1     node1.example.com
49 04308336 Ilias Tsitsimpis
        4.3.2.2     node2.example.com
50 04308336 Ilias Tsitsimpis
51 a96ec00f Constantinos Venetsanopoulos
52 a96ec00f Constantinos Venetsanopoulos
General Prerequisites
53 a96ec00f Constantinos Venetsanopoulos
=====================
54 a96ec00f Constantinos Venetsanopoulos
55 a96ec00f Constantinos Venetsanopoulos
These are the general synnefo prerequisites, that you need on node1 and node2
56 a96ec00f Constantinos Venetsanopoulos
and are related to all the services (Astakos, Pithos+, Cyclades, Plankton).
57 a96ec00f Constantinos Venetsanopoulos
58 a96ec00f Constantinos Venetsanopoulos
To be able to download all synnefo components you need to add the following
59 a96ec00f Constantinos Venetsanopoulos
lines in your ``/etc/apt/sources.list`` file:
60 a96ec00f Constantinos Venetsanopoulos
61 d109485a Constantinos Venetsanopoulos
| ``deb http://apt.dev.grnet.gr squeeze main``
62 d109485a Constantinos Venetsanopoulos
| ``deb-src http://apt.dev.grnet.gr squeeze main``
63 37e1b6cd Dimitris Aragiorgis
| ``deb http://apt.dev.grnet.gr squeeze-backports main``
64 a96ec00f Constantinos Venetsanopoulos
65 ec9862dd Stratos Psomadakis
and import the repo's GPG key:
66 ec9862dd Stratos Psomadakis
67 ec9862dd Stratos Psomadakis
| ``curl https://dev.grnet.gr/files/apt-grnetdev.pub | apt-key add -``
68 ec9862dd Stratos Psomadakis
69 169f7d38 Vangelis Koukis
Also add the following line to enable the ``squeeze-backports`` repository,
70 169f7d38 Vangelis Koukis
which may provide more recent versions of certain packages. The repository
71 169f7d38 Vangelis Koukis
is deactivated by default and must be specified expicitly in ``apt-get``
72 169f7d38 Vangelis Koukis
operations:
73 169f7d38 Vangelis Koukis
74 169f7d38 Vangelis Koukis
| ``deb http://backports.debian.org/debian-backports squeeze-backports main``
75 169f7d38 Vangelis Koukis
76 a96ec00f Constantinos Venetsanopoulos
You also need a shared directory visible by both nodes. Pithos+ will save all
77 a96ec00f Constantinos Venetsanopoulos
data inside this directory. By 'all data', we mean files, images, and pithos
78 a96ec00f Constantinos Venetsanopoulos
specific mapping data. If you plan to upload more than one basic image, this
79 a96ec00f Constantinos Venetsanopoulos
directory should have at least 50GB of free space. During this guide, we will
80 a96ec00f Constantinos Venetsanopoulos
assume that node1 acts as an NFS server and serves the directory ``/srv/pithos``
81 ba173277 Ilias Tsitsimpis
to node2 (be sure to set no_root_squash flag). Node2 has this directory
82 ba173277 Ilias Tsitsimpis
mounted under ``/srv/pithos``, too.
83 a96ec00f Constantinos Venetsanopoulos
84 a96ec00f Constantinos Venetsanopoulos
Before starting the synnefo installation, you will need basic third party
85 a96ec00f Constantinos Venetsanopoulos
software to be installed and configured on the physical nodes. We will describe
86 a96ec00f Constantinos Venetsanopoulos
each node's general prerequisites separately. Any additional configuration,
87 a96ec00f Constantinos Venetsanopoulos
specific to a synnefo service for each node, will be described at the service's
88 a96ec00f Constantinos Venetsanopoulos
section.
89 a96ec00f Constantinos Venetsanopoulos
90 7df5a742 Christos Stavrakakis
Finally, it is required for Cyclades and Ganeti nodes to have synchronized
91 7df5a742 Christos Stavrakakis
system clocks (e.g. by running ntpd).
92 7df5a742 Christos Stavrakakis
93 a96ec00f Constantinos Venetsanopoulos
Node1
94 a96ec00f Constantinos Venetsanopoulos
-----
95 a96ec00f Constantinos Venetsanopoulos
96 a96ec00f Constantinos Venetsanopoulos
General Synnefo dependencies
97 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 a96ec00f Constantinos Venetsanopoulos
99 a96ec00f Constantinos Venetsanopoulos
 * apache (http server)
100 a96ec00f Constantinos Venetsanopoulos
 * gunicorn (WSGI http server)
101 a96ec00f Constantinos Venetsanopoulos
 * postgresql (database)
102 a96ec00f Constantinos Venetsanopoulos
 * rabbitmq (message queue)
103 7df5a742 Christos Stavrakakis
 * ntp (NTP daemon)
104 576e059b Constantinos Venetsanopoulos
 * gevent
105 a96ec00f Constantinos Venetsanopoulos
106 7df5a742 Christos Stavrakakis
You can install apache2, progresql and ntp by running:
107 a96ec00f Constantinos Venetsanopoulos
108 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
109 a96ec00f Constantinos Venetsanopoulos
110 7df5a742 Christos Stavrakakis
   # apt-get install apache2 postgresql ntp
111 a96ec00f Constantinos Venetsanopoulos
112 73ff1d54 Constantinos Venetsanopoulos
Make sure to install gunicorn >= v0.12.2. You can do this by installing from
113 73ff1d54 Constantinos Venetsanopoulos
the official debian backports:
114 73ff1d54 Constantinos Venetsanopoulos
115 73ff1d54 Constantinos Venetsanopoulos
.. code-block:: console
116 73ff1d54 Constantinos Venetsanopoulos
117 73ff1d54 Constantinos Venetsanopoulos
   # apt-get -t squeeze-backports install gunicorn
118 73ff1d54 Constantinos Venetsanopoulos
119 576e059b Constantinos Venetsanopoulos
Also, make sure to install gevent >= 0.13.6. Again from the debian backports:
120 576e059b Constantinos Venetsanopoulos
121 576e059b Constantinos Venetsanopoulos
.. code-block:: console
122 576e059b Constantinos Venetsanopoulos
123 576e059b Constantinos Venetsanopoulos
   # apt-get -t squeeze-backports install python-gevent
124 576e059b Constantinos Venetsanopoulos
125 73ff1d54 Constantinos Venetsanopoulos
On node1, we will create our databases, so you will also need the
126 73ff1d54 Constantinos Venetsanopoulos
python-psycopg2 package:
127 a96ec00f Constantinos Venetsanopoulos
128 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
129 a96ec00f Constantinos Venetsanopoulos
130 a96ec00f Constantinos Venetsanopoulos
   # apt-get install python-psycopg2
131 a96ec00f Constantinos Venetsanopoulos
132 29291ebc Christos Stavrakakis
To install RabbitMQ>=2.8.4, use the RabbitMQ APT repository by adding the
133 29291ebc Christos Stavrakakis
following line to ``/etc/apt/sources.list``:
134 29291ebc Christos Stavrakakis
135 29291ebc Christos Stavrakakis
.. code-block:: console
136 29291ebc Christos Stavrakakis
137 29291ebc Christos Stavrakakis
  deb http://www.rabbitmq.com/debian testing main
138 29291ebc Christos Stavrakakis
139 29291ebc Christos Stavrakakis
Add RabbitMQ public key, to trusted key list:
140 29291ebc Christos Stavrakakis
141 29291ebc Christos Stavrakakis
.. code-block:: console
142 29291ebc Christos Stavrakakis
143 29291ebc Christos Stavrakakis
  # wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
144 29291ebc Christos Stavrakakis
  # apt-key add rabbitmq-signing-key-public.asc
145 29291ebc Christos Stavrakakis
146 29291ebc Christos Stavrakakis
Finally, to install the package run:
147 29291ebc Christos Stavrakakis
148 29291ebc Christos Stavrakakis
.. code-block:: console
149 29291ebc Christos Stavrakakis
150 29291ebc Christos Stavrakakis
  # apt-get update
151 29291ebc Christos Stavrakakis
  # apt-get install rabbitmq-server
152 29291ebc Christos Stavrakakis
153 a96ec00f Constantinos Venetsanopoulos
Database setup
154 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~
155 a96ec00f Constantinos Venetsanopoulos
156 a96ec00f Constantinos Venetsanopoulos
On node1, we create a database called ``snf_apps``, that will host all django
157 a96ec00f Constantinos Venetsanopoulos
apps related tables. We also create the user ``synnefo`` and grant him all
158 a96ec00f Constantinos Venetsanopoulos
privileges on the database. We do this by running:
159 a96ec00f Constantinos Venetsanopoulos
160 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
161 a96ec00f Constantinos Venetsanopoulos
162 a96ec00f Constantinos Venetsanopoulos
   root@node1:~ # su - postgres
163 a96ec00f Constantinos Venetsanopoulos
   postgres@node1:~ $ psql
164 a96ec00f Constantinos Venetsanopoulos
   postgres=# CREATE DATABASE snf_apps WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE=template0;
165 a96ec00f Constantinos Venetsanopoulos
   postgres=# CREATE USER synnefo WITH PASSWORD 'example_passw0rd';
166 a96ec00f Constantinos Venetsanopoulos
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_apps TO synnefo;
167 a96ec00f Constantinos Venetsanopoulos
168 a96ec00f Constantinos Venetsanopoulos
We also create the database ``snf_pithos`` needed by the pithos+ backend and
169 a96ec00f Constantinos Venetsanopoulos
grant the ``synnefo`` user all privileges on the database. This database could
170 a96ec00f Constantinos Venetsanopoulos
be created on node2 instead, but we do it on node1 for simplicity. We will
171 a96ec00f Constantinos Venetsanopoulos
create all needed databases on node1 and then node2 will connect to them.
172 a96ec00f Constantinos Venetsanopoulos
173 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
174 a96ec00f Constantinos Venetsanopoulos
175 73ff1d54 Constantinos Venetsanopoulos
   postgres=# CREATE DATABASE snf_pithos WITH ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE=template0;
176 a96ec00f Constantinos Venetsanopoulos
   postgres=# GRANT ALL PRIVILEGES ON DATABASE snf_pithos TO synnefo;
177 a96ec00f Constantinos Venetsanopoulos
178 a96ec00f Constantinos Venetsanopoulos
Configure the database to listen to all network interfaces. You can do this by
179 a96ec00f Constantinos Venetsanopoulos
editting the file ``/etc/postgresql/8.4/main/postgresql.conf`` and change
180 a96ec00f Constantinos Venetsanopoulos
``listen_addresses`` to ``'*'`` :
181 a96ec00f Constantinos Venetsanopoulos
182 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
183 a96ec00f Constantinos Venetsanopoulos
184 a96ec00f Constantinos Venetsanopoulos
   listen_addresses = '*'
185 a96ec00f Constantinos Venetsanopoulos
186 a96ec00f Constantinos Venetsanopoulos
Furthermore, edit ``/etc/postgresql/8.4/main/pg_hba.conf`` to allow node1 and
187 a96ec00f Constantinos Venetsanopoulos
node2 to connect to the database. Add the following lines under ``#IPv4 local
188 a96ec00f Constantinos Venetsanopoulos
connections:`` :
189 a96ec00f Constantinos Venetsanopoulos
190 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
191 a96ec00f Constantinos Venetsanopoulos
192 a96ec00f Constantinos Venetsanopoulos
   host		all	all	4.3.2.1/32	md5
193 a96ec00f Constantinos Venetsanopoulos
   host		all	all	4.3.2.2/32	md5
194 a96ec00f Constantinos Venetsanopoulos
195 a96ec00f Constantinos Venetsanopoulos
Make sure to substitute "4.3.2.1" and "4.3.2.2" with node1's and node2's
196 a96ec00f Constantinos Venetsanopoulos
actual IPs. Now, restart the server to apply the changes:
197 a96ec00f Constantinos Venetsanopoulos
198 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
199 a96ec00f Constantinos Venetsanopoulos
200 a96ec00f Constantinos Venetsanopoulos
   # /etc/init.d/postgresql restart
201 a96ec00f Constantinos Venetsanopoulos
202 a96ec00f Constantinos Venetsanopoulos
Gunicorn setup
203 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~
204 a96ec00f Constantinos Venetsanopoulos
205 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo`` under ``/etc/gunicorn.d/`` containing the following:
206 a96ec00f Constantinos Venetsanopoulos
207 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
208 a96ec00f Constantinos Venetsanopoulos
209 a96ec00f Constantinos Venetsanopoulos
   CONFIG = {
210 a96ec00f Constantinos Venetsanopoulos
    'mode': 'django',
211 a96ec00f Constantinos Venetsanopoulos
    'environment': {
212 a96ec00f Constantinos Venetsanopoulos
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
213 a96ec00f Constantinos Venetsanopoulos
    },
214 a96ec00f Constantinos Venetsanopoulos
    'working_dir': '/etc/synnefo',
215 a96ec00f Constantinos Venetsanopoulos
    'user': 'www-data',
216 a96ec00f Constantinos Venetsanopoulos
    'group': 'www-data',
217 a96ec00f Constantinos Venetsanopoulos
    'args': (
218 a96ec00f Constantinos Venetsanopoulos
      '--bind=127.0.0.1:8080',
219 576e059b Constantinos Venetsanopoulos
      '--worker-class=gevent',
220 3c833282 Christos Stavrakakis
      '--workers=8',
221 a96ec00f Constantinos Venetsanopoulos
      '--log-level=debug',
222 a96ec00f Constantinos Venetsanopoulos
    ),
223 a96ec00f Constantinos Venetsanopoulos
   }
224 a96ec00f Constantinos Venetsanopoulos
225 0c40b4ac Kostas Papadimitriou
.. warning:: Do NOT start the server yet, because it won't find the
226 1ec63d8a Kostas Papadimitriou
    ``synnefo.settings`` module. We will start the server after successful
227 4de94e15 Kostas Papadimitriou
    installation of astakos. If the server is running::
228 a96ec00f Constantinos Venetsanopoulos
229 4de94e15 Kostas Papadimitriou
       # /etc/init.d/gunicorn stop
230 a96ec00f Constantinos Venetsanopoulos
231 a96ec00f Constantinos Venetsanopoulos
Apache2 setup
232 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~
233 a96ec00f Constantinos Venetsanopoulos
234 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
235 a96ec00f Constantinos Venetsanopoulos
the following:
236 a96ec00f Constantinos Venetsanopoulos
237 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
238 a96ec00f Constantinos Venetsanopoulos
239 a96ec00f Constantinos Venetsanopoulos
   <VirtualHost *:80>
240 a96ec00f Constantinos Venetsanopoulos
     ServerName node1.example.com
241 a96ec00f Constantinos Venetsanopoulos
242 a96ec00f Constantinos Venetsanopoulos
     RewriteEngine On
243 d2a9f85f Sofia Papagiannaki
     RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC]
244 d2a9f85f Sofia Papagiannaki
     RewriteRule ^(.*)$ - [F,L]
245 a96ec00f Constantinos Venetsanopoulos
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
246 a96ec00f Constantinos Venetsanopoulos
   </VirtualHost>
247 a96ec00f Constantinos Venetsanopoulos
248 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
249 a96ec00f Constantinos Venetsanopoulos
containing the following:
250 a96ec00f Constantinos Venetsanopoulos
251 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
252 a96ec00f Constantinos Venetsanopoulos
253 a96ec00f Constantinos Venetsanopoulos
   <IfModule mod_ssl.c>
254 a96ec00f Constantinos Venetsanopoulos
   <VirtualHost _default_:443>
255 a96ec00f Constantinos Venetsanopoulos
     ServerName node1.example.com
256 a96ec00f Constantinos Venetsanopoulos
257 a96ec00f Constantinos Venetsanopoulos
     Alias /static "/usr/share/synnefo/static"
258 a96ec00f Constantinos Venetsanopoulos
259 a96ec00f Constantinos Venetsanopoulos
   #  SetEnv no-gzip
260 a96ec00f Constantinos Venetsanopoulos
   #  SetEnv dont-vary
261 a96ec00f Constantinos Venetsanopoulos
262 04427415 Constantinos Venetsanopoulos
     AllowEncodedSlashes On
263 04427415 Constantinos Venetsanopoulos
264 a96ec00f Constantinos Venetsanopoulos
     RequestHeader set X-Forwarded-Protocol "https"
265 a96ec00f Constantinos Venetsanopoulos
266 a96ec00f Constantinos Venetsanopoulos
     <Proxy * >
267 a96ec00f Constantinos Venetsanopoulos
       Order allow,deny
268 a96ec00f Constantinos Venetsanopoulos
       Allow from all
269 a96ec00f Constantinos Venetsanopoulos
     </Proxy>
270 a96ec00f Constantinos Venetsanopoulos
271 a96ec00f Constantinos Venetsanopoulos
     SetEnv                proxy-sendchunked
272 a96ec00f Constantinos Venetsanopoulos
     SSLProxyEngine        off
273 a96ec00f Constantinos Venetsanopoulos
     ProxyErrorOverride    off
274 a96ec00f Constantinos Venetsanopoulos
275 a96ec00f Constantinos Venetsanopoulos
     ProxyPass        /static !
276 a96ec00f Constantinos Venetsanopoulos
     ProxyPass        / http://localhost:8080/ retry=0
277 a96ec00f Constantinos Venetsanopoulos
     ProxyPassReverse / http://localhost:8080/
278 a96ec00f Constantinos Venetsanopoulos
279 a96ec00f Constantinos Venetsanopoulos
     RewriteEngine On
280 d2a9f85f Sofia Papagiannaki
     RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC]
281 d2a9f85f Sofia Papagiannaki
     RewriteRule ^(.*)$ - [F,L]
282 a96ec00f Constantinos Venetsanopoulos
283 a96ec00f Constantinos Venetsanopoulos
     SSLEngine on
284 a96ec00f Constantinos Venetsanopoulos
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
285 a96ec00f Constantinos Venetsanopoulos
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
286 a96ec00f Constantinos Venetsanopoulos
   </VirtualHost>
287 a96ec00f Constantinos Venetsanopoulos
   </IfModule>
288 a96ec00f Constantinos Venetsanopoulos
289 a96ec00f Constantinos Venetsanopoulos
Now enable sites and modules by running:
290 a96ec00f Constantinos Venetsanopoulos
291 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
292 a96ec00f Constantinos Venetsanopoulos
293 a96ec00f Constantinos Venetsanopoulos
   # a2enmod ssl
294 a96ec00f Constantinos Venetsanopoulos
   # a2enmod rewrite
295 a96ec00f Constantinos Venetsanopoulos
   # a2dissite default
296 a96ec00f Constantinos Venetsanopoulos
   # a2ensite synnefo
297 a96ec00f Constantinos Venetsanopoulos
   # a2ensite synnefo-ssl
298 a96ec00f Constantinos Venetsanopoulos
   # a2enmod headers
299 a96ec00f Constantinos Venetsanopoulos
   # a2enmod proxy_http
300 a96ec00f Constantinos Venetsanopoulos
301 4de94e15 Kostas Papadimitriou
.. warning:: Do NOT start/restart the server yet. If the server is running::
302 a96ec00f Constantinos Venetsanopoulos
303 4de94e15 Kostas Papadimitriou
       # /etc/init.d/apache2 stop
304 a96ec00f Constantinos Venetsanopoulos
305 2c85833e Constantinos Venetsanopoulos
.. _rabbitmq-setup:
306 2c85833e Constantinos Venetsanopoulos
307 bdfd94c9 Constantinos Venetsanopoulos
Message Queue setup
308 bdfd94c9 Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~
309 bdfd94c9 Constantinos Venetsanopoulos
310 bdfd94c9 Constantinos Venetsanopoulos
The message queue will run on node1, so we need to create the appropriate
311 bdfd94c9 Constantinos Venetsanopoulos
rabbitmq user. The user is named ``synnefo`` and gets full privileges on all
312 bdfd94c9 Constantinos Venetsanopoulos
exchanges:
313 bdfd94c9 Constantinos Venetsanopoulos
314 bdfd94c9 Constantinos Venetsanopoulos
.. code-block:: console
315 bdfd94c9 Constantinos Venetsanopoulos
316 69aa7f21 Ilias Tsitsimpis
   # rabbitmqctl add_user synnefo "example_rabbitmq_passw0rd"
317 bdfd94c9 Constantinos Venetsanopoulos
   # rabbitmqctl set_permissions synnefo ".*" ".*" ".*"
318 bdfd94c9 Constantinos Venetsanopoulos
319 bdfd94c9 Constantinos Venetsanopoulos
We do not need to initialize the exchanges. This will be done automatically,
320 bdfd94c9 Constantinos Venetsanopoulos
during the Cyclades setup.
321 bdfd94c9 Constantinos Venetsanopoulos
322 a96ec00f Constantinos Venetsanopoulos
Pithos+ data directory setup
323 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324 a96ec00f Constantinos Venetsanopoulos
325 a96ec00f Constantinos Venetsanopoulos
As mentioned in the General Prerequisites section, there is a directory called
326 a96ec00f Constantinos Venetsanopoulos
``/srv/pithos`` visible by both nodes. We create and setup the ``data``
327 a96ec00f Constantinos Venetsanopoulos
directory inside it:
328 a96ec00f Constantinos Venetsanopoulos
329 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
330 a96ec00f Constantinos Venetsanopoulos
331 a96ec00f Constantinos Venetsanopoulos
   # cd /srv/pithos
332 a96ec00f Constantinos Venetsanopoulos
   # mkdir data
333 a96ec00f Constantinos Venetsanopoulos
   # chown www-data:www-data data
334 a96ec00f Constantinos Venetsanopoulos
   # chmod g+ws data
335 a96ec00f Constantinos Venetsanopoulos
336 a96ec00f Constantinos Venetsanopoulos
You are now ready with all general prerequisites concerning node1. Let's go to
337 a96ec00f Constantinos Venetsanopoulos
node2.
338 a96ec00f Constantinos Venetsanopoulos
339 a96ec00f Constantinos Venetsanopoulos
Node2
340 a96ec00f Constantinos Venetsanopoulos
-----
341 a96ec00f Constantinos Venetsanopoulos
342 a96ec00f Constantinos Venetsanopoulos
General Synnefo dependencies
343 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344 a96ec00f Constantinos Venetsanopoulos
345 a96ec00f Constantinos Venetsanopoulos
 * apache (http server)
346 a96ec00f Constantinos Venetsanopoulos
 * gunicorn (WSGI http server)
347 a96ec00f Constantinos Venetsanopoulos
 * postgresql (database)
348 7df5a742 Christos Stavrakakis
 * ntp (NTP daemon)
349 576e059b Constantinos Venetsanopoulos
 * gevent
350 a96ec00f Constantinos Venetsanopoulos
351 a96ec00f Constantinos Venetsanopoulos
You can install the above by running:
352 a96ec00f Constantinos Venetsanopoulos
353 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
354 a96ec00f Constantinos Venetsanopoulos
355 7df5a742 Christos Stavrakakis
   # apt-get install apache2 postgresql ntp
356 73ff1d54 Constantinos Venetsanopoulos
357 73ff1d54 Constantinos Venetsanopoulos
Make sure to install gunicorn >= v0.12.2. You can do this by installing from
358 73ff1d54 Constantinos Venetsanopoulos
the official debian backports:
359 73ff1d54 Constantinos Venetsanopoulos
360 73ff1d54 Constantinos Venetsanopoulos
.. code-block:: console
361 73ff1d54 Constantinos Venetsanopoulos
362 73ff1d54 Constantinos Venetsanopoulos
   # apt-get -t squeeze-backports install gunicorn
363 a96ec00f Constantinos Venetsanopoulos
364 576e059b Constantinos Venetsanopoulos
Also, make sure to install gevent >= 0.13.6. Again from the debian backports:
365 576e059b Constantinos Venetsanopoulos
366 576e059b Constantinos Venetsanopoulos
.. code-block:: console
367 576e059b Constantinos Venetsanopoulos
368 576e059b Constantinos Venetsanopoulos
   # apt-get -t squeeze-backports install python-gevent
369 576e059b Constantinos Venetsanopoulos
370 73ff1d54 Constantinos Venetsanopoulos
Node2 will connect to the databases on node1, so you will also need the
371 73ff1d54 Constantinos Venetsanopoulos
python-psycopg2 package:
372 a96ec00f Constantinos Venetsanopoulos
373 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
374 a96ec00f Constantinos Venetsanopoulos
375 a96ec00f Constantinos Venetsanopoulos
   # apt-get install python-psycopg2
376 a96ec00f Constantinos Venetsanopoulos
377 a96ec00f Constantinos Venetsanopoulos
Database setup
378 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~
379 a96ec00f Constantinos Venetsanopoulos
380 a96ec00f Constantinos Venetsanopoulos
All databases have been created and setup on node1, so we do not need to take
381 a96ec00f Constantinos Venetsanopoulos
any action here. From node2, we will just connect to them. When you get familiar
382 a96ec00f Constantinos Venetsanopoulos
with the software you may choose to run different databases on different nodes,
383 a96ec00f Constantinos Venetsanopoulos
for performance/scalability/redundancy reasons, but those kind of setups are out
384 a96ec00f Constantinos Venetsanopoulos
of the purpose of this guide.
385 a96ec00f Constantinos Venetsanopoulos
386 a96ec00f Constantinos Venetsanopoulos
Gunicorn setup
387 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~~
388 a96ec00f Constantinos Venetsanopoulos
389 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo`` under ``/etc/gunicorn.d/`` containing the following
390 a96ec00f Constantinos Venetsanopoulos
(same contents as in node1; you can just copy/paste the file):
391 a96ec00f Constantinos Venetsanopoulos
392 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
393 a96ec00f Constantinos Venetsanopoulos
394 a96ec00f Constantinos Venetsanopoulos
   CONFIG = {
395 a96ec00f Constantinos Venetsanopoulos
    'mode': 'django',
396 a96ec00f Constantinos Venetsanopoulos
    'environment': {
397 a96ec00f Constantinos Venetsanopoulos
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
398 a96ec00f Constantinos Venetsanopoulos
    },
399 a96ec00f Constantinos Venetsanopoulos
    'working_dir': '/etc/synnefo',
400 a96ec00f Constantinos Venetsanopoulos
    'user': 'www-data',
401 a96ec00f Constantinos Venetsanopoulos
    'group': 'www-data',
402 a96ec00f Constantinos Venetsanopoulos
    'args': (
403 a96ec00f Constantinos Venetsanopoulos
      '--bind=127.0.0.1:8080',
404 576e059b Constantinos Venetsanopoulos
      '--worker-class=gevent',
405 a96ec00f Constantinos Venetsanopoulos
      '--workers=4',
406 a96ec00f Constantinos Venetsanopoulos
      '--log-level=debug',
407 699c8773 Sofia Papagiannaki
      '--timeout=43200'
408 a96ec00f Constantinos Venetsanopoulos
    ),
409 a96ec00f Constantinos Venetsanopoulos
   }
410 a96ec00f Constantinos Venetsanopoulos
411 0c40b4ac Kostas Papadimitriou
.. warning:: Do NOT start the server yet, because it won't find the
412 1ec63d8a Kostas Papadimitriou
    ``synnefo.settings`` module. We will start the server after successful
413 4de94e15 Kostas Papadimitriou
    installation of astakos. If the server is running::
414 a96ec00f Constantinos Venetsanopoulos
415 4de94e15 Kostas Papadimitriou
       # /etc/init.d/gunicorn stop
416 bdb83fd6 cven
417 a96ec00f Constantinos Venetsanopoulos
Apache2 setup
418 a96ec00f Constantinos Venetsanopoulos
~~~~~~~~~~~~~
419 5b6feb88 Vangelis Koukis
420 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo`` under ``/etc/apache2/sites-available/`` containing
421 a96ec00f Constantinos Venetsanopoulos
the following:
422 5b6feb88 Vangelis Koukis
423 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
424 a96ec00f Constantinos Venetsanopoulos
425 a96ec00f Constantinos Venetsanopoulos
   <VirtualHost *:80>
426 a96ec00f Constantinos Venetsanopoulos
     ServerName node2.example.com
427 a96ec00f Constantinos Venetsanopoulos
428 a96ec00f Constantinos Venetsanopoulos
     RewriteEngine On
429 d2a9f85f Sofia Papagiannaki
     RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC]
430 d2a9f85f Sofia Papagiannaki
     RewriteRule ^(.*)$ - [F,L]
431 a96ec00f Constantinos Venetsanopoulos
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
432 a96ec00f Constantinos Venetsanopoulos
   </VirtualHost>
433 a96ec00f Constantinos Venetsanopoulos
434 a96ec00f Constantinos Venetsanopoulos
Create the file ``synnefo-ssl`` under ``/etc/apache2/sites-available/``
435 a96ec00f Constantinos Venetsanopoulos
containing the following:
436 a96ec00f Constantinos Venetsanopoulos
437 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
438 a96ec00f Constantinos Venetsanopoulos
439 a96ec00f Constantinos Venetsanopoulos
   <IfModule mod_ssl.c>
440 a96ec00f Constantinos Venetsanopoulos
   <VirtualHost _default_:443>
441 a96ec00f Constantinos Venetsanopoulos
     ServerName node2.example.com
442 a96ec00f Constantinos Venetsanopoulos
443 a96ec00f Constantinos Venetsanopoulos
     Alias /static "/usr/share/synnefo/static"
444 a96ec00f Constantinos Venetsanopoulos
445 a96ec00f Constantinos Venetsanopoulos
     SetEnv no-gzip
446 a96ec00f Constantinos Venetsanopoulos
     SetEnv dont-vary
447 04427415 Constantinos Venetsanopoulos
     AllowEncodedSlashes On
448 a96ec00f Constantinos Venetsanopoulos
449 a96ec00f Constantinos Venetsanopoulos
     RequestHeader set X-Forwarded-Protocol "https"
450 a96ec00f Constantinos Venetsanopoulos
451 a96ec00f Constantinos Venetsanopoulos
     <Proxy * >
452 a96ec00f Constantinos Venetsanopoulos
       Order allow,deny
453 a96ec00f Constantinos Venetsanopoulos
       Allow from all
454 a96ec00f Constantinos Venetsanopoulos
     </Proxy>
455 a96ec00f Constantinos Venetsanopoulos
456 a96ec00f Constantinos Venetsanopoulos
     SetEnv                proxy-sendchunked
457 a96ec00f Constantinos Venetsanopoulos
     SSLProxyEngine        off
458 a96ec00f Constantinos Venetsanopoulos
     ProxyErrorOverride    off
459 a96ec00f Constantinos Venetsanopoulos
460 a96ec00f Constantinos Venetsanopoulos
     ProxyPass        /static !
461 a96ec00f Constantinos Venetsanopoulos
     ProxyPass        / http://localhost:8080/ retry=0
462 a96ec00f Constantinos Venetsanopoulos
     ProxyPassReverse / http://localhost:8080/
463 a96ec00f Constantinos Venetsanopoulos
464 a96ec00f Constantinos Venetsanopoulos
     SSLEngine on
465 a96ec00f Constantinos Venetsanopoulos
     SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
466 a96ec00f Constantinos Venetsanopoulos
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
467 a96ec00f Constantinos Venetsanopoulos
   </VirtualHost>
468 a96ec00f Constantinos Venetsanopoulos
   </IfModule>
469 a96ec00f Constantinos Venetsanopoulos
470 a96ec00f Constantinos Venetsanopoulos
As in node1, enable sites and modules by running:
471 a96ec00f Constantinos Venetsanopoulos
472 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
473 a96ec00f Constantinos Venetsanopoulos
474 a96ec00f Constantinos Venetsanopoulos
   # a2enmod ssl
475 a96ec00f Constantinos Venetsanopoulos
   # a2enmod rewrite
476 a96ec00f Constantinos Venetsanopoulos
   # a2dissite default
477 a96ec00f Constantinos Venetsanopoulos
   # a2ensite synnefo
478 a96ec00f Constantinos Venetsanopoulos
   # a2ensite synnefo-ssl
479 a96ec00f Constantinos Venetsanopoulos
   # a2enmod headers
480 a96ec00f Constantinos Venetsanopoulos
   # a2enmod proxy_http
481 a96ec00f Constantinos Venetsanopoulos
482 4de94e15 Kostas Papadimitriou
.. warning:: Do NOT start/restart the server yet. If the server is running::
483 a96ec00f Constantinos Venetsanopoulos
484 4de94e15 Kostas Papadimitriou
       # /etc/init.d/apache2 stop
485 a96ec00f Constantinos Venetsanopoulos
486 a96ec00f Constantinos Venetsanopoulos
We are now ready with all general prerequisites for node2. Now that we have
487 a96ec00f Constantinos Venetsanopoulos
finished with all general prerequisites for both nodes, we can start installing
488 a96ec00f Constantinos Venetsanopoulos
the services. First, let's install Astakos on node1.
489 a96ec00f Constantinos Venetsanopoulos
490 a96ec00f Constantinos Venetsanopoulos
491 a96ec00f Constantinos Venetsanopoulos
Installation of Astakos on node1
492 a96ec00f Constantinos Venetsanopoulos
================================
493 a96ec00f Constantinos Venetsanopoulos
494 a96ec00f Constantinos Venetsanopoulos
To install astakos, grab the package from our repository (make sure  you made
495 a96ec00f Constantinos Venetsanopoulos
the additions needed in your ``/etc/apt/sources.list`` file, as described
496 a96ec00f Constantinos Venetsanopoulos
previously), by running:
497 a96ec00f Constantinos Venetsanopoulos
498 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
499 a96ec00f Constantinos Venetsanopoulos
500 a96ec00f Constantinos Venetsanopoulos
   # apt-get install snf-astakos-app
501 a96ec00f Constantinos Venetsanopoulos
502 a96ec00f Constantinos Venetsanopoulos
After successful installation of snf-astakos-app, make sure that also
503 a96ec00f Constantinos Venetsanopoulos
snf-webproject has been installed (marked as "Recommended" package). By default
504 a96ec00f Constantinos Venetsanopoulos
Debian installs "Recommended" packages, but if you have changed your
505 a96ec00f Constantinos Venetsanopoulos
configuration and the package didn't install automatically, you should
506 a96ec00f Constantinos Venetsanopoulos
explicitly install it manually running:
507 a96ec00f Constantinos Venetsanopoulos
508 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
509 a96ec00f Constantinos Venetsanopoulos
510 a96ec00f Constantinos Venetsanopoulos
   # apt-get install snf-webproject
511 a96ec00f Constantinos Venetsanopoulos
512 a96ec00f Constantinos Venetsanopoulos
The reason snf-webproject is "Recommended" and not a hard dependency, is to give
513 a96ec00f Constantinos Venetsanopoulos
the experienced administrator the ability to install synnefo in a custom made
514 a96ec00f Constantinos Venetsanopoulos
django project. This corner case concerns only very advanced users that know
515 a96ec00f Constantinos Venetsanopoulos
what they are doing and want to experiment with synnefo.
516 a96ec00f Constantinos Venetsanopoulos
517 04c1254b Constantinos Venetsanopoulos
518 04c1254b Constantinos Venetsanopoulos
.. _conf-astakos:
519 04c1254b Constantinos Venetsanopoulos
520 a96ec00f Constantinos Venetsanopoulos
Configuration of Astakos
521 a96ec00f Constantinos Venetsanopoulos
========================
522 a96ec00f Constantinos Venetsanopoulos
523 a96ec00f Constantinos Venetsanopoulos
Conf Files
524 a96ec00f Constantinos Venetsanopoulos
----------
525 a96ec00f Constantinos Venetsanopoulos
526 a96ec00f Constantinos Venetsanopoulos
After astakos is successfully installed, you will find the directory
527 a96ec00f Constantinos Venetsanopoulos
``/etc/synnefo`` and some configuration files inside it. The files contain
528 a96ec00f Constantinos Venetsanopoulos
commented configuration options, which are the default options. While installing
529 a96ec00f Constantinos Venetsanopoulos
new snf-* components, new configuration files will appear inside the directory.
530 a96ec00f Constantinos Venetsanopoulos
In this guide (and for all services), we will edit only the minimum necessary
531 a96ec00f Constantinos Venetsanopoulos
configuration options, to reflect our setup. Everything else will remain as is.
532 a96ec00f Constantinos Venetsanopoulos
533 a96ec00f Constantinos Venetsanopoulos
After getting familiar with synnefo, you will be able to customize the software
534 a96ec00f Constantinos Venetsanopoulos
as you wish and fits your needs. Many options are available, to empower the
535 a96ec00f Constantinos Venetsanopoulos
administrator with extensively customizable setups.
536 a96ec00f Constantinos Venetsanopoulos
537 a96ec00f Constantinos Venetsanopoulos
For the snf-webproject component (installed as an astakos dependency), we
538 a96ec00f Constantinos Venetsanopoulos
need the following:
539 a96ec00f Constantinos Venetsanopoulos
540 a96ec00f Constantinos Venetsanopoulos
Edit ``/etc/synnefo/10-snf-webproject-database.conf``. You will need to
541 a96ec00f Constantinos Venetsanopoulos
uncomment and edit the ``DATABASES`` block to reflect our database:
542 a96ec00f Constantinos Venetsanopoulos
543 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
544 a96ec00f Constantinos Venetsanopoulos
545 a96ec00f Constantinos Venetsanopoulos
   DATABASES = {
546 a96ec00f Constantinos Venetsanopoulos
    'default': {
547 a96ec00f Constantinos Venetsanopoulos
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
548 a96ec00f Constantinos Venetsanopoulos
        'ENGINE': 'postgresql_psycopg2',
549 a96ec00f Constantinos Venetsanopoulos
         # ATTENTION: This *must* be the absolute path if using sqlite3.
550 a96ec00f Constantinos Venetsanopoulos
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
551 a96ec00f Constantinos Venetsanopoulos
        'NAME': 'snf_apps',
552 a96ec00f Constantinos Venetsanopoulos
        'USER': 'synnefo',                      # Not used with sqlite3.
553 4404e02e Ilias Tsitsimpis
        'PASSWORD': 'example_passw0rd',         # Not used with sqlite3.
554 a96ec00f Constantinos Venetsanopoulos
        # Set to empty string for localhost. Not used with sqlite3.
555 a96ec00f Constantinos Venetsanopoulos
        'HOST': '4.3.2.1',
556 a96ec00f Constantinos Venetsanopoulos
        # Set to empty string for default. Not used with sqlite3.
557 a96ec00f Constantinos Venetsanopoulos
        'PORT': '5432',
558 a96ec00f Constantinos Venetsanopoulos
    }
559 a96ec00f Constantinos Venetsanopoulos
   }
560 a96ec00f Constantinos Venetsanopoulos
561 a96ec00f Constantinos Venetsanopoulos
Edit ``/etc/synnefo/10-snf-webproject-deploy.conf``. Uncomment and edit
562 a96ec00f Constantinos Venetsanopoulos
``SECRET_KEY``. This is a django specific setting which is used to provide a
563 a96ec00f Constantinos Venetsanopoulos
seed in secret-key hashing algorithms. Set this to a random string of your
564 a96ec00f Constantinos Venetsanopoulos
choise and keep it private:
565 a96ec00f Constantinos Venetsanopoulos
566 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
567 a96ec00f Constantinos Venetsanopoulos
568 a96ec00f Constantinos Venetsanopoulos
   SECRET_KEY = 'sy6)mw6a7x%n)-example_secret_key#zzk4jo6f2=uqu!1o%)'
569 a96ec00f Constantinos Venetsanopoulos
570 a96ec00f Constantinos Venetsanopoulos
For astakos specific configuration, edit the following options in
571 73ff1d54 Constantinos Venetsanopoulos
``/etc/synnefo/20-snf-astakos-app-settings.conf`` :
572 a96ec00f Constantinos Venetsanopoulos
573 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
574 a96ec00f Constantinos Venetsanopoulos
575 4404e02e Ilias Tsitsimpis
   ASTAKOS_DEFAULT_ADMIN_EMAIL = None
576 4404e02e Ilias Tsitsimpis
577 a96ec00f Constantinos Venetsanopoulos
   ASTAKOS_COOKIE_DOMAIN = '.example.com'
578 a96ec00f Constantinos Venetsanopoulos
579 a96ec00f Constantinos Venetsanopoulos
   ASTAKOS_BASEURL = 'https://node1.example.com'
580 a96ec00f Constantinos Venetsanopoulos
581 4e3e3d24 Constantinos Venetsanopoulos
The ``ASTAKOS_COOKIE_DOMAIN`` should be the base url of our domain (for all
582 4e3e3d24 Constantinos Venetsanopoulos
services). ``ASTAKOS_BASEURL`` is the astakos home page.
583 5b6feb88 Vangelis Koukis
584 4404e02e Ilias Tsitsimpis
``ASTAKOS_DEFAULT_ADMIN_EMAIL`` refers to the administrator's email.
585 4404e02e Ilias Tsitsimpis
Every time a new account is created a notification is sent to this email.
586 4404e02e Ilias Tsitsimpis
For this we need access to a running mail server, so we have disabled
587 4404e02e Ilias Tsitsimpis
it for now by setting its value to None. For more informations on this,
588 4404e02e Ilias Tsitsimpis
read the relative :ref:`section <mail-server>`.
589 4404e02e Ilias Tsitsimpis
590 4e3e3d24 Constantinos Venetsanopoulos
.. note:: For the purpose of this guide, we don't enable recaptcha authentication.
591 4e3e3d24 Constantinos Venetsanopoulos
    If you would like to enable it, you have to edit the following options:
592 319b615d Ilias Tsitsimpis
593 319b615d Ilias Tsitsimpis
    .. code-block:: console
594 319b615d Ilias Tsitsimpis
595 319b615d Ilias Tsitsimpis
        ASTAKOS_RECAPTCHA_PUBLIC_KEY = 'example_recaptcha_public_key!@#$%^&*('
596 319b615d Ilias Tsitsimpis
        ASTAKOS_RECAPTCHA_PRIVATE_KEY = 'example_recaptcha_private_key!@#$%^&*('
597 319b615d Ilias Tsitsimpis
        ASTAKOS_RECAPTCHA_USE_SSL = True
598 319b615d Ilias Tsitsimpis
        ASTAKOS_RECAPTCHA_ENABLED = True
599 319b615d Ilias Tsitsimpis
600 319b615d Ilias Tsitsimpis
    For the ``ASTAKOS_RECAPTCHA_PUBLIC_KEY`` and ``ASTAKOS_RECAPTCHA_PRIVATE_KEY``
601 319b615d Ilias Tsitsimpis
    go to https://www.google.com/recaptcha/admin/create and create your own pair.
602 5b6feb88 Vangelis Koukis
603 610ff8cf Constantinos Venetsanopoulos
Then edit ``/etc/synnefo/20-snf-astakos-app-cloudbar.conf`` :
604 610ff8cf Constantinos Venetsanopoulos
605 610ff8cf Constantinos Venetsanopoulos
.. code-block:: console
606 610ff8cf Constantinos Venetsanopoulos
607 610ff8cf Constantinos Venetsanopoulos
   CLOUDBAR_LOCATION = 'https://node1.example.com/static/im/cloudbar/'
608 610ff8cf Constantinos Venetsanopoulos
609 610ff8cf Constantinos Venetsanopoulos
   CLOUDBAR_SERVICES_URL = 'https://node1.example.com/im/get_services'
610 610ff8cf Constantinos Venetsanopoulos
611 610ff8cf Constantinos Venetsanopoulos
   CLOUDBAR_MENU_URL = 'https://node1.example.com/im/get_menu'
612 610ff8cf Constantinos Venetsanopoulos
613 610ff8cf Constantinos Venetsanopoulos
Those settings have to do with the black cloudbar endpoints and will be described
614 610ff8cf Constantinos Venetsanopoulos
in more detail later on in this guide. For now, just edit the domain to point at
615 610ff8cf Constantinos Venetsanopoulos
node1 which is where we have installed Astakos.
616 610ff8cf Constantinos Venetsanopoulos
617 d189d11c Constantinos Venetsanopoulos
If you are an advanced user and want to use the Shibboleth Authentication method,
618 d189d11c Constantinos Venetsanopoulos
read the relative :ref:`section <shibboleth-auth>`.
619 d2a9f85f Sofia Papagiannaki
620 5a2d4e43 Christos Stavrakakis
.. note:: Because Cyclades and Astakos are running on the same machine
621 5a2d4e43 Christos Stavrakakis
    in our example, we have to deactivate the CSRF verification. We can do so
622 5a2d4e43 Christos Stavrakakis
    by adding to
623 5a2d4e43 Christos Stavrakakis
    ``/etc/synnefo/99-local.conf``:
624 5a2d4e43 Christos Stavrakakis
625 5a2d4e43 Christos Stavrakakis
    .. code-block:: console
626 5a2d4e43 Christos Stavrakakis
627 5a2d4e43 Christos Stavrakakis
        MIDDLEWARE_CLASSES.remove('django.middleware.csrf.CsrfViewMiddleware')
628 5a2d4e43 Christos Stavrakakis
        TEMPLATE_CONTEXT_PROCESSORS.remove('django.core.context_processors.csrf')
629 5a2d4e43 Christos Stavrakakis
630 4e3e3d24 Constantinos Venetsanopoulos
Enable Pooling
631 4e3e3d24 Constantinos Venetsanopoulos
--------------
632 4e3e3d24 Constantinos Venetsanopoulos
633 4e3e3d24 Constantinos Venetsanopoulos
This section can be bypassed, but we strongly recommend you apply the following,
634 4e3e3d24 Constantinos Venetsanopoulos
since they result in a significant performance boost.
635 4e3e3d24 Constantinos Venetsanopoulos
636 4e3e3d24 Constantinos Venetsanopoulos
Synnefo includes a pooling DBAPI driver for PostgreSQL, as a thin wrapper
637 4e3e3d24 Constantinos Venetsanopoulos
around Psycopg2. This allows independent Django requests to reuse pooled DB
638 4e3e3d24 Constantinos Venetsanopoulos
connections, with significant performance gains.
639 4e3e3d24 Constantinos Venetsanopoulos
640 4e3e3d24 Constantinos Venetsanopoulos
To use, first monkey-patch psycopg2. For Django, run this before the
641 4e3e3d24 Constantinos Venetsanopoulos
``DATABASES`` setting in ``/etc/synnefo/10-snf-webproject-database.conf``:
642 4e3e3d24 Constantinos Venetsanopoulos
643 4e3e3d24 Constantinos Venetsanopoulos
.. code-block:: console
644 4e3e3d24 Constantinos Venetsanopoulos
645 4e3e3d24 Constantinos Venetsanopoulos
   from synnefo.lib.db.pooled_psycopg2 import monkey_patch_psycopg2
646 4e3e3d24 Constantinos Venetsanopoulos
   monkey_patch_psycopg2()
647 4e3e3d24 Constantinos Venetsanopoulos
648 576e059b Constantinos Venetsanopoulos
Since we are running with greenlets, we should modify psycopg2 behavior, so it
649 576e059b Constantinos Venetsanopoulos
works properly in a greenlet context:
650 4e3e3d24 Constantinos Venetsanopoulos
651 4e3e3d24 Constantinos Venetsanopoulos
.. code-block:: console
652 4e3e3d24 Constantinos Venetsanopoulos
653 4e3e3d24 Constantinos Venetsanopoulos
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
654 4e3e3d24 Constantinos Venetsanopoulos
   make_psycopg_green()
655 4e3e3d24 Constantinos Venetsanopoulos
656 4e3e3d24 Constantinos Venetsanopoulos
Use the Psycopg2 driver as usual. For Django, this means using
657 4e3e3d24 Constantinos Venetsanopoulos
``django.db.backends.postgresql_psycopg2`` without any modifications. To enable
658 4e3e3d24 Constantinos Venetsanopoulos
connection pooling, pass a nonzero ``synnefo_poolsize`` option to the DBAPI
659 4e3e3d24 Constantinos Venetsanopoulos
driver, through ``DATABASES.OPTIONS`` in django.
660 4e3e3d24 Constantinos Venetsanopoulos
661 4e3e3d24 Constantinos Venetsanopoulos
All the above will result in an ``/etc/synnefo/10-snf-webproject-database.conf``
662 4e3e3d24 Constantinos Venetsanopoulos
file that looks like this:
663 4e3e3d24 Constantinos Venetsanopoulos
664 4e3e3d24 Constantinos Venetsanopoulos
.. code-block:: console
665 4e3e3d24 Constantinos Venetsanopoulos
666 4e3e3d24 Constantinos Venetsanopoulos
   # Monkey-patch psycopg2
667 4e3e3d24 Constantinos Venetsanopoulos
   from synnefo.lib.db.pooled_psycopg2 import monkey_patch_psycopg2
668 4e3e3d24 Constantinos Venetsanopoulos
   monkey_patch_psycopg2()
669 4e3e3d24 Constantinos Venetsanopoulos
670 4e3e3d24 Constantinos Venetsanopoulos
   # If running with greenlets
671 4e3e3d24 Constantinos Venetsanopoulos
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
672 4e3e3d24 Constantinos Venetsanopoulos
   make_psycopg_green()
673 4e3e3d24 Constantinos Venetsanopoulos
674 4e3e3d24 Constantinos Venetsanopoulos
   DATABASES = {
675 4e3e3d24 Constantinos Venetsanopoulos
    'default': {
676 4e3e3d24 Constantinos Venetsanopoulos
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
677 4e3e3d24 Constantinos Venetsanopoulos
        'ENGINE': 'postgresql_psycopg2',
678 4e3e3d24 Constantinos Venetsanopoulos
        'OPTIONS': {'synnefo_poolsize': 8},
679 4e3e3d24 Constantinos Venetsanopoulos
680 4e3e3d24 Constantinos Venetsanopoulos
         # ATTENTION: This *must* be the absolute path if using sqlite3.
681 4e3e3d24 Constantinos Venetsanopoulos
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
682 4e3e3d24 Constantinos Venetsanopoulos
        'NAME': 'snf_apps',
683 4e3e3d24 Constantinos Venetsanopoulos
        'USER': 'synnefo',                      # Not used with sqlite3.
684 4e3e3d24 Constantinos Venetsanopoulos
        'PASSWORD': 'example_passw0rd',         # Not used with sqlite3.
685 4e3e3d24 Constantinos Venetsanopoulos
        # Set to empty string for localhost. Not used with sqlite3.
686 4e3e3d24 Constantinos Venetsanopoulos
        'HOST': '4.3.2.1',
687 4e3e3d24 Constantinos Venetsanopoulos
        # Set to empty string for default. Not used with sqlite3.
688 4e3e3d24 Constantinos Venetsanopoulos
        'PORT': '5432',
689 4e3e3d24 Constantinos Venetsanopoulos
    }
690 4e3e3d24 Constantinos Venetsanopoulos
   }
691 5a2d4e43 Christos Stavrakakis
692 a96ec00f Constantinos Venetsanopoulos
Database Initialization
693 a96ec00f Constantinos Venetsanopoulos
-----------------------
694 a96ec00f Constantinos Venetsanopoulos
695 de20a465 Constantinos Venetsanopoulos
After configuration is done, we initialize the database by running:
696 5b6feb88 Vangelis Koukis
697 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
698 a96ec00f Constantinos Venetsanopoulos
699 a96ec00f Constantinos Venetsanopoulos
   # snf-manage syncdb
700 a96ec00f Constantinos Venetsanopoulos
701 a96ec00f Constantinos Venetsanopoulos
At this example we don't need to create a django superuser, so we select
702 a96ec00f Constantinos Venetsanopoulos
``[no]`` to the question. After a successful sync, we run the migration needed
703 a96ec00f Constantinos Venetsanopoulos
for astakos:
704 5b6feb88 Vangelis Koukis
705 5b6feb88 Vangelis Koukis
.. code-block:: console
706 5b6feb88 Vangelis Koukis
707 a96ec00f Constantinos Venetsanopoulos
   # snf-manage migrate im
708 a96ec00f Constantinos Venetsanopoulos
709 de20a465 Constantinos Venetsanopoulos
Then, we load the pre-defined user groups
710 d2a9f85f Sofia Papagiannaki
711 d2a9f85f Sofia Papagiannaki
.. code-block:: console
712 d2a9f85f Sofia Papagiannaki
713 d2a9f85f Sofia Papagiannaki
   # snf-manage loaddata groups
714 d2a9f85f Sofia Papagiannaki
715 de20a465 Constantinos Venetsanopoulos
.. _services-reg:
716 de20a465 Constantinos Venetsanopoulos
717 de20a465 Constantinos Venetsanopoulos
Services Registration
718 de20a465 Constantinos Venetsanopoulos
---------------------
719 de20a465 Constantinos Venetsanopoulos
720 de20a465 Constantinos Venetsanopoulos
When the database is ready, we configure the elements of the Astakos cloudbar,
721 de20a465 Constantinos Venetsanopoulos
to point to our future services:
722 de20a465 Constantinos Venetsanopoulos
723 de20a465 Constantinos Venetsanopoulos
.. code-block:: console
724 de20a465 Constantinos Venetsanopoulos
725 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-add "~okeanos home" https://node1.example.com/im/ home-icon.png
726 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-add "cyclades" https://node1.example.com/ui/
727 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-add "pithos+" https://node2.example.com/ui/
728 de20a465 Constantinos Venetsanopoulos
729 de20a465 Constantinos Venetsanopoulos
Servers Initialization
730 de20a465 Constantinos Venetsanopoulos
----------------------
731 de20a465 Constantinos Venetsanopoulos
732 de20a465 Constantinos Venetsanopoulos
Finally, we initialize the servers on node1:
733 de20a465 Constantinos Venetsanopoulos
734 de20a465 Constantinos Venetsanopoulos
.. code-block:: console
735 de20a465 Constantinos Venetsanopoulos
736 de20a465 Constantinos Venetsanopoulos
   root@node1:~ # /etc/init.d/gunicorn restart
737 de20a465 Constantinos Venetsanopoulos
   root@node1:~ # /etc/init.d/apache2 restart
738 de20a465 Constantinos Venetsanopoulos
739 de20a465 Constantinos Venetsanopoulos
We have now finished the Astakos setup. Let's test it now.
740 a96ec00f Constantinos Venetsanopoulos
741 a96ec00f Constantinos Venetsanopoulos
742 a96ec00f Constantinos Venetsanopoulos
Testing of Astakos
743 a96ec00f Constantinos Venetsanopoulos
==================
744 a96ec00f Constantinos Venetsanopoulos
745 a96ec00f Constantinos Venetsanopoulos
Open your favorite browser and go to:
746 a96ec00f Constantinos Venetsanopoulos
747 a96ec00f Constantinos Venetsanopoulos
``http://node1.example.com/im``
748 a96ec00f Constantinos Venetsanopoulos
749 a96ec00f Constantinos Venetsanopoulos
If this redirects you to ``https://node1.example.com/im`` and you can see
750 a96ec00f Constantinos Venetsanopoulos
the "welcome" door of Astakos, then you have successfully setup Astakos.
751 a96ec00f Constantinos Venetsanopoulos
752 a96ec00f Constantinos Venetsanopoulos
Let's create our first user. At the homepage click the "CREATE ACCOUNT" button
753 a96ec00f Constantinos Venetsanopoulos
and fill all your data at the sign up form. Then click "SUBMIT". You should now
754 a96ec00f Constantinos Venetsanopoulos
see a green box on the top, which informs you that you made a successful request
755 caa6c07d Constantinos Venetsanopoulos
and the request has been sent to the administrators. So far so good, let's assume
756 caa6c07d Constantinos Venetsanopoulos
that you created the user with username ``user@example.com``.
757 a96ec00f Constantinos Venetsanopoulos
758 a96ec00f Constantinos Venetsanopoulos
Now we need to activate that user. Return to a command prompt at node1 and run:
759 a96ec00f Constantinos Venetsanopoulos
760 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
761 a96ec00f Constantinos Venetsanopoulos
762 62b10e3f Constantinos Venetsanopoulos
   root@node1:~ # snf-manage user-list
763 a96ec00f Constantinos Venetsanopoulos
764 a96ec00f Constantinos Venetsanopoulos
This command should show you a list with only one user; the one we just created.
765 a96ec00f Constantinos Venetsanopoulos
This user should have an id with a value of ``1``. It should also have an
766 a96ec00f Constantinos Venetsanopoulos
"active" status with the value of ``0`` (inactive). Now run:
767 a96ec00f Constantinos Venetsanopoulos
768 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
769 a96ec00f Constantinos Venetsanopoulos
770 18e300b2 Christos Stavrakakis
   root@node1:~ # snf-manage user-update --set-active 1
771 a96ec00f Constantinos Venetsanopoulos
772 a96ec00f Constantinos Venetsanopoulos
This modifies the active value to ``1``, and actually activates the user.
773 a96ec00f Constantinos Venetsanopoulos
When running in production, the activation is done automatically with different
774 a96ec00f Constantinos Venetsanopoulos
types of moderation, that Astakos supports. You can see the moderation methods
775 a96ec00f Constantinos Venetsanopoulos
(by invitation, whitelists, matching regexp, etc.) at the Astakos specific
776 f846d8df Constantinos Venetsanopoulos
documentation. In production, you can also manually activate a user, by sending
777 f846d8df Constantinos Venetsanopoulos
him/her an activation email. See how to do this at the :ref:`User
778 f846d8df Constantinos Venetsanopoulos
activation <user_activation>` section.
779 a96ec00f Constantinos Venetsanopoulos
780 a96ec00f Constantinos Venetsanopoulos
Now let's go back to the homepage. Open ``http://node1.example.com/im`` with
781 a96ec00f Constantinos Venetsanopoulos
your browser again. Try to sign in using your new credentials. If the astakos
782 a96ec00f Constantinos Venetsanopoulos
menu appears and you can see your profile, then you have successfully setup
783 a96ec00f Constantinos Venetsanopoulos
Astakos.
784 a96ec00f Constantinos Venetsanopoulos
785 a96ec00f Constantinos Venetsanopoulos
Let's continue to install Pithos+ now.
786 a96ec00f Constantinos Venetsanopoulos
787 a96ec00f Constantinos Venetsanopoulos
788 a96ec00f Constantinos Venetsanopoulos
Installation of Pithos+ on node2
789 a96ec00f Constantinos Venetsanopoulos
================================
790 a96ec00f Constantinos Venetsanopoulos
791 138253bc Constantinos Venetsanopoulos
To install pithos+, grab the packages from our repository (make sure  you made
792 a96ec00f Constantinos Venetsanopoulos
the additions needed in your ``/etc/apt/sources.list`` file, as described
793 a96ec00f Constantinos Venetsanopoulos
previously), by running:
794 a96ec00f Constantinos Venetsanopoulos
795 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
796 a96ec00f Constantinos Venetsanopoulos
797 a96ec00f Constantinos Venetsanopoulos
   # apt-get install snf-pithos-app
798 a96ec00f Constantinos Venetsanopoulos
799 a96ec00f Constantinos Venetsanopoulos
After successful installation of snf-pithos-app, make sure that also
800 a96ec00f Constantinos Venetsanopoulos
snf-webproject has been installed (marked as "Recommended" package). Refer to
801 a96ec00f Constantinos Venetsanopoulos
the "Installation of Astakos on node1" section, if you don't remember why this
802 138253bc Constantinos Venetsanopoulos
should happen. Now, install the pithos web interface:
803 a96ec00f Constantinos Venetsanopoulos
804 138253bc Constantinos Venetsanopoulos
.. code-block:: console
805 138253bc Constantinos Venetsanopoulos
806 138253bc Constantinos Venetsanopoulos
   # apt-get install snf-pithos-webclient
807 138253bc Constantinos Venetsanopoulos
808 138253bc Constantinos Venetsanopoulos
This package provides the standalone pithos web client. The web client is the
809 138253bc Constantinos Venetsanopoulos
web UI for pithos+ and will be accessible by clicking "pithos+" on the Astakos
810 138253bc Constantinos Venetsanopoulos
interface's cloudbar, at the top of the Astakos homepage.
811 a96ec00f Constantinos Venetsanopoulos
812 caa6c07d Constantinos Venetsanopoulos
813 04c1254b Constantinos Venetsanopoulos
.. _conf-pithos:
814 04c1254b Constantinos Venetsanopoulos
815 a96ec00f Constantinos Venetsanopoulos
Configuration of Pithos+
816 a96ec00f Constantinos Venetsanopoulos
========================
817 a96ec00f Constantinos Venetsanopoulos
818 a96ec00f Constantinos Venetsanopoulos
Conf Files
819 a96ec00f Constantinos Venetsanopoulos
----------
820 a96ec00f Constantinos Venetsanopoulos
821 a96ec00f Constantinos Venetsanopoulos
After pithos+ is successfully installed, you will find the directory
822 a96ec00f Constantinos Venetsanopoulos
``/etc/synnefo`` and some configuration files inside it, as you did in node1
823 a96ec00f Constantinos Venetsanopoulos
after installation of astakos. Here, you will not have to change anything that
824 a96ec00f Constantinos Venetsanopoulos
has to do with snf-common or snf-webproject. Everything is set at node1. You
825 138253bc Constantinos Venetsanopoulos
only need to change settings that have to do with pithos+. Specifically:
826 a96ec00f Constantinos Venetsanopoulos
827 a96ec00f Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-pithos-app-settings.conf``. There you need to set
828 11c16930 Ilias Tsitsimpis
this options:
829 a96ec00f Constantinos Venetsanopoulos
830 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
831 a96ec00f Constantinos Venetsanopoulos
832 a96ec00f Constantinos Venetsanopoulos
   PITHOS_BACKEND_DB_CONNECTION = 'postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos'
833 a96ec00f Constantinos Venetsanopoulos
834 a96ec00f Constantinos Venetsanopoulos
   PITHOS_BACKEND_BLOCK_PATH = '/srv/pithos/data'
835 bdfd94c9 Constantinos Venetsanopoulos
836 01bd066a Sofia Papagiannaki
   PITHOS_AUTHENTICATION_URL = 'https://node1.example.com/im/authenticate'
837 01bd066a Sofia Papagiannaki
   PITHOS_AUTHENTICATION_USERS = None
838 a96ec00f Constantinos Venetsanopoulos
839 3e6d0710 Constantinos Venetsanopoulos
   PITHOS_SERVICE_TOKEN = 'pithos_service_token22w=='
840 02d94254 Sofia Papagiannaki
   PITHOS_USER_CATALOG_URL = 'http://node1.example.com/user_catalogs'
841 02d94254 Sofia Papagiannaki
   PITHOS_USER_FEEDBACK_URL = 'http://node1.example.com/feedback'
842 02d94254 Sofia Papagiannaki
   PITHOS_USER_LOGIN_URL = 'http://node1.example.com/login'
843 02d94254 Sofia Papagiannaki
844 3e6d0710 Constantinos Venetsanopoulos
845 bdfd94c9 Constantinos Venetsanopoulos
The ``PITHOS_BACKEND_DB_CONNECTION`` option tells to the pithos+ app where to
846 bdfd94c9 Constantinos Venetsanopoulos
find the pithos+ backend database. Above we tell pithos+ that its database is
847 bdfd94c9 Constantinos Venetsanopoulos
``snf_pithos`` at node1 and to connect as user ``synnefo`` with password
848 bdfd94c9 Constantinos Venetsanopoulos
``example_passw0rd``.  All those settings where setup during node1's "Database
849 bdfd94c9 Constantinos Venetsanopoulos
setup" section.
850 a96ec00f Constantinos Venetsanopoulos
851 bdfd94c9 Constantinos Venetsanopoulos
The ``PITHOS_BACKEND_BLOCK_PATH`` option tells to the pithos+ app where to find
852 bdfd94c9 Constantinos Venetsanopoulos
the pithos+ backend data. Above we tell pithos+ to store its data under
853 a96ec00f Constantinos Venetsanopoulos
``/srv/pithos/data``, which is visible by both nodes. We have already setup this
854 a96ec00f Constantinos Venetsanopoulos
directory at node1's "Pithos+ data directory setup" section.
855 a96ec00f Constantinos Venetsanopoulos
856 8f85321e Sofia Papagiannaki
The ``PITHOS_AUTHENTICATION_URL`` option tells to the pithos+ app in which URI
857 bdfd94c9 Constantinos Venetsanopoulos
is available the astakos authentication api. If not set, pithos+ tries to
858 8f85321e Sofia Papagiannaki
authenticate using the ``PITHOS_AUTHENTICATION_USERS`` user pool.
859 8f85321e Sofia Papagiannaki
860 3e6d0710 Constantinos Venetsanopoulos
The ``PITHOS_SERVICE_TOKEN`` should be the Pithos+ token returned by running on
861 3e6d0710 Constantinos Venetsanopoulos
the Astakos node (node1 in our case):
862 3e6d0710 Constantinos Venetsanopoulos
863 3e6d0710 Constantinos Venetsanopoulos
.. code-block:: console
864 3e6d0710 Constantinos Venetsanopoulos
865 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-list
866 3e6d0710 Constantinos Venetsanopoulos
867 3e6d0710 Constantinos Venetsanopoulos
The token has been generated automatically during the :ref:`Pithos+ service
868 3e6d0710 Constantinos Venetsanopoulos
registration <services-reg>`.
869 3e6d0710 Constantinos Venetsanopoulos
870 138253bc Constantinos Venetsanopoulos
Then we need to setup the web UI and connect it to astakos. To do so, edit
871 138253bc Constantinos Venetsanopoulos
``/etc/synnefo/20-snf-pithos-webclient-settings.conf``:
872 138253bc Constantinos Venetsanopoulos
873 138253bc Constantinos Venetsanopoulos
.. code-block:: console
874 138253bc Constantinos Venetsanopoulos
875 138253bc Constantinos Venetsanopoulos
   PITHOS_UI_LOGIN_URL = "https://node1.example.com/im/login?next="
876 02d94254 Sofia Papagiannaki
   PITHOS_UI_FEEDBACK_URL = "https://node2.example.com/feedback"
877 138253bc Constantinos Venetsanopoulos
878 138253bc Constantinos Venetsanopoulos
The ``PITHOS_UI_LOGIN_URL`` option tells the client where to redirect you, if
879 138253bc Constantinos Venetsanopoulos
you are not logged in. The ``PITHOS_UI_FEEDBACK_URL`` option points at the
880 138253bc Constantinos Venetsanopoulos
pithos+ feedback form. Astakos already provides a generic feedback form for all
881 138253bc Constantinos Venetsanopoulos
services, so we use this one.
882 138253bc Constantinos Venetsanopoulos
883 138253bc Constantinos Venetsanopoulos
Then edit ``/etc/synnefo/20-snf-pithos-webclient-cloudbar.conf``, to connect the
884 138253bc Constantinos Venetsanopoulos
pithos+ web UI with the astakos web UI (through the top cloudbar):
885 138253bc Constantinos Venetsanopoulos
886 138253bc Constantinos Venetsanopoulos
.. code-block:: console
887 138253bc Constantinos Venetsanopoulos
888 138253bc Constantinos Venetsanopoulos
   CLOUDBAR_LOCATION = 'https://node1.example.com/static/im/cloudbar/'
889 de20a465 Constantinos Venetsanopoulos
   PITHOS_UI_CLOUDBAR_ACTIVE_SERVICE = '3'
890 138253bc Constantinos Venetsanopoulos
   CLOUDBAR_SERVICES_URL = 'https://node1.example.com/im/get_services'
891 138253bc Constantinos Venetsanopoulos
   CLOUDBAR_MENU_URL = 'https://node1.example.com/im/get_menu'
892 138253bc Constantinos Venetsanopoulos
893 138253bc Constantinos Venetsanopoulos
The ``CLOUDBAR_LOCATION`` tells the client where to find the astakos common
894 138253bc Constantinos Venetsanopoulos
cloudbar.
895 138253bc Constantinos Venetsanopoulos
896 de20a465 Constantinos Venetsanopoulos
The ``PITHOS_UI_CLOUDBAR_ACTIVE_SERVICE`` points to an already registered
897 de20a465 Constantinos Venetsanopoulos
Astakos service. You can see all :ref:`registered services <services-reg>` by
898 de20a465 Constantinos Venetsanopoulos
running on the Astakos node (node1):
899 de20a465 Constantinos Venetsanopoulos
900 de20a465 Constantinos Venetsanopoulos
.. code-block:: console
901 de20a465 Constantinos Venetsanopoulos
902 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-list
903 de20a465 Constantinos Venetsanopoulos
904 de20a465 Constantinos Venetsanopoulos
The value of ``PITHOS_UI_CLOUDBAR_ACTIVE_SERVICE`` should be the pithos service's
905 de20a465 Constantinos Venetsanopoulos
``id`` as shown by the above command, in our case ``3``.
906 138253bc Constantinos Venetsanopoulos
907 138253bc Constantinos Venetsanopoulos
The ``CLOUDBAR_SERVICES_URL`` and ``CLOUDBAR_MENU_URL`` options are used by the
908 138253bc Constantinos Venetsanopoulos
pithos+ web client to get from astakos all the information needed to fill its
909 bdfd94c9 Constantinos Venetsanopoulos
own cloudbar. So we put our astakos deployment urls there.
910 138253bc Constantinos Venetsanopoulos
911 4e3e3d24 Constantinos Venetsanopoulos
Pooling and Greenlets
912 4e3e3d24 Constantinos Venetsanopoulos
---------------------
913 4e3e3d24 Constantinos Venetsanopoulos
914 4e3e3d24 Constantinos Venetsanopoulos
Pithos is pooling-ready without the need of further configuration, because it
915 4e3e3d24 Constantinos Venetsanopoulos
doesn't use a Django DB. It pools HTTP connections to Astakos and pithos
916 4e3e3d24 Constantinos Venetsanopoulos
backend objects for access to the Pithos DB.
917 4e3e3d24 Constantinos Venetsanopoulos
918 576e059b Constantinos Venetsanopoulos
However, as in Astakos, since we are running with Greenlets, it is also
919 576e059b Constantinos Venetsanopoulos
recommended to modify psycopg2 behavior so it works properly in a greenlet
920 576e059b Constantinos Venetsanopoulos
context. This means adding the following lines at the top of your
921 4e3e3d24 Constantinos Venetsanopoulos
``/etc/synnefo/10-snf-webproject-database.conf`` file:
922 4e3e3d24 Constantinos Venetsanopoulos
923 4e3e3d24 Constantinos Venetsanopoulos
.. code-block:: console
924 4e3e3d24 Constantinos Venetsanopoulos
925 4e3e3d24 Constantinos Venetsanopoulos
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
926 4e3e3d24 Constantinos Venetsanopoulos
   make_psycopg_green()
927 4e3e3d24 Constantinos Venetsanopoulos
928 a96ec00f Constantinos Venetsanopoulos
Servers Initialization
929 a96ec00f Constantinos Venetsanopoulos
----------------------
930 a96ec00f Constantinos Venetsanopoulos
931 a96ec00f Constantinos Venetsanopoulos
After configuration is done, we initialize the servers on node2:
932 a96ec00f Constantinos Venetsanopoulos
933 a96ec00f Constantinos Venetsanopoulos
.. code-block:: console
934 a96ec00f Constantinos Venetsanopoulos
935 a96ec00f Constantinos Venetsanopoulos
   root@node2:~ # /etc/init.d/gunicorn restart
936 a96ec00f Constantinos Venetsanopoulos
   root@node2:~ # /etc/init.d/apache2 restart
937 a96ec00f Constantinos Venetsanopoulos
938 a96ec00f Constantinos Venetsanopoulos
You have now finished the Pithos+ setup. Let's test it now.
939 a96ec00f Constantinos Venetsanopoulos
940 a96ec00f Constantinos Venetsanopoulos
941 a96ec00f Constantinos Venetsanopoulos
Testing of Pithos+
942 a96ec00f Constantinos Venetsanopoulos
==================
943 a96ec00f Constantinos Venetsanopoulos
944 bdfd94c9 Constantinos Venetsanopoulos
Open your browser and go to the Astakos homepage:
945 bdfd94c9 Constantinos Venetsanopoulos
946 bdfd94c9 Constantinos Venetsanopoulos
``http://node1.example.com/im``
947 bdfd94c9 Constantinos Venetsanopoulos
948 bdfd94c9 Constantinos Venetsanopoulos
Login, and you will see your profile page. Now, click the "pithos+" link on the
949 bdfd94c9 Constantinos Venetsanopoulos
top black cloudbar. If everything was setup correctly, this will redirect you
950 bdfd94c9 Constantinos Venetsanopoulos
to:
951 bdfd94c9 Constantinos Venetsanopoulos
952 bdfd94c9 Constantinos Venetsanopoulos
``https://node2.example.com/ui``
953 bdfd94c9 Constantinos Venetsanopoulos
954 bdfd94c9 Constantinos Venetsanopoulos
and you will see the blue interface of the Pithos+ application.  Click the
955 bdfd94c9 Constantinos Venetsanopoulos
orange "Upload" button and upload your first file. If the file gets uploaded
956 bdfd94c9 Constantinos Venetsanopoulos
successfully, then this is your first sign of a successful Pithos+ installation.
957 bdfd94c9 Constantinos Venetsanopoulos
Go ahead and experiment with the interface to make sure everything works
958 bdfd94c9 Constantinos Venetsanopoulos
correctly.
959 bdfd94c9 Constantinos Venetsanopoulos
960 bdfd94c9 Constantinos Venetsanopoulos
You can also use the Pithos+ clients to sync data from your Windows PC or MAC.
961 bdfd94c9 Constantinos Venetsanopoulos
962 bdfd94c9 Constantinos Venetsanopoulos
If you don't stumble on any problems, then you have successfully installed
963 bdfd94c9 Constantinos Venetsanopoulos
Pithos+, which you can use as a standalone File Storage Service.
964 bdfd94c9 Constantinos Venetsanopoulos
965 bdfd94c9 Constantinos Venetsanopoulos
If you would like to do more, such as:
966 bdfd94c9 Constantinos Venetsanopoulos
967 bdfd94c9 Constantinos Venetsanopoulos
 * Spawning VMs
968 bdfd94c9 Constantinos Venetsanopoulos
 * Spawning VMs from Images stored on Pithos+
969 bdfd94c9 Constantinos Venetsanopoulos
 * Uploading your custom Images to Pithos+
970 bdfd94c9 Constantinos Venetsanopoulos
 * Spawning VMs from those custom Images
971 bdfd94c9 Constantinos Venetsanopoulos
 * Registering existing Pithos+ files as Images
972 7a8df455 Constantinos Venetsanopoulos
 * Connect VMs to the Internet
973 7a8df455 Constantinos Venetsanopoulos
 * Create Private Networks
974 7a8df455 Constantinos Venetsanopoulos
 * Add VMs to Private Networks
975 bdfd94c9 Constantinos Venetsanopoulos
976 bdfd94c9 Constantinos Venetsanopoulos
please continue with the rest of the guide.
977 a96ec00f Constantinos Venetsanopoulos
978 caa6c07d Constantinos Venetsanopoulos
979 7a8df455 Constantinos Venetsanopoulos
Cyclades (and Plankton) Prerequisites
980 7a8df455 Constantinos Venetsanopoulos
=====================================
981 bc055d09 Constantinos Venetsanopoulos
982 caa6c07d Constantinos Venetsanopoulos
Before proceeding with the Cyclades (and Plankton) installation, make sure you
983 caa6c07d Constantinos Venetsanopoulos
have successfully set up Astakos and Pithos+ first, because Cyclades depends
984 caa6c07d Constantinos Venetsanopoulos
on them. If you don't have a working Astakos and Pithos+ installation yet,
985 caa6c07d Constantinos Venetsanopoulos
please return to the :ref:`top <quick-install-admin-guide>` of this guide.
986 bc055d09 Constantinos Venetsanopoulos
987 caa6c07d Constantinos Venetsanopoulos
Besides Astakos and Pithos+, you will also need a number of additional working
988 caa6c07d Constantinos Venetsanopoulos
prerequisites, before you start the Cyclades installation.
989 bc055d09 Constantinos Venetsanopoulos
990 caa6c07d Constantinos Venetsanopoulos
Ganeti
991 7a8df455 Constantinos Venetsanopoulos
------
992 bc055d09 Constantinos Venetsanopoulos
993 caa6c07d Constantinos Venetsanopoulos
`Ganeti <http://code.google.com/p/ganeti/>`_ handles the low level VM management
994 caa6c07d Constantinos Venetsanopoulos
for Cyclades, so Cyclades requires a working Ganeti installation at the backend.
995 caa6c07d Constantinos Venetsanopoulos
Please refer to the
996 caa6c07d Constantinos Venetsanopoulos
`ganeti documentation <http://docs.ganeti.org/ganeti/2.5/html>`_ for all the
997 bc055d09 Constantinos Venetsanopoulos
gory details. A successful Ganeti installation concludes with a working
998 caa6c07d Constantinos Venetsanopoulos
:ref:`GANETI-MASTER <GANETI_NODES>` and a number of :ref:`GANETI-NODEs
999 caa6c07d Constantinos Venetsanopoulos
<GANETI_NODES>`.
1000 caa6c07d Constantinos Venetsanopoulos
1001 caa6c07d Constantinos Venetsanopoulos
The above Ganeti cluster can run on different physical machines than node1 and
1002 caa6c07d Constantinos Venetsanopoulos
node2 and can scale independently, according to your needs.
1003 caa6c07d Constantinos Venetsanopoulos
1004 caa6c07d Constantinos Venetsanopoulos
For the purpose of this guide, we will assume that the :ref:`GANETI-MASTER
1005 caa6c07d Constantinos Venetsanopoulos
<GANETI_NODES>` runs on node1 and is VM-capable. Also, node2 is a
1006 caa6c07d Constantinos Venetsanopoulos
:ref:`GANETI-NODE <GANETI_NODES>` and is Master-capable and VM-capable too.
1007 caa6c07d Constantinos Venetsanopoulos
1008 caa6c07d Constantinos Venetsanopoulos
We highly recommend that you read the official Ganeti documentation, if you are
1009 576e059b Constantinos Venetsanopoulos
not familiar with Ganeti.
1010 f1f5235e Dimitris Aragiorgis
1011 576e059b Constantinos Venetsanopoulos
Unfortunatelly, the current stable version of the stock Ganeti (v2.6.2) doesn't
1012 576e059b Constantinos Venetsanopoulos
support IP pool management. This feature will be available in Ganeti >= 2.7.
1013 576e059b Constantinos Venetsanopoulos
Synnefo depends on the IP pool functionality of Ganeti, so you have to use
1014 576e059b Constantinos Venetsanopoulos
GRNET provided packages until stable 2.7 is out. To do so:
1015 f1f5235e Dimitris Aragiorgis
1016 f1f5235e Dimitris Aragiorgis
.. code-block:: console
1017 f1f5235e Dimitris Aragiorgis
1018 576e059b Constantinos Venetsanopoulos
   # apt-get install snf-ganeti ganeti-htools
1019 576e059b Constantinos Venetsanopoulos
   # modprobe drbd minor_count=255 usermode_helper=/bin/true
1020 cc16407a Dimitris Aragiorgis
1021 576e059b Constantinos Venetsanopoulos
You should have:
1022 cc16407a Dimitris Aragiorgis
1023 576e059b Constantinos Venetsanopoulos
Ganeti >= 2.6.2+ippool11+hotplug5+extstorage3+rdbfix1+kvmfix2-1
1024 caa6c07d Constantinos Venetsanopoulos
1025 caa6c07d Constantinos Venetsanopoulos
We assume that Ganeti will use the KVM hypervisor. After installing Ganeti on
1026 92e4d1c6 Dimitris Aragiorgis
both nodes, choose a domain name that resolves to a valid floating IP (let's
1027 92e4d1c6 Dimitris Aragiorgis
say it's ``ganeti.node1.example.com``). Make sure node1 and node2 have same
1028 92e4d1c6 Dimitris Aragiorgis
dsa/rsa keys and authorised_keys for password-less root ssh between each other.
1029 92e4d1c6 Dimitris Aragiorgis
If not then skip passing --no-ssh-init but be aware that it will replace
1030 92e4d1c6 Dimitris Aragiorgis
/root/.ssh/* related files and you might lose access to master node. Also,
1031 92e4d1c6 Dimitris Aragiorgis
make sure there is an lvm volume group named ``ganeti`` that will host your
1032 92e4d1c6 Dimitris Aragiorgis
VMs' disks. Finally, setup a bridge interface on the host machines (e.g: br0).
1033 92e4d1c6 Dimitris Aragiorgis
Then run on node1:
1034 caa6c07d Constantinos Venetsanopoulos
1035 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1036 caa6c07d Constantinos Venetsanopoulos
1037 11c16930 Ilias Tsitsimpis
   root@node1:~ # gnt-cluster init --enabled-hypervisors=kvm --no-ssh-init \
1038 11c16930 Ilias Tsitsimpis
                                   --no-etc-hosts --vg-name=ganeti \
1039 11c16930 Ilias Tsitsimpis
                                   --nic-parameters link=br0 --master-netdev eth0 \
1040 caa6c07d Constantinos Venetsanopoulos
                                   ganeti.node1.example.com
1041 caa6c07d Constantinos Venetsanopoulos
   root@node1:~ # gnt-cluster modify --default-iallocator hail
1042 caa6c07d Constantinos Venetsanopoulos
   root@node1:~ # gnt-cluster modify --hypervisor-parameters kvm:kernel_path=
1043 caa6c07d Constantinos Venetsanopoulos
   root@node1:~ # gnt-cluster modify --hypervisor-parameters kvm:vnc_bind_address=0.0.0.0
1044 caa6c07d Constantinos Venetsanopoulos
1045 92e4d1c6 Dimitris Aragiorgis
   root@node1:~ # gnt-node add --no-ssh-key-check --master-capable=yes \
1046 caa6c07d Constantinos Venetsanopoulos
                               --vm-capable=yes node2.example.com
1047 cc16407a Dimitris Aragiorgis
   root@node1:~ # gnt-cluster modify --disk-parameters=drbd:metavg=ganeti
1048 cc16407a Dimitris Aragiorgis
   root@node1:~ # gnt-group modify --disk-parameters=drbd:metavg=ganeti default
1049 caa6c07d Constantinos Venetsanopoulos
1050 caa6c07d Constantinos Venetsanopoulos
For any problems you may stumble upon installing Ganeti, please refer to the
1051 caa6c07d Constantinos Venetsanopoulos
`official documentation <http://docs.ganeti.org/ganeti/2.5/html>`_. Installation
1052 caa6c07d Constantinos Venetsanopoulos
of Ganeti is out of the scope of this guide.
1053 caa6c07d Constantinos Venetsanopoulos
1054 caa6c07d Constantinos Venetsanopoulos
.. _cyclades-install-snfimage:
1055 caa6c07d Constantinos Venetsanopoulos
1056 caa6c07d Constantinos Venetsanopoulos
snf-image
1057 7a8df455 Constantinos Venetsanopoulos
---------
1058 caa6c07d Constantinos Venetsanopoulos
1059 caa6c07d Constantinos Venetsanopoulos
Installation
1060 7a8df455 Constantinos Venetsanopoulos
~~~~~~~~~~~~
1061 caa6c07d Constantinos Venetsanopoulos
For :ref:`Cyclades <cyclades>` to be able to launch VMs from specified Images,
1062 caa6c07d Constantinos Venetsanopoulos
you need the :ref:`snf-image <snf-image>` OS Definition installed on *all*
1063 caa6c07d Constantinos Venetsanopoulos
VM-capable Ganeti nodes. This means we need :ref:`snf-image <snf-image>` on
1064 caa6c07d Constantinos Venetsanopoulos
node1 and node2. You can do this by running on *both* nodes:
1065 caa6c07d Constantinos Venetsanopoulos
1066 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1067 caa6c07d Constantinos Venetsanopoulos
1068 053d0dfc Constantinos Venetsanopoulos
   # apt-get install snf-image-host snf-pithos-backend python-psycopg2
1069 1a37da56 Constantinos Venetsanopoulos
1070 1a37da56 Constantinos Venetsanopoulos
snf-image also needs the `snf-pithos-backend <snf-pithos-backend>`, to be able to
1071 053d0dfc Constantinos Venetsanopoulos
handle image files stored on Pithos+. It also needs `python-psycopg2` to be able
1072 053d0dfc Constantinos Venetsanopoulos
to access the Pithos+ database. This is why, we also install them on *all*
1073 1a37da56 Constantinos Venetsanopoulos
VM-capable Ganeti nodes.
1074 caa6c07d Constantinos Venetsanopoulos
1075 cd837dad Constantinos Venetsanopoulos
After `snf-image-host` has been installed successfully, create the helper VM by
1076 caa6c07d Constantinos Venetsanopoulos
running on *both* nodes:
1077 caa6c07d Constantinos Venetsanopoulos
1078 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1079 caa6c07d Constantinos Venetsanopoulos
1080 caa6c07d Constantinos Venetsanopoulos
   # snf-image-update-helper
1081 caa6c07d Constantinos Venetsanopoulos
1082 caa6c07d Constantinos Venetsanopoulos
This will create all the needed files under ``/var/lib/snf-image/helper/`` for
1083 cd837dad Constantinos Venetsanopoulos
snf-image-host to run successfully, and it may take a few minutes depending on
1084 cd837dad Constantinos Venetsanopoulos
your Internet connection.
1085 caa6c07d Constantinos Venetsanopoulos
1086 caa6c07d Constantinos Venetsanopoulos
Configuration
1087 7a8df455 Constantinos Venetsanopoulos
~~~~~~~~~~~~~
1088 caa6c07d Constantinos Venetsanopoulos
snf-image supports native access to Images stored on Pithos+. This means that
1089 caa6c07d Constantinos Venetsanopoulos
snf-image can talk directly to the Pithos+ backend, without the need of providing
1090 caa6c07d Constantinos Venetsanopoulos
a public URL. More details, are described in the next section. For now, the only
1091 caa6c07d Constantinos Venetsanopoulos
thing we need to do, is configure snf-image to access our Pithos+ backend.
1092 caa6c07d Constantinos Venetsanopoulos
1093 caa6c07d Constantinos Venetsanopoulos
To do this, we need to set the corresponding variables in
1094 caa6c07d Constantinos Venetsanopoulos
``/etc/default/snf-image``, to reflect our Pithos+ setup:
1095 caa6c07d Constantinos Venetsanopoulos
1096 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1097 caa6c07d Constantinos Venetsanopoulos
1098 caa6c07d Constantinos Venetsanopoulos
   PITHOS_DB="postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos"
1099 caa6c07d Constantinos Venetsanopoulos
1100 caa6c07d Constantinos Venetsanopoulos
   PITHOS_DATA="/srv/pithos/data"
1101 caa6c07d Constantinos Venetsanopoulos
1102 caa6c07d Constantinos Venetsanopoulos
If you have installed your Ganeti cluster on different nodes than node1 and node2 make
1103 caa6c07d Constantinos Venetsanopoulos
sure that ``/srv/pithos/data`` is visible by all of them.
1104 caa6c07d Constantinos Venetsanopoulos
1105 caa6c07d Constantinos Venetsanopoulos
If you would like to use Images that are also/only stored locally, you need to
1106 caa6c07d Constantinos Venetsanopoulos
save them under ``IMAGE_DIR``, however this guide targets Images stored only on
1107 caa6c07d Constantinos Venetsanopoulos
Pithos+.
1108 caa6c07d Constantinos Venetsanopoulos
1109 caa6c07d Constantinos Venetsanopoulos
Testing
1110 7a8df455 Constantinos Venetsanopoulos
~~~~~~~
1111 caa6c07d Constantinos Venetsanopoulos
You can test that snf-image is successfully installed by running on the
1112 caa6c07d Constantinos Venetsanopoulos
:ref:`GANETI-MASTER <GANETI_NODES>` (in our case node1):
1113 caa6c07d Constantinos Venetsanopoulos
1114 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1115 caa6c07d Constantinos Venetsanopoulos
1116 caa6c07d Constantinos Venetsanopoulos
   # gnt-os diagnose
1117 caa6c07d Constantinos Venetsanopoulos
1118 caa6c07d Constantinos Venetsanopoulos
This should return ``valid`` for snf-image.
1119 caa6c07d Constantinos Venetsanopoulos
1120 caa6c07d Constantinos Venetsanopoulos
If you are interested to learn more about snf-image's internals (and even use
1121 caa6c07d Constantinos Venetsanopoulos
it alongside Ganeti without Synnefo), please see
1122 caa6c07d Constantinos Venetsanopoulos
`here <https://code.grnet.gr/projects/snf-image/wiki>`_ for information concerning
1123 caa6c07d Constantinos Venetsanopoulos
installation instructions, documentation on the design and implementation, and
1124 caa6c07d Constantinos Venetsanopoulos
supported Image formats.
1125 caa6c07d Constantinos Venetsanopoulos
1126 8a4cd31b Constantinos Venetsanopoulos
.. _snf-image-images:
1127 8a4cd31b Constantinos Venetsanopoulos
1128 cd837dad Constantinos Venetsanopoulos
Actual Images for snf-image
1129 cd837dad Constantinos Venetsanopoulos
---------------------------
1130 caa6c07d Constantinos Venetsanopoulos
1131 caa6c07d Constantinos Venetsanopoulos
Now that snf-image is installed successfully we need to provide it with some
1132 caa6c07d Constantinos Venetsanopoulos
Images. :ref:`snf-image <snf-image>` supports Images stored in ``extdump``,
1133 caa6c07d Constantinos Venetsanopoulos
``ntfsdump`` or ``diskdump`` format. We recommend the use of the ``diskdump``
1134 cd837dad Constantinos Venetsanopoulos
format. For more information about snf-image Image formats see `here
1135 caa6c07d Constantinos Venetsanopoulos
<https://code.grnet.gr/projects/snf-image/wiki/Image_Format>`_.
1136 caa6c07d Constantinos Venetsanopoulos
1137 caa6c07d Constantinos Venetsanopoulos
:ref:`snf-image <snf-image>` also supports three (3) different locations for the
1138 caa6c07d Constantinos Venetsanopoulos
above Images to be stored:
1139 caa6c07d Constantinos Venetsanopoulos
1140 caa6c07d Constantinos Venetsanopoulos
 * Under a local folder (usually an NFS mount, configurable as ``IMAGE_DIR`` in
1141 caa6c07d Constantinos Venetsanopoulos
   :file:`/etc/default/snf-image`)
1142 caa6c07d Constantinos Venetsanopoulos
 * On a remote host (accessible via a public URL e.g: http://... or ftp://...)
1143 caa6c07d Constantinos Venetsanopoulos
 * On Pithos+ (accessible natively, not only by its public URL)
1144 caa6c07d Constantinos Venetsanopoulos
1145 caa6c07d Constantinos Venetsanopoulos
For the purpose of this guide, we will use the `Debian Squeeze Base Image
1146 caa6c07d Constantinos Venetsanopoulos
<https://pithos.okeanos.grnet.gr/public/9epgb>`_ found on the official
1147 caa6c07d Constantinos Venetsanopoulos
`snf-image page
1148 caa6c07d Constantinos Venetsanopoulos
<https://code.grnet.gr/projects/snf-image/wiki#Sample-Images>`_. The image is
1149 caa6c07d Constantinos Venetsanopoulos
of type ``diskdump``. We will store it in our new Pithos+ installation.
1150 caa6c07d Constantinos Venetsanopoulos
1151 caa6c07d Constantinos Venetsanopoulos
To do so, do the following:
1152 caa6c07d Constantinos Venetsanopoulos
1153 caa6c07d Constantinos Venetsanopoulos
a) Download the Image from the official snf-image page (`image link
1154 caa6c07d Constantinos Venetsanopoulos
   <https://pithos.okeanos.grnet.gr/public/9epgb>`_).
1155 caa6c07d Constantinos Venetsanopoulos
1156 caa6c07d Constantinos Venetsanopoulos
b) Upload the Image to your Pithos+ installation, either using the Pithos+ Web UI
1157 caa6c07d Constantinos Venetsanopoulos
   or the command line client `kamaki
1158 caa6c07d Constantinos Venetsanopoulos
   <http://docs.dev.grnet.gr/kamaki/latest/index.html>`_.
1159 caa6c07d Constantinos Venetsanopoulos
1160 caa6c07d Constantinos Venetsanopoulos
Once the Image is uploaded successfully, download the Image's metadata file
1161 caa6c07d Constantinos Venetsanopoulos
from the official snf-image page (`image_metadata link
1162 caa6c07d Constantinos Venetsanopoulos
<https://pithos.okeanos.grnet.gr/public/gwqcv>`_). You will need it, for
1163 caa6c07d Constantinos Venetsanopoulos
spawning a VM from Ganeti, in the next section.
1164 caa6c07d Constantinos Venetsanopoulos
1165 caa6c07d Constantinos Venetsanopoulos
Of course, you can repeat the procedure to upload more Images, available from the
1166 caa6c07d Constantinos Venetsanopoulos
`official snf-image page
1167 caa6c07d Constantinos Venetsanopoulos
<https://code.grnet.gr/projects/snf-image/wiki#Sample-Images>`_.
1168 caa6c07d Constantinos Venetsanopoulos
1169 8a4cd31b Constantinos Venetsanopoulos
.. _ganeti-with-pithos-images:
1170 8a4cd31b Constantinos Venetsanopoulos
1171 caa6c07d Constantinos Venetsanopoulos
Spawning a VM from a Pithos+ Image, using Ganeti
1172 7a8df455 Constantinos Venetsanopoulos
------------------------------------------------
1173 caa6c07d Constantinos Venetsanopoulos
1174 caa6c07d Constantinos Venetsanopoulos
Now, it is time to test our installation so far. So, we have Astakos and
1175 caa6c07d Constantinos Venetsanopoulos
Pithos+ installed, we have a working Ganeti installation, the snf-image
1176 caa6c07d Constantinos Venetsanopoulos
definition installed on all VM-capable nodes and a Debian Squeeze Image on
1177 caa6c07d Constantinos Venetsanopoulos
Pithos+. Make sure you also have the `metadata file
1178 caa6c07d Constantinos Venetsanopoulos
<https://pithos.okeanos.grnet.gr/public/gwqcv>`_ for this image.
1179 caa6c07d Constantinos Venetsanopoulos
1180 caa6c07d Constantinos Venetsanopoulos
Run on the :ref:`GANETI-MASTER's <GANETI_NODES>` (node1) command line:
1181 caa6c07d Constantinos Venetsanopoulos
1182 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1183 caa6c07d Constantinos Venetsanopoulos
1184 cc16407a Dimitris Aragiorgis
   # gnt-instance add -o snf-image+default --os-parameters \
1185 cc16407a Dimitris Aragiorgis
                      img_passwd=my_vm_example_passw0rd,img_format=diskdump,img_id="pithos://user@example.com/pithos/debian_base-6.0-7-x86_64.diskdump",img_properties='{"OSFAMILY":"linux"\,"ROOT_PARTITION":"1"}' \
1186 cc16407a Dimitris Aragiorgis
                      -t plain --disk 0:size=2G --no-name-check --no-ip-check \
1187 caa6c07d Constantinos Venetsanopoulos
                      testvm1
1188 caa6c07d Constantinos Venetsanopoulos
1189 caa6c07d Constantinos Venetsanopoulos
In the above command:
1190 caa6c07d Constantinos Venetsanopoulos
1191 caa6c07d Constantinos Venetsanopoulos
 * ``img_passwd``: the arbitrary root password of your new instance
1192 caa6c07d Constantinos Venetsanopoulos
 * ``img_format``: set to ``diskdump`` to reflect the type of the uploaded Image
1193 caa6c07d Constantinos Venetsanopoulos
 * ``img_id``: If you want to deploy an Image stored on Pithos+ (our case), this
1194 301294a9 Constantinos Venetsanopoulos
               should have the format ``pithos://<username>/<container>/<filename>``:
1195 301294a9 Constantinos Venetsanopoulos
               * ``username``: ``user@example.com`` (defined during Astakos sign up)
1196 301294a9 Constantinos Venetsanopoulos
               * ``container``: ``pithos`` (default, if the Web UI was used)
1197 301294a9 Constantinos Venetsanopoulos
               * ``filename``: the name of file (visible also from the Web UI)
1198 caa6c07d Constantinos Venetsanopoulos
 * ``img_properties``: taken from the metadata file. Used only the two mandatory
1199 caa6c07d Constantinos Venetsanopoulos
                       properties ``OSFAMILY`` and ``ROOT_PARTITION``. `Learn more
1200 caa6c07d Constantinos Venetsanopoulos
                       <https://code.grnet.gr/projects/snf-image/wiki/Image_Format#Image-Properties>`_
1201 caa6c07d Constantinos Venetsanopoulos
1202 caa6c07d Constantinos Venetsanopoulos
If the ``gnt-instance add`` command returns successfully, then run:
1203 caa6c07d Constantinos Venetsanopoulos
1204 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1205 caa6c07d Constantinos Venetsanopoulos
1206 caa6c07d Constantinos Venetsanopoulos
   # gnt-instance info testvm1 | grep "console connection"
1207 caa6c07d Constantinos Venetsanopoulos
1208 caa6c07d Constantinos Venetsanopoulos
to find out where to connect using VNC. If you can connect successfully and can
1209 caa6c07d Constantinos Venetsanopoulos
login to your new instance using the root password ``my_vm_example_passw0rd``,
1210 caa6c07d Constantinos Venetsanopoulos
then everything works as expected and you have your new Debian Base VM up and
1211 caa6c07d Constantinos Venetsanopoulos
running.
1212 caa6c07d Constantinos Venetsanopoulos
1213 caa6c07d Constantinos Venetsanopoulos
If ``gnt-instance add`` fails, make sure that snf-image is correctly configured
1214 caa6c07d Constantinos Venetsanopoulos
to access the Pithos+ database and the Pithos+ backend data. Also, make sure
1215 caa6c07d Constantinos Venetsanopoulos
you gave the correct ``img_id`` and ``img_properties``. If ``gnt-instance add``
1216 caa6c07d Constantinos Venetsanopoulos
succeeds but you cannot connect, again find out what went wrong. Do *NOT*
1217 caa6c07d Constantinos Venetsanopoulos
proceed to the next steps unless you are sure everything works till this point.
1218 caa6c07d Constantinos Venetsanopoulos
1219 2f6143c9 Constantinos Venetsanopoulos
If everything works, you have successfully connected Ganeti with Pithos+. Let's
1220 2f6143c9 Constantinos Venetsanopoulos
move on to networking now.
1221 caa6c07d Constantinos Venetsanopoulos
1222 2f6143c9 Constantinos Venetsanopoulos
.. warning::
1223 e4404297 Christos Stavrakakis
1224 7a8df455 Constantinos Venetsanopoulos
    You can bypass the networking sections and go straight to
1225 2c85833e Constantinos Venetsanopoulos
    :ref:`Cyclades Ganeti tools <cyclades-gtools>`, if you do not want to setup
1226 2c85833e Constantinos Venetsanopoulos
    the Cyclades Network Service, but only the Cyclades Compute Service
1227 2c85833e Constantinos Venetsanopoulos
    (recommended for now).
1228 2f6143c9 Constantinos Venetsanopoulos
1229 cc16407a Dimitris Aragiorgis
Networking Setup Overview
1230 cc16407a Dimitris Aragiorgis
-------------------------
1231 2f6143c9 Constantinos Venetsanopoulos
1232 2f6143c9 Constantinos Venetsanopoulos
This part is deployment-specific and must be customized based on the specific
1233 2f6143c9 Constantinos Venetsanopoulos
needs of the system administrator. However, to do so, the administrator needs
1234 2f6143c9 Constantinos Venetsanopoulos
to understand how each level handles Virtual Networks, to be able to setup the
1235 b11446c1 Constantinos Venetsanopoulos
backend appropriately, before installing Cyclades. To do so, please read the
1236 b11446c1 Constantinos Venetsanopoulos
:ref:`Network <networks>` section before proceeding.
1237 2f6143c9 Constantinos Venetsanopoulos
1238 cc16407a Dimitris Aragiorgis
Since synnefo 0.11 all network actions are managed with the snf-manage
1239 cc16407a Dimitris Aragiorgis
network-* commands. This needs the underlying setup (Ganeti, nfdhcpd,
1240 cc16407a Dimitris Aragiorgis
snf-network, bridges, vlans) to be already configured correctly. The only
1241 cc16407a Dimitris Aragiorgis
actions needed in this point are:
1242 cc16407a Dimitris Aragiorgis
1243 cc16407a Dimitris Aragiorgis
a) Have Ganeti with IP pool management support installed.
1244 2f6143c9 Constantinos Venetsanopoulos
1245 cc16407a Dimitris Aragiorgis
b) Install :ref:`snf-network <snf-network>`, which provides a synnefo specific kvm-ifup script, etc.
1246 2f6143c9 Constantinos Venetsanopoulos
1247 cc16407a Dimitris Aragiorgis
c) Install :ref:`nfdhcpd <nfdhcpd>`, which serves DHCP requests of the VMs.
1248 2f6143c9 Constantinos Venetsanopoulos
1249 cc16407a Dimitris Aragiorgis
In order to test that everything is setup correctly before installing Cyclades,
1250 cc16407a Dimitris Aragiorgis
we will make some testing actions in this section, and the actual setup will be
1251 cc16407a Dimitris Aragiorgis
done afterwards with snf-manage commands.
1252 2f6143c9 Constantinos Venetsanopoulos
1253 cc16407a Dimitris Aragiorgis
.. _snf-network:
1254 2f6143c9 Constantinos Venetsanopoulos
1255 cc16407a Dimitris Aragiorgis
snf-network
1256 cc16407a Dimitris Aragiorgis
~~~~~~~~~~~
1257 2f6143c9 Constantinos Venetsanopoulos
1258 cc16407a Dimitris Aragiorgis
snf-network includes `kvm-vif-bridge` script that is invoked every time
1259 cc16407a Dimitris Aragiorgis
a tap (a VM's NIC) is created. Based on environment variables passed by
1260 cc16407a Dimitris Aragiorgis
Ganeti it issues various commands depending on the network type the NIC is
1261 cc16407a Dimitris Aragiorgis
connected to and sets up a corresponding dhcp lease.
1262 2f6143c9 Constantinos Venetsanopoulos
1263 cc16407a Dimitris Aragiorgis
Install snf-network on all Ganeti nodes:
1264 2f6143c9 Constantinos Venetsanopoulos
1265 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1266 2f6143c9 Constantinos Venetsanopoulos
1267 cc16407a Dimitris Aragiorgis
   # apt-get install snf-network
1268 2f6143c9 Constantinos Venetsanopoulos
1269 cc16407a Dimitris Aragiorgis
Then, in :file:`/etc/default/snf-network` set:
1270 2f6143c9 Constantinos Venetsanopoulos
1271 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1272 2f6143c9 Constantinos Venetsanopoulos
1273 cc16407a Dimitris Aragiorgis
   MAC_MASK=ff:ff:f0:00:00:00
1274 2f6143c9 Constantinos Venetsanopoulos
1275 cc16407a Dimitris Aragiorgis
.. _nfdhcpd:
1276 2f6143c9 Constantinos Venetsanopoulos
1277 cc16407a Dimitris Aragiorgis
nfdhcpd
1278 7a8df455 Constantinos Venetsanopoulos
~~~~~~~
1279 2f6143c9 Constantinos Venetsanopoulos
1280 cc16407a Dimitris Aragiorgis
Each NIC's IP is chosen by Ganeti (with IP pool management support).
1281 cc16407a Dimitris Aragiorgis
`kvm-vif-bridge` script sets up dhcp leases and when the VM boots and
1282 cc16407a Dimitris Aragiorgis
makes a dhcp request, iptables will mangle the packet and `nfdhcpd` will
1283 cc16407a Dimitris Aragiorgis
create a dhcp response.
1284 2f6143c9 Constantinos Venetsanopoulos
1285 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1286 2f6143c9 Constantinos Venetsanopoulos
1287 cc16407a Dimitris Aragiorgis
   # apt-get install nfqueue-bindings-python=0.3+physindev-1
1288 2f6143c9 Constantinos Venetsanopoulos
   # apt-get install nfdhcpd
1289 2f6143c9 Constantinos Venetsanopoulos
1290 2f6143c9 Constantinos Venetsanopoulos
Edit ``/etc/nfdhcpd/nfdhcpd.conf`` to reflect your network configuration. At
1291 2f6143c9 Constantinos Venetsanopoulos
least, set the ``dhcp_queue`` variable to ``42`` and the ``nameservers``
1292 2f6143c9 Constantinos Venetsanopoulos
variable to your DNS IP/s. Those IPs will be passed as the DNS IP/s of your new
1293 2f6143c9 Constantinos Venetsanopoulos
VMs. Once you are finished, restart the server on all nodes:
1294 2f6143c9 Constantinos Venetsanopoulos
1295 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1296 2f6143c9 Constantinos Venetsanopoulos
1297 2f6143c9 Constantinos Venetsanopoulos
   # /etc/init.d/nfdhcpd restart
1298 2f6143c9 Constantinos Venetsanopoulos
1299 2f6143c9 Constantinos Venetsanopoulos
If you are using ``ferm``, then you need to run the following:
1300 2f6143c9 Constantinos Venetsanopoulos
1301 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1302 2f6143c9 Constantinos Venetsanopoulos
1303 2f6143c9 Constantinos Venetsanopoulos
   # echo "@include 'nfdhcpd.ferm';" >> /etc/ferm/ferm.conf
1304 2f6143c9 Constantinos Venetsanopoulos
   # /etc/init.d/ferm restart
1305 2f6143c9 Constantinos Venetsanopoulos
1306 cc16407a Dimitris Aragiorgis
or make sure to run after boot:
1307 cc16407a Dimitris Aragiorgis
1308 cc16407a Dimitris Aragiorgis
.. code-block:: console
1309 cc16407a Dimitris Aragiorgis
1310 cc16407a Dimitris Aragiorgis
   # iptables -t mangle -A PREROUTING -p udp -m udp --dport 67 -j NFQUEUE --queue-num 42
1311 cc16407a Dimitris Aragiorgis
1312 cc16407a Dimitris Aragiorgis
and if you have IPv6 enabled:
1313 cc16407a Dimitris Aragiorgis
1314 cc16407a Dimitris Aragiorgis
.. code-block:: console
1315 cc16407a Dimitris Aragiorgis
1316 cc16407a Dimitris Aragiorgis
   # ip6tables -t mangle -A PREROUTING -p ipv6-icmp -m icmp6 --icmpv6-type 133 -j NFQUEUE --queue-num 43
1317 cc16407a Dimitris Aragiorgis
   # ip6tables -t mangle -A PREROUTING -p ipv6-icmp -m icmp6 --icmpv6-type 135 -j NFQUEUE --queue-num 44
1318 cc16407a Dimitris Aragiorgis
1319 cc16407a Dimitris Aragiorgis
You can check which clients are currently served by nfdhcpd by running:
1320 cc16407a Dimitris Aragiorgis
1321 cc16407a Dimitris Aragiorgis
.. code-block:: console
1322 cc16407a Dimitris Aragiorgis
1323 cc16407a Dimitris Aragiorgis
   # kill -SIGUSR1 `cat /var/run/nfdhcpd/nfdhcpd.pid`
1324 cc16407a Dimitris Aragiorgis
1325 cc16407a Dimitris Aragiorgis
When you run the above, then check ``/var/log/nfdhcpd/nfdhcpd.log``.
1326 cc16407a Dimitris Aragiorgis
1327 cc16407a Dimitris Aragiorgis
Public Network Setup
1328 cc16407a Dimitris Aragiorgis
--------------------
1329 cc16407a Dimitris Aragiorgis
1330 cc16407a Dimitris Aragiorgis
To achieve basic networking the simplest way is to have a common bridge (e.g.
1331 cc16407a Dimitris Aragiorgis
``br0``, on the same collision domain with the router) where all VMs will connect
1332 cc16407a Dimitris Aragiorgis
to. Packets will be "forwarded" to the router and then to the Internet. If
1333 cc16407a Dimitris Aragiorgis
you want a more advanced setup (ip-less routing and proxy-arp plese refer to
1334 cc16407a Dimitris Aragiorgis
:ref:`Network <networks>` section).
1335 cc16407a Dimitris Aragiorgis
1336 cc16407a Dimitris Aragiorgis
Physical Host Setup
1337 cc16407a Dimitris Aragiorgis
~~~~~~~~~~~~~~~~~~~
1338 cc16407a Dimitris Aragiorgis
1339 cc16407a Dimitris Aragiorgis
Assuming ``eth0`` on both hosts is the public interface (directly connected
1340 cc16407a Dimitris Aragiorgis
to the router), run on every node:
1341 2f6143c9 Constantinos Venetsanopoulos
1342 cc16407a Dimitris Aragiorgis
.. code-block:: console
1343 cc16407a Dimitris Aragiorgis
1344 cc16407a Dimitris Aragiorgis
   # brctl addbr br0
1345 cc16407a Dimitris Aragiorgis
   # ip link set br0 up
1346 cc16407a Dimitris Aragiorgis
   # vconfig add eth0 100
1347 cc16407a Dimitris Aragiorgis
   # ip link set eth0.100 up
1348 cc16407a Dimitris Aragiorgis
   # brctl addif br0 eth0.100
1349 cc16407a Dimitris Aragiorgis
1350 cc16407a Dimitris Aragiorgis
1351 cc16407a Dimitris Aragiorgis
Testing a Public Network
1352 cc16407a Dimitris Aragiorgis
~~~~~~~~~~~~~~~~~~~~~~~~
1353 cc16407a Dimitris Aragiorgis
1354 cc16407a Dimitris Aragiorgis
Let's assume, that you want to assign IPs from the ``5.6.7.0/27`` range to you
1355 cc16407a Dimitris Aragiorgis
new VMs, with ``5.6.7.1`` as the router's gateway. In Ganeti you can add the
1356 cc16407a Dimitris Aragiorgis
network by running:
1357 cc16407a Dimitris Aragiorgis
1358 cc16407a Dimitris Aragiorgis
.. code-block:: console
1359 cc16407a Dimitris Aragiorgis
1360 cc16407a Dimitris Aragiorgis
   # gnt-network add --network=5.6.7.0/27 --gateway=5.6.7.1 --network-type=public --tags=nfdhcpd test-net-public
1361 2f6143c9 Constantinos Venetsanopoulos
1362 cc16407a Dimitris Aragiorgis
Then, connect the network to all your nodegroups. We assume that we only have
1363 cc16407a Dimitris Aragiorgis
one nodegroup (``default``) in our Ganeti cluster:
1364 cc16407a Dimitris Aragiorgis
1365 cc16407a Dimitris Aragiorgis
.. code-block:: console
1366 cc16407a Dimitris Aragiorgis
1367 cc16407a Dimitris Aragiorgis
   # gnt-network connect test-net-public default bridged br0
1368 2f6143c9 Constantinos Venetsanopoulos
1369 2f6143c9 Constantinos Venetsanopoulos
Now, it is time to test that the backend infrastracture is correctly setup for
1370 cc16407a Dimitris Aragiorgis
the Public Network. We will add a new VM, the same way we did it on the
1371 cc16407a Dimitris Aragiorgis
previous testing section. However, now will also add one NIC, configured to be
1372 cc16407a Dimitris Aragiorgis
managed from our previously defined network. Run on the GANETI-MASTER (node1):
1373 2f6143c9 Constantinos Venetsanopoulos
1374 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1375 2f6143c9 Constantinos Venetsanopoulos
1376 cc16407a Dimitris Aragiorgis
   # gnt-instance add -o snf-image+default --os-parameters \
1377 cc16407a Dimitris Aragiorgis
                      img_passwd=my_vm_example_passw0rd,img_format=diskdump,img_id="pithos://user@example.com/pithos/debian_base-6.0-7-x86_64.diskdump",img_properties='{"OSFAMILY":"linux"\,"ROOT_PARTITION":"1"}' \
1378 cc16407a Dimitris Aragiorgis
                      -t plain --disk 0:size=2G --no-name-check --no-ip-check \
1379 cc16407a Dimitris Aragiorgis
                      --net 0:ip=pool,network=test-net-public \
1380 2f6143c9 Constantinos Venetsanopoulos
                      testvm2
1381 2f6143c9 Constantinos Venetsanopoulos
1382 2f6143c9 Constantinos Venetsanopoulos
If the above returns successfully, connect to the new VM and run:
1383 2f6143c9 Constantinos Venetsanopoulos
1384 2f6143c9 Constantinos Venetsanopoulos
.. code-block:: console
1385 2f6143c9 Constantinos Venetsanopoulos
1386 cc16407a Dimitris Aragiorgis
   root@testvm2:~ # ip addr
1387 cc16407a Dimitris Aragiorgis
   root@testvm2:~ # ip route
1388 cc16407a Dimitris Aragiorgis
   root@testvm2:~ # cat /etc/resolv.conf
1389 2f6143c9 Constantinos Venetsanopoulos
1390 cc16407a Dimitris Aragiorgis
to check IP address (5.6.7.2), IP routes (default via 5.6.7.1) and DNS config
1391 cc16407a Dimitris Aragiorgis
(nameserver option in nfdhcpd.conf). This shows correct configuration of
1392 cc16407a Dimitris Aragiorgis
ganeti, snf-network and nfdhcpd.
1393 2f6143c9 Constantinos Venetsanopoulos
1394 2f6143c9 Constantinos Venetsanopoulos
Now ping the outside world. If this works too, then you have also configured
1395 cc16407a Dimitris Aragiorgis
correctly your physical host and router.
1396 547c78f6 Constantinos Venetsanopoulos
1397 547c78f6 Constantinos Venetsanopoulos
Make sure everything works as expected, before proceeding with the Private
1398 2f6143c9 Constantinos Venetsanopoulos
Networks setup.
1399 2f6143c9 Constantinos Venetsanopoulos
1400 04c1254b Constantinos Venetsanopoulos
.. _private-networks-setup:
1401 04c1254b Constantinos Venetsanopoulos
1402 cc16407a Dimitris Aragiorgis
Private Networks Setup
1403 7a8df455 Constantinos Venetsanopoulos
----------------------
1404 2f6143c9 Constantinos Venetsanopoulos
1405 cc16407a Dimitris Aragiorgis
Synnefo supports two types of private networks:
1406 cc16407a Dimitris Aragiorgis
1407 cc16407a Dimitris Aragiorgis
 - based on MAC filtering
1408 cc16407a Dimitris Aragiorgis
 - based on physical VLANs
1409 cc16407a Dimitris Aragiorgis
1410 cc16407a Dimitris Aragiorgis
Both types provide Layer 2 isolation to the end-user.
1411 2f6143c9 Constantinos Venetsanopoulos
1412 cc16407a Dimitris Aragiorgis
For the first type a common bridge (e.g. ``prv0``) is needed while for the second a
1413 cc16407a Dimitris Aragiorgis
range of bridges (e.g. ``prv1..prv100``) each bridged on a different physical
1414 cc16407a Dimitris Aragiorgis
VLAN. To this end to assure isolation among end-users' private networks each
1415 cc16407a Dimitris Aragiorgis
has to have different MAC prefix (for the filtering to take place) or to be
1416 cc16407a Dimitris Aragiorgis
"connected" to a different bridge (VLAN actually).
1417 547c78f6 Constantinos Venetsanopoulos
1418 cc16407a Dimitris Aragiorgis
Physical Host Setup
1419 cc16407a Dimitris Aragiorgis
~~~~~~~~~~~~~~~~~~~
1420 cc16407a Dimitris Aragiorgis
1421 cc16407a Dimitris Aragiorgis
In order to create the necessary VLAN/bridges, one for MAC filtered private
1422 cc16407a Dimitris Aragiorgis
networks and various (e.g. 20) for private networks based on physical VLANs,
1423 cc16407a Dimitris Aragiorgis
run on every node:
1424 547c78f6 Constantinos Venetsanopoulos
1425 cc16407a Dimitris Aragiorgis
Assuming ``eth0`` of both hosts are somehow (via cable/switch with VLANs
1426 cc16407a Dimitris Aragiorgis
configured correctly) connected together, run on every node:
1427 547c78f6 Constantinos Venetsanopoulos
1428 547c78f6 Constantinos Venetsanopoulos
.. code-block:: console
1429 547c78f6 Constantinos Venetsanopoulos
1430 cc16407a Dimitris Aragiorgis
   # apt-get install vlan
1431 cc16407a Dimitris Aragiorgis
   # modprobe 8021q
1432 547c78f6 Constantinos Venetsanopoulos
   # $iface=eth0
1433 cc16407a Dimitris Aragiorgis
   # for prv in $(seq 0 20); do
1434 547c78f6 Constantinos Venetsanopoulos
	vlan=$prv
1435 547c78f6 Constantinos Venetsanopoulos
	bridge=prv$prv
1436 547c78f6 Constantinos Venetsanopoulos
	vconfig add $iface $vlan
1437 547c78f6 Constantinos Venetsanopoulos
	ifconfig $iface.$vlan up
1438 547c78f6 Constantinos Venetsanopoulos
	brctl addbr $bridge
1439 547c78f6 Constantinos Venetsanopoulos
	brctl setfd $bridge 0
1440 547c78f6 Constantinos Venetsanopoulos
	brctl addif $bridge $iface.$vlan
1441 547c78f6 Constantinos Venetsanopoulos
	ifconfig $bridge up
1442 547c78f6 Constantinos Venetsanopoulos
      done
1443 547c78f6 Constantinos Venetsanopoulos
1444 cc16407a Dimitris Aragiorgis
The above will do the following :
1445 547c78f6 Constantinos Venetsanopoulos
1446 cc16407a Dimitris Aragiorgis
 * provision 21 new bridges: ``prv0`` - ``prv20``
1447 cc16407a Dimitris Aragiorgis
 * provision 21 new vlans: ``eth0.0`` - ``eth0.20``
1448 cc16407a Dimitris Aragiorgis
 * add the corresponding vlan to the equivalent bridge
1449 547c78f6 Constantinos Venetsanopoulos
1450 547c78f6 Constantinos Venetsanopoulos
You can run ``brctl show`` on both nodes to see if everything was setup
1451 547c78f6 Constantinos Venetsanopoulos
correctly.
1452 547c78f6 Constantinos Venetsanopoulos
1453 2f6143c9 Constantinos Venetsanopoulos
Testing the Private Networks
1454 7a8df455 Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1455 caa6c07d Constantinos Venetsanopoulos
1456 547c78f6 Constantinos Venetsanopoulos
To test the Private Networks, we will create two instances and put them in the
1457 cc16407a Dimitris Aragiorgis
same Private Networks (one MAC Filtered and one Physical VLAN). This means
1458 cc16407a Dimitris Aragiorgis
that the instances will have a second NIC connected to the ``prv0``
1459 cc16407a Dimitris Aragiorgis
pre-provisioned bridge and a third to ``prv1``.
1460 547c78f6 Constantinos Venetsanopoulos
1461 547c78f6 Constantinos Venetsanopoulos
We run the same command as in the Public Network testing section, but with one
1462 547c78f6 Constantinos Venetsanopoulos
more argument for the second NIC:
1463 547c78f6 Constantinos Venetsanopoulos
1464 547c78f6 Constantinos Venetsanopoulos
.. code-block:: console
1465 547c78f6 Constantinos Venetsanopoulos
1466 cc16407a Dimitris Aragiorgis
   # gnt-network add --network=192.168.1.0/24 --mac-prefix=aa:00:55 --network-type=private --tags=nfdhcpd,private-filtered test-net-prv-mac
1467 cc16407a Dimitris Aragiorgis
   # gnt-network connect test-net-prv-mac default bridged prv0
1468 cc16407a Dimitris Aragiorgis
1469 cc16407a Dimitris Aragiorgis
   # gnt-network add --network=10.0.0.0/24 --tags=nfdhcpd --network-type=private test-net-prv-vlan
1470 cc16407a Dimitris Aragiorgis
   # gnt-network connect test-net-prv-vlan default bridged prv1
1471 cc16407a Dimitris Aragiorgis
1472 cc16407a Dimitris Aragiorgis
   # gnt-instance add -o snf-image+default --os-parameters \
1473 cc16407a Dimitris Aragiorgis
                      img_passwd=my_vm_example_passw0rd,img_format=diskdump,img_id="pithos://user@example.com/pithos/debian_base-6.0-7-x86_64.diskdump",img_properties='{"OSFAMILY":"linux"\,"ROOT_PARTITION":"1"}' \
1474 cc16407a Dimitris Aragiorgis
                      -t plain --disk 0:size=2G --no-name-check --no-ip-check \
1475 cc16407a Dimitris Aragiorgis
                      --net 0:ip=pool,network=test-net-public \
1476 cc16407a Dimitris Aragiorgis
                      --net 1:ip=pool,network=test-net-prv-mac \
1477 cc16407a Dimitris Aragiorgis
                      --net 2:ip=none,network=test-net-prv-vlan \
1478 547c78f6 Constantinos Venetsanopoulos
                      testvm3
1479 547c78f6 Constantinos Venetsanopoulos
1480 cc16407a Dimitris Aragiorgis
   # gnt-instance add -o snf-image+default --os-parameters \
1481 cc16407a Dimitris Aragiorgis
                      img_passwd=my_vm_example_passw0rd,img_format=diskdump,img_id="pithos://user@example.com/pithos/debian_base-6.0-7-x86_64.diskdump",img_properties='{"OSFAMILY":"linux"\,"ROOT_PARTITION":"1"}' \
1482 cc16407a Dimitris Aragiorgis
                      -t plain --disk 0:size=2G --no-name-check --no-ip-check \
1483 cc16407a Dimitris Aragiorgis
                      --net 0:ip=pool,network=test-net-public \
1484 cc16407a Dimitris Aragiorgis
                      --net 1:ip=pool,network=test-net-prv-mac \
1485 cc16407a Dimitris Aragiorgis
                      --net 2:ip=none,network=test-net-prv-vlan \
1486 547c78f6 Constantinos Venetsanopoulos
                      testvm4
1487 547c78f6 Constantinos Venetsanopoulos
1488 cc16407a Dimitris Aragiorgis
Above, we create two instances with first NIC connected to the internet, their
1489 cc16407a Dimitris Aragiorgis
second NIC connected to a MAC filtered private Network and their third NIC
1490 cc16407a Dimitris Aragiorgis
connected to the first Physical VLAN Private Network. Now, connect to the
1491 cc16407a Dimitris Aragiorgis
instances using VNC and make sure everything works as expected:
1492 547c78f6 Constantinos Venetsanopoulos
1493 cc16407a Dimitris Aragiorgis
 a) The instances have access to the public internet through their first eth
1494 cc16407a Dimitris Aragiorgis
    interface (``eth0``), which has been automatically assigned a public IP.
1495 547c78f6 Constantinos Venetsanopoulos
1496 cc16407a Dimitris Aragiorgis
 b) ``eth1`` will have mac prefix ``aa:00:55``, while ``eth2`` default one (``aa:00:00``)
1497 547c78f6 Constantinos Venetsanopoulos
1498 cc16407a Dimitris Aragiorgis
 c) ip link set ``eth1``/``eth2`` up
1499 547c78f6 Constantinos Venetsanopoulos
1500 cc16407a Dimitris Aragiorgis
 d) dhclient ``eth1``/``eth2``
1501 547c78f6 Constantinos Venetsanopoulos
1502 cc16407a Dimitris Aragiorgis
 e) On testvm3  ping 192.168.1.2/10.0.0.2
1503 547c78f6 Constantinos Venetsanopoulos
1504 547c78f6 Constantinos Venetsanopoulos
If everything works as expected, then you have finished the Network Setup at the
1505 547c78f6 Constantinos Venetsanopoulos
backend for both types of Networks (Public & Private).
1506 547c78f6 Constantinos Venetsanopoulos
1507 2c85833e Constantinos Venetsanopoulos
.. _cyclades-gtools:
1508 2c85833e Constantinos Venetsanopoulos
1509 2c85833e Constantinos Venetsanopoulos
Cyclades Ganeti tools
1510 2c85833e Constantinos Venetsanopoulos
---------------------
1511 2c85833e Constantinos Venetsanopoulos
1512 2c85833e Constantinos Venetsanopoulos
In order for Ganeti to be connected with Cyclades later on, we need the
1513 2c85833e Constantinos Venetsanopoulos
`Cyclades Ganeti tools` available on all Ganeti nodes (node1 & node2 in our
1514 2c85833e Constantinos Venetsanopoulos
case). You can install them by running in both nodes:
1515 2c85833e Constantinos Venetsanopoulos
1516 2c85833e Constantinos Venetsanopoulos
.. code-block:: console
1517 2c85833e Constantinos Venetsanopoulos
1518 2c85833e Constantinos Venetsanopoulos
   # apt-get install snf-cyclades-gtools
1519 2c85833e Constantinos Venetsanopoulos
1520 2c85833e Constantinos Venetsanopoulos
This will install the following:
1521 2c85833e Constantinos Venetsanopoulos
1522 2c85833e Constantinos Venetsanopoulos
 * ``snf-ganeti-eventd`` (daemon to publish Ganeti related messages on RabbitMQ)
1523 2c85833e Constantinos Venetsanopoulos
 * ``snf-ganeti-hook`` (all necessary hooks under ``/etc/ganeti/hooks``)
1524 2c85833e Constantinos Venetsanopoulos
 * ``snf-progress-monitor`` (used by ``snf-image`` to publish progress messages)
1525 2c85833e Constantinos Venetsanopoulos
1526 2c85833e Constantinos Venetsanopoulos
Configure ``snf-cyclades-gtools``
1527 2c85833e Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1528 2c85833e Constantinos Venetsanopoulos
1529 04c1254b Constantinos Venetsanopoulos
The package will install the ``/etc/synnefo/10-snf-cyclades-gtools-backend.conf``
1530 2c85833e Constantinos Venetsanopoulos
configuration file. At least we need to set the RabbitMQ endpoint for all tools
1531 2c85833e Constantinos Venetsanopoulos
that need it:
1532 2c85833e Constantinos Venetsanopoulos
1533 2c85833e Constantinos Venetsanopoulos
.. code-block:: console
1534 2c85833e Constantinos Venetsanopoulos
1535 ad003186 Constantinos Venetsanopoulos
   AMQP_HOSTS=["amqp://synnefo:example_rabbitmq_passw0rd@node1.example.com:5672"]
1536 2c85833e Constantinos Venetsanopoulos
1537 2c85833e Constantinos Venetsanopoulos
The above variables should reflect your :ref:`Message Queue setup
1538 2c85833e Constantinos Venetsanopoulos
<rabbitmq-setup>`. This file should be editted in all Ganeti nodes.
1539 2c85833e Constantinos Venetsanopoulos
1540 2c85833e Constantinos Venetsanopoulos
Connect ``snf-image`` with ``snf-progress-monitor``
1541 2c85833e Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1542 2c85833e Constantinos Venetsanopoulos
1543 2c85833e Constantinos Venetsanopoulos
Finally, we need to configure ``snf-image`` to publish progress messages during
1544 2c85833e Constantinos Venetsanopoulos
the deployment of each Image. To do this, we edit ``/etc/default/snf-image`` and
1545 2c85833e Constantinos Venetsanopoulos
set the corresponding variable to ``snf-progress-monitor``:
1546 2c85833e Constantinos Venetsanopoulos
1547 2c85833e Constantinos Venetsanopoulos
.. code-block:: console
1548 2c85833e Constantinos Venetsanopoulos
1549 2c85833e Constantinos Venetsanopoulos
   PROGRESS_MONITOR="snf-progress-monitor"
1550 2c85833e Constantinos Venetsanopoulos
1551 2c85833e Constantinos Venetsanopoulos
This file should be editted in all Ganeti nodes.
1552 2c85833e Constantinos Venetsanopoulos
1553 7a8df455 Constantinos Venetsanopoulos
.. _rapi-user:
1554 7a8df455 Constantinos Venetsanopoulos
1555 caa6c07d Constantinos Venetsanopoulos
Synnefo RAPI user
1556 7a8df455 Constantinos Venetsanopoulos
-----------------
1557 caa6c07d Constantinos Venetsanopoulos
1558 7a8df455 Constantinos Venetsanopoulos
As a last step before installing Cyclades, create a new RAPI user that will
1559 caa6c07d Constantinos Venetsanopoulos
have ``write`` access. Cyclades will use this user to issue commands to Ganeti,
1560 2c85833e Constantinos Venetsanopoulos
so we will call the user ``cyclades`` with password ``example_rapi_passw0rd``.
1561 2c85833e Constantinos Venetsanopoulos
You can do this, by first running:
1562 2c85833e Constantinos Venetsanopoulos
1563 2c85833e Constantinos Venetsanopoulos
.. code-block:: console
1564 2c85833e Constantinos Venetsanopoulos
1565 2c85833e Constantinos Venetsanopoulos
   # echo -n 'cyclades:Ganeti Remote API:example_rapi_passw0rd' | openssl md5
1566 2c85833e Constantinos Venetsanopoulos
1567 2c85833e Constantinos Venetsanopoulos
and then putting the output in ``/var/lib/ganeti/rapi/users`` as follows:
1568 caa6c07d Constantinos Venetsanopoulos
1569 caa6c07d Constantinos Venetsanopoulos
.. code-block:: console
1570 caa6c07d Constantinos Venetsanopoulos
1571 2c85833e Constantinos Venetsanopoulos
   cyclades {HA1}55aec7050aa4e4b111ca43cb505a61a0 write
1572 caa6c07d Constantinos Venetsanopoulos
1573 caa6c07d Constantinos Venetsanopoulos
More about Ganeti's RAPI users `here.
1574 caa6c07d Constantinos Venetsanopoulos
<http://docs.ganeti.org/ganeti/2.5/html/rapi.html#introduction>`_
1575 bc055d09 Constantinos Venetsanopoulos
1576 7a8df455 Constantinos Venetsanopoulos
You have now finished with all needed Prerequisites for Cyclades (and
1577 7a8df455 Constantinos Venetsanopoulos
Plankton). Let's move on to the actual Cyclades installation.
1578 7a8df455 Constantinos Venetsanopoulos
1579 7a8df455 Constantinos Venetsanopoulos
1580 7a8df455 Constantinos Venetsanopoulos
Installation of Cyclades (and Plankton) on node1
1581 7a8df455 Constantinos Venetsanopoulos
================================================
1582 7a8df455 Constantinos Venetsanopoulos
1583 7a8df455 Constantinos Venetsanopoulos
This section describes the installation of Cyclades. Cyclades is Synnefo's
1584 7a8df455 Constantinos Venetsanopoulos
Compute service. Plankton (the Image Registry service) will get installed
1585 7a8df455 Constantinos Venetsanopoulos
automatically along with Cyclades, because it is contained in the same Synnefo
1586 7a8df455 Constantinos Venetsanopoulos
component right now.
1587 7a8df455 Constantinos Venetsanopoulos
1588 04c1254b Constantinos Venetsanopoulos
We will install Cyclades (and Plankton) on node1. To do so, we install the
1589 04c1254b Constantinos Venetsanopoulos
corresponding package by running on node1:
1590 04c1254b Constantinos Venetsanopoulos
1591 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1592 04c1254b Constantinos Venetsanopoulos
1593 04c1254b Constantinos Venetsanopoulos
   # apt-get install snf-cyclades-app
1594 04c1254b Constantinos Venetsanopoulos
1595 7d07d924 Constantinos Venetsanopoulos
If all packages install successfully, then Cyclades and Plankton are installed
1596 04c1254b Constantinos Venetsanopoulos
and we proceed with their configuration.
1597 04c1254b Constantinos Venetsanopoulos
1598 bc055d09 Constantinos Venetsanopoulos
1599 a96ec00f Constantinos Venetsanopoulos
Configuration of Cyclades (and Plankton)
1600 a96ec00f Constantinos Venetsanopoulos
========================================
1601 5b6feb88 Vangelis Koukis
1602 04c1254b Constantinos Venetsanopoulos
Conf files
1603 04c1254b Constantinos Venetsanopoulos
----------
1604 bc055d09 Constantinos Venetsanopoulos
1605 04c1254b Constantinos Venetsanopoulos
After installing Cyclades, a number of new configuration files will appear under
1606 04c1254b Constantinos Venetsanopoulos
``/etc/synnefo/`` prefixed with ``20-snf-cyclades-app-``. We will descibe here
1607 04c1254b Constantinos Venetsanopoulos
only the minimal needed changes to result with a working system. In general, sane
1608 04c1254b Constantinos Venetsanopoulos
defaults have been chosen for the most of the options, to cover most of the
1609 04c1254b Constantinos Venetsanopoulos
common scenarios. However, if you want to tweak Cyclades feel free to do so,
1610 04c1254b Constantinos Venetsanopoulos
once you get familiar with the different options.
1611 bc055d09 Constantinos Venetsanopoulos
1612 04c1254b Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-cyclades-app-api.conf``:
1613 bc055d09 Constantinos Venetsanopoulos
1614 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1615 04c1254b Constantinos Venetsanopoulos
1616 bc3a7b5a Constantinos Venetsanopoulos
   ASTAKOS_URL = 'https://node1.example.com/im/authenticate'
1617 04c1254b Constantinos Venetsanopoulos
1618 04c1254b Constantinos Venetsanopoulos
The ``ASTAKOS_URL`` denotes the authentication endpoint for Cyclades and is set
1619 04c1254b Constantinos Venetsanopoulos
to point to Astakos (this should have the same value with Pithos+'s
1620 04c1254b Constantinos Venetsanopoulos
``PITHOS_AUTHENTICATION_URL``, setup :ref:`previously <conf-pithos>`).
1621 04c1254b Constantinos Venetsanopoulos
1622 053d0dfc Constantinos Venetsanopoulos
TODO: Document the Network Options here
1623 04c1254b Constantinos Venetsanopoulos
1624 04c1254b Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-cyclades-app-cloudbar.conf``:
1625 04c1254b Constantinos Venetsanopoulos
1626 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1627 04c1254b Constantinos Venetsanopoulos
1628 bc3a7b5a Constantinos Venetsanopoulos
   CLOUDBAR_LOCATION = 'https://node1.example.com/static/im/cloudbar/'
1629 de20a465 Constantinos Venetsanopoulos
   CLOUDBAR_ACTIVE_SERVICE = '2'
1630 bc3a7b5a Constantinos Venetsanopoulos
   CLOUDBAR_SERVICES_URL = 'https://node1.example.com/im/get_services'
1631 04c1254b Constantinos Venetsanopoulos
   CLOUDBAR_MENU_URL = 'https://account.node1.example.com/im/get_menu'
1632 04c1254b Constantinos Venetsanopoulos
1633 04c1254b Constantinos Venetsanopoulos
``CLOUDBAR_LOCATION`` tells the client where to find the Astakos common
1634 04c1254b Constantinos Venetsanopoulos
cloudbar. The ``CLOUDBAR_SERVICES_URL`` and ``CLOUDBAR_MENU_URL`` options are
1635 04c1254b Constantinos Venetsanopoulos
used by the Cyclades Web UI to get from Astakos all the information needed to
1636 04c1254b Constantinos Venetsanopoulos
fill its own cloudbar. So, we put our Astakos deployment urls there. All the
1637 04c1254b Constantinos Venetsanopoulos
above should have the same values we put in the corresponding variables in
1638 04c1254b Constantinos Venetsanopoulos
``/etc/synnefo/20-snf-pithos-webclient-cloudbar.conf`` on the previous
1639 04c1254b Constantinos Venetsanopoulos
:ref:`Pithos configuration <conf-pithos>` section.
1640 04c1254b Constantinos Venetsanopoulos
1641 de20a465 Constantinos Venetsanopoulos
The ``CLOUDBAR_ACTIVE_SERVICE`` points to an already registered Astakos
1642 de20a465 Constantinos Venetsanopoulos
service. You can see all :ref:`registered services <services-reg>` by running
1643 de20a465 Constantinos Venetsanopoulos
on the Astakos node (node1):
1644 de20a465 Constantinos Venetsanopoulos
1645 de20a465 Constantinos Venetsanopoulos
.. code-block:: console
1646 de20a465 Constantinos Venetsanopoulos
1647 62b10e3f Constantinos Venetsanopoulos
   # snf-manage service-list
1648 de20a465 Constantinos Venetsanopoulos
1649 de20a465 Constantinos Venetsanopoulos
The value of ``CLOUDBAR_ACTIVE_SERVICE`` should be the cyclades service's
1650 de20a465 Constantinos Venetsanopoulos
``id`` as shown by the above command, in our case ``2``.
1651 04c1254b Constantinos Venetsanopoulos
1652 04c1254b Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-cyclades-app-plankton.conf``:
1653 04c1254b Constantinos Venetsanopoulos
1654 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1655 04c1254b Constantinos Venetsanopoulos
1656 04c1254b Constantinos Venetsanopoulos
   BACKEND_DB_CONNECTION = 'postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos'
1657 04c1254b Constantinos Venetsanopoulos
   BACKEND_BLOCK_PATH = '/srv/pithos/data/'
1658 04c1254b Constantinos Venetsanopoulos
1659 04c1254b Constantinos Venetsanopoulos
In this file we configure the Plankton Service. ``BACKEND_DB_CONNECTION``
1660 04c1254b Constantinos Venetsanopoulos
denotes the Pithos+ database (where the Image files are stored). So we set that
1661 04c1254b Constantinos Venetsanopoulos
to point to our Pithos+ database. ``BACKEND_BLOCK_PATH`` denotes the actual
1662 04c1254b Constantinos Venetsanopoulos
Pithos+ data location.
1663 04c1254b Constantinos Venetsanopoulos
1664 04c1254b Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-cyclades-app-queues.conf``:
1665 04c1254b Constantinos Venetsanopoulos
1666 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1667 04c1254b Constantinos Venetsanopoulos
1668 ad003186 Constantinos Venetsanopoulos
   AMQP_HOSTS=["amqp://synnefo:example_rabbitmq_passw0rd@node1.example.com:5672"]
1669 04c1254b Constantinos Venetsanopoulos
1670 04c1254b Constantinos Venetsanopoulos
The above settings denote the Message Queue. Those settings should have the same
1671 04c1254b Constantinos Venetsanopoulos
values as in ``/etc/synnefo/10-snf-cyclades-gtools-backend.conf`` file, and
1672 04c1254b Constantinos Venetsanopoulos
reflect our :ref:`Message Queue setup <rabbitmq-setup>`.
1673 04c1254b Constantinos Venetsanopoulos
1674 04c1254b Constantinos Venetsanopoulos
Edit ``/etc/synnefo/20-snf-cyclades-app-ui.conf``:
1675 04c1254b Constantinos Venetsanopoulos
1676 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1677 04c1254b Constantinos Venetsanopoulos
1678 bc3a7b5a Constantinos Venetsanopoulos
   UI_LOGIN_URL = "https://node1.example.com/im/login"
1679 bc3a7b5a Constantinos Venetsanopoulos
   UI_LOGOUT_URL = "https://node1.example.com/im/logout"
1680 04c1254b Constantinos Venetsanopoulos
1681 04c1254b Constantinos Venetsanopoulos
The ``UI_LOGIN_URL`` option tells the Cyclades Web UI where to redirect users,
1682 04c1254b Constantinos Venetsanopoulos
if they are not logged in. We point that to Astakos.
1683 04c1254b Constantinos Venetsanopoulos
1684 04c1254b Constantinos Venetsanopoulos
The ``UI_LOGOUT_URL`` option tells the Cyclades Web UI where to redirect the
1685 04c1254b Constantinos Venetsanopoulos
user when he/she logs out. We point that to Astakos, too.
1686 04c1254b Constantinos Venetsanopoulos
1687 053d0dfc Constantinos Venetsanopoulos
Edit ``/etc/default/vncauthproxy``:
1688 053d0dfc Constantinos Venetsanopoulos
1689 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1690 053d0dfc Constantinos Venetsanopoulos
1691 053d0dfc Constantinos Venetsanopoulos
   CHUID="www-data:nogroup"
1692 053d0dfc Constantinos Venetsanopoulos
1693 04c1254b Constantinos Venetsanopoulos
We have now finished with the basic Cyclades and Plankton configuration.
1694 04c1254b Constantinos Venetsanopoulos
1695 04c1254b Constantinos Venetsanopoulos
Database Initialization
1696 04c1254b Constantinos Venetsanopoulos
-----------------------
1697 04c1254b Constantinos Venetsanopoulos
1698 04c1254b Constantinos Venetsanopoulos
Once Cyclades is configured, we sync the database:
1699 bc055d09 Constantinos Venetsanopoulos
1700 bc055d09 Constantinos Venetsanopoulos
.. code-block:: console
1701 bc055d09 Constantinos Venetsanopoulos
1702 bc055d09 Constantinos Venetsanopoulos
   $ snf-manage syncdb
1703 bc055d09 Constantinos Venetsanopoulos
   $ snf-manage migrate
1704 bc055d09 Constantinos Venetsanopoulos
1705 04c1254b Constantinos Venetsanopoulos
and load the initial server flavors:
1706 bc055d09 Constantinos Venetsanopoulos
1707 bc055d09 Constantinos Venetsanopoulos
.. code-block:: console
1708 bc055d09 Constantinos Venetsanopoulos
1709 bc055d09 Constantinos Venetsanopoulos
   $ snf-manage loaddata flavors
1710 bc055d09 Constantinos Venetsanopoulos
1711 04c1254b Constantinos Venetsanopoulos
If everything returns successfully, our database is ready.
1712 04c1254b Constantinos Venetsanopoulos
1713 053d0dfc Constantinos Venetsanopoulos
Add the Ganeti backend
1714 053d0dfc Constantinos Venetsanopoulos
----------------------
1715 053d0dfc Constantinos Venetsanopoulos
1716 7a3439cf Constantinos Venetsanopoulos
In our installation we assume that we only have one Ganeti cluster, the one we
1717 b2764de1 Dimitris Aragiorgis
setup earlier.  At this point you have to add this backend (Ganeti cluster) to
1718 b2764de1 Dimitris Aragiorgis
cyclades assuming that you have setup the :ref:`Rapi User <rapi-user>`
1719 b2764de1 Dimitris Aragiorgis
correctly.
1720 b2764de1 Dimitris Aragiorgis
1721 b2764de1 Dimitris Aragiorgis
.. code-block:: console
1722 b2764de1 Dimitris Aragiorgis
1723 69aa7f21 Ilias Tsitsimpis
   $ snf-manage backend-add --clustername=ganeti.node1.example.com --user=cyclades --pass=example_rapi_passw0rd
1724 b2764de1 Dimitris Aragiorgis
1725 b2764de1 Dimitris Aragiorgis
You can see everything has been setup correctly by running:
1726 053d0dfc Constantinos Venetsanopoulos
1727 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1728 053d0dfc Constantinos Venetsanopoulos
1729 053d0dfc Constantinos Venetsanopoulos
   $ snf-manage backend-list
1730 053d0dfc Constantinos Venetsanopoulos
1731 7a3439cf Constantinos Venetsanopoulos
If something is not set correctly, you can modify the backend with the
1732 7a3439cf Constantinos Venetsanopoulos
``snf-manage backend-modify`` command. If something has gone wrong, you could
1733 7a3439cf Constantinos Venetsanopoulos
modify the backend to reflect the Ganeti installation by running:
1734 053d0dfc Constantinos Venetsanopoulos
1735 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1736 053d0dfc Constantinos Venetsanopoulos
1737 053d0dfc Constantinos Venetsanopoulos
   $ snf-manage backend-modify --clustername "ganeti.node1.example.com"
1738 7a3439cf Constantinos Venetsanopoulos
                               --user=cyclades
1739 7a3439cf Constantinos Venetsanopoulos
                               --pass=example_rapi_passw0rd
1740 053d0dfc Constantinos Venetsanopoulos
                               1
1741 053d0dfc Constantinos Venetsanopoulos
1742 053d0dfc Constantinos Venetsanopoulos
``clustername`` denotes the Ganeti-cluster's name. We provide the corresponding
1743 053d0dfc Constantinos Venetsanopoulos
domain that resolves to the master IP, than the IP itself, to ensure Cyclades
1744 053d0dfc Constantinos Venetsanopoulos
can talk to Ganeti even after a Ganeti master-failover.
1745 053d0dfc Constantinos Venetsanopoulos
1746 7a3439cf Constantinos Venetsanopoulos
``user`` and ``pass`` denote the RAPI user's username and the RAPI user's
1747 b2764de1 Dimitris Aragiorgis
password.  Once we setup the first backend to point at our Ganeti cluster, we
1748 b2764de1 Dimitris Aragiorgis
update the Cyclades backends status by running:
1749 053d0dfc Constantinos Venetsanopoulos
1750 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1751 053d0dfc Constantinos Venetsanopoulos
1752 053d0dfc Constantinos Venetsanopoulos
   $ snf-manage backend-update-status
1753 053d0dfc Constantinos Venetsanopoulos
1754 7a3439cf Constantinos Venetsanopoulos
Cyclades can manage multiple Ganeti backends, but for the purpose of this
1755 7a3439cf Constantinos Venetsanopoulos
guide,we won't get into more detail regarding mulitple backends. If you want to
1756 7a3439cf Constantinos Venetsanopoulos
learn more please see /*TODO*/.
1757 7a3439cf Constantinos Venetsanopoulos
1758 7a3439cf Constantinos Venetsanopoulos
Add a Public Network
1759 053d0dfc Constantinos Venetsanopoulos
----------------------
1760 053d0dfc Constantinos Venetsanopoulos
1761 7a3439cf Constantinos Venetsanopoulos
Cyclades supports different Public Networks on different Ganeti backends.
1762 cc16407a Dimitris Aragiorgis
After connecting Cyclades with our Ganeti cluster, we need to setup a Public
1763 cc16407a Dimitris Aragiorgis
Network for this Ganeti backend (`id = 1`). The basic setup is to bridge every
1764 cc16407a Dimitris Aragiorgis
created NIC on a bridge. After having a bridge (e.g. br0) created in every
1765 cc16407a Dimitris Aragiorgis
backend node edit Synnefo setting CUSTOM_BRIDGED_BRIDGE to 'br0':
1766 053d0dfc Constantinos Venetsanopoulos
1767 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1768 053d0dfc Constantinos Venetsanopoulos
1769 69aa7f21 Ilias Tsitsimpis
   $ snf-manage network-create --subnet=5.6.7.0/27 \
1770 69aa7f21 Ilias Tsitsimpis
                               --gateway=5.6.7.1 \
1771 69aa7f21 Ilias Tsitsimpis
                               --subnet6=2001:648:2FFC:1322::/64 \
1772 69aa7f21 Ilias Tsitsimpis
                               --gateway6=2001:648:2FFC:1322::1 \
1773 18e300b2 Christos Stavrakakis
                               --public --dhcp --flavor=CUSTOM \
1774 92e4d1c6 Dimitris Aragiorgis
                               --link=br0 --mode=bridged \
1775 69aa7f21 Ilias Tsitsimpis
                               --name=public_network \
1776 7a3439cf Constantinos Venetsanopoulos
                               --backend-id=1
1777 053d0dfc Constantinos Venetsanopoulos
1778 053d0dfc Constantinos Venetsanopoulos
This will create the Public Network on both Cyclades and the Ganeti backend. To
1779 053d0dfc Constantinos Venetsanopoulos
make sure everything was setup correctly, also run:
1780 053d0dfc Constantinos Venetsanopoulos
1781 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1782 053d0dfc Constantinos Venetsanopoulos
1783 053d0dfc Constantinos Venetsanopoulos
   $ snf-manage reconcile-networks
1784 053d0dfc Constantinos Venetsanopoulos
1785 053d0dfc Constantinos Venetsanopoulos
You can see all available networks by running:
1786 053d0dfc Constantinos Venetsanopoulos
1787 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1788 053d0dfc Constantinos Venetsanopoulos
1789 7a3439cf Constantinos Venetsanopoulos
   $ snf-manage network-list
1790 053d0dfc Constantinos Venetsanopoulos
1791 053d0dfc Constantinos Venetsanopoulos
and inspect each network's state by running:
1792 053d0dfc Constantinos Venetsanopoulos
1793 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1794 053d0dfc Constantinos Venetsanopoulos
1795 053d0dfc Constantinos Venetsanopoulos
   $ snf-manage network-inspect <net_id>
1796 053d0dfc Constantinos Venetsanopoulos
1797 053d0dfc Constantinos Venetsanopoulos
Finally, you can see the networks from the Ganeti perspective by running on the
1798 053d0dfc Constantinos Venetsanopoulos
Ganeti MASTER:
1799 053d0dfc Constantinos Venetsanopoulos
1800 053d0dfc Constantinos Venetsanopoulos
.. code-block:: console
1801 053d0dfc Constantinos Venetsanopoulos
1802 053d0dfc Constantinos Venetsanopoulos
   $ gnt-network list
1803 053d0dfc Constantinos Venetsanopoulos
   $ gnt-network info <network_name>
1804 053d0dfc Constantinos Venetsanopoulos
1805 19425707 Christos Stavrakakis
Create pools for Private Networks
1806 19425707 Christos Stavrakakis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1807 19425707 Christos Stavrakakis
1808 19425707 Christos Stavrakakis
To prevent duplicate assignment of resources to different private networks,
1809 19425707 Christos Stavrakakis
Cyclades supports two types of pools:
1810 19425707 Christos Stavrakakis
1811 19425707 Christos Stavrakakis
 - MAC prefix Pool
1812 19425707 Christos Stavrakakis
 - Bridge Pool
1813 19425707 Christos Stavrakakis
1814 19425707 Christos Stavrakakis
As long as those resourses have been provisioned, admin has to define two
1815 19425707 Christos Stavrakakis
these pools in Synnefo:
1816 19425707 Christos Stavrakakis
1817 19425707 Christos Stavrakakis
1818 19425707 Christos Stavrakakis
.. code-block:: console
1819 19425707 Christos Stavrakakis
1820 19425707 Christos Stavrakakis
   root@testvm1:~ # snf-manage pool-create --type=mac-prefix --base=aa:00:0 --size=65536
1821 19425707 Christos Stavrakakis
1822 19425707 Christos Stavrakakis
   root@testvm1:~ # snf-manage pool-create --type=bridge --base=prv --size=20
1823 19425707 Christos Stavrakakis
1824 19425707 Christos Stavrakakis
Also, change the Synnefo setting in :file:`20-snf-cyclades-app-api.conf`:
1825 19425707 Christos Stavrakakis
1826 19425707 Christos Stavrakakis
.. code-block:: console
1827 19425707 Christos Stavrakakis
1828 18e300b2 Christos Stavrakakis
   DEFAULT_MAC_FILTERED_BRIDGE = 'prv0'
1829 19425707 Christos Stavrakakis
1830 04c1254b Constantinos Venetsanopoulos
Servers restart
1831 04c1254b Constantinos Venetsanopoulos
---------------
1832 04c1254b Constantinos Venetsanopoulos
1833 053d0dfc Constantinos Venetsanopoulos
Restart gunicorn on node1:
1834 04c1254b Constantinos Venetsanopoulos
1835 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1836 bc055d09 Constantinos Venetsanopoulos
1837 04c1254b Constantinos Venetsanopoulos
   # /etc/init.d/gunicorn restart
1838 bc055d09 Constantinos Venetsanopoulos
1839 04c1254b Constantinos Venetsanopoulos
Now let's do the final connections of Cyclades with Ganeti.
1840 bc055d09 Constantinos Venetsanopoulos
1841 04c1254b Constantinos Venetsanopoulos
``snf-dispatcher`` initialization
1842 04c1254b Constantinos Venetsanopoulos
---------------------------------
1843 04c1254b Constantinos Venetsanopoulos
1844 04c1254b Constantinos Venetsanopoulos
``snf-dispatcher`` dispatches all messages published to the Message Queue and
1845 04c1254b Constantinos Venetsanopoulos
manages the Cyclades database accordingly. It also initializes all exchanges. By
1846 04c1254b Constantinos Venetsanopoulos
default it is not enabled during installation of Cyclades, so let's enable it in
1847 04c1254b Constantinos Venetsanopoulos
its configuration file ``/etc/default/snf-dispatcher``:
1848 04c1254b Constantinos Venetsanopoulos
1849 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1850 04c1254b Constantinos Venetsanopoulos
1851 04c1254b Constantinos Venetsanopoulos
   SNF_DSPTCH_ENABLE=true
1852 04c1254b Constantinos Venetsanopoulos
1853 04c1254b Constantinos Venetsanopoulos
and start the daemon:
1854 04c1254b Constantinos Venetsanopoulos
1855 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1856 04c1254b Constantinos Venetsanopoulos
1857 04c1254b Constantinos Venetsanopoulos
   # /etc/init.d/snf-dispatcher start
1858 04c1254b Constantinos Venetsanopoulos
1859 04c1254b Constantinos Venetsanopoulos
You can see that everything works correctly by tailing its log file
1860 04c1254b Constantinos Venetsanopoulos
``/var/log/synnefo/dispatcher.log``.
1861 04c1254b Constantinos Venetsanopoulos
1862 04c1254b Constantinos Venetsanopoulos
``snf-ganeti-eventd`` on GANETI MASTER
1863 04c1254b Constantinos Venetsanopoulos
--------------------------------------
1864 04c1254b Constantinos Venetsanopoulos
1865 04c1254b Constantinos Venetsanopoulos
The last step of the Cyclades setup is enabling the ``snf-ganeti-eventd``
1866 04c1254b Constantinos Venetsanopoulos
daemon (part of the :ref:`Cyclades Ganeti tools <cyclades-gtools>` package).
1867 04c1254b Constantinos Venetsanopoulos
The daemon is already installed on the GANETI MASTER (node1 in our case).
1868 04c1254b Constantinos Venetsanopoulos
``snf-ganeti-eventd`` is disabled by default during the ``snf-cyclades-gtools``
1869 04c1254b Constantinos Venetsanopoulos
installation, so we enable it in its configuration file
1870 04c1254b Constantinos Venetsanopoulos
``/etc/default/snf-ganeti-eventd``:
1871 04c1254b Constantinos Venetsanopoulos
1872 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1873 04c1254b Constantinos Venetsanopoulos
1874 04c1254b Constantinos Venetsanopoulos
   SNF_EVENTD_ENABLE=true
1875 04c1254b Constantinos Venetsanopoulos
1876 04c1254b Constantinos Venetsanopoulos
and start the daemon:
1877 04c1254b Constantinos Venetsanopoulos
1878 04c1254b Constantinos Venetsanopoulos
.. code-block:: console
1879 bc055d09 Constantinos Venetsanopoulos
1880 04c1254b Constantinos Venetsanopoulos
   # /etc/init.d/snf-ganeti-eventd start
1881 bc055d09 Constantinos Venetsanopoulos
1882 04c1254b Constantinos Venetsanopoulos
.. warning:: Make sure you start ``snf-ganeti-eventd`` *ONLY* on GANETI MASTER
1883 bc055d09 Constantinos Venetsanopoulos
1884 04c1254b Constantinos Venetsanopoulos
If all the above return successfully, then you have finished with the Cyclades
1885 04c1254b Constantinos Venetsanopoulos
and Plankton installation and setup. Let's test our installation now.
1886 bc055d09 Constantinos Venetsanopoulos
1887 5b6feb88 Vangelis Koukis
1888 a96ec00f Constantinos Venetsanopoulos
Testing of Cyclades (and Plankton)
1889 a96ec00f Constantinos Venetsanopoulos
==================================
1890 5b6feb88 Vangelis Koukis
1891 8a4cd31b Constantinos Venetsanopoulos
Cyclades Web UI
1892 8a4cd31b Constantinos Venetsanopoulos
---------------
1893 8a4cd31b Constantinos Venetsanopoulos
1894 8a4cd31b Constantinos Venetsanopoulos
First of all we need to test that our Cyclades Web UI works correctly. Open your
1895 8a4cd31b Constantinos Venetsanopoulos
browser and go to the Astakos home page. Login and then click 'cyclades' on the
1896 8a4cd31b Constantinos Venetsanopoulos
top cloud bar. This should redirect you to:
1897 8a4cd31b Constantinos Venetsanopoulos
1898 8a4cd31b Constantinos Venetsanopoulos
 `http://node1.example.com/ui/`
1899 8a4cd31b Constantinos Venetsanopoulos
1900 8a4cd31b Constantinos Venetsanopoulos
and the Cyclades home page should appear. If not, please go back and find what
1901 8a4cd31b Constantinos Venetsanopoulos
went wrong. Do not proceed if you don't see the Cyclades home page.
1902 8a4cd31b Constantinos Venetsanopoulos
1903 8a4cd31b Constantinos Venetsanopoulos
If the Cyclades home page appears, click on the orange button 'New machine'. The
1904 8a4cd31b Constantinos Venetsanopoulos
first step of the 'New machine wizard' will appear. This step shows all the
1905 8a4cd31b Constantinos Venetsanopoulos
available Images from which you can spawn new VMs. The list should be currently
1906 8a4cd31b Constantinos Venetsanopoulos
empty, as we haven't registered any Images yet. Close the wizard and browse the
1907 8a4cd31b Constantinos Venetsanopoulos
interface (not many things to see yet). If everything seems to work, let's
1908 8a4cd31b Constantinos Venetsanopoulos
register our first Image file.
1909 8a4cd31b Constantinos Venetsanopoulos
1910 8a4cd31b Constantinos Venetsanopoulos
Cyclades Images
1911 8a4cd31b Constantinos Venetsanopoulos
---------------
1912 8a4cd31b Constantinos Venetsanopoulos
1913 8a4cd31b Constantinos Venetsanopoulos
To test our Cyclades (and Plankton) installation, we will use an Image stored on
1914 8a4cd31b Constantinos Venetsanopoulos
Pithos+ to spawn a new VM from the Cyclades interface. We will describe all
1915 8a4cd31b Constantinos Venetsanopoulos
steps, even though you may already have uploaded an Image on Pithos+ from a
1916 8a4cd31b Constantinos Venetsanopoulos
:ref:`previous <snf-image-images>` section:
1917 8a4cd31b Constantinos Venetsanopoulos
1918 8a4cd31b Constantinos Venetsanopoulos
 * Upload an Image file to Pithos+
1919 8a4cd31b Constantinos Venetsanopoulos
 * Register that Image file to Plankton
1920 8a4cd31b Constantinos Venetsanopoulos
 * Spawn a new VM from that Image from the Cyclades Web UI
1921 8a4cd31b Constantinos Venetsanopoulos
1922 8a4cd31b Constantinos Venetsanopoulos
We will use the `kamaki <http://docs.dev.grnet.gr/kamaki/latest/index.html>`_
1923 8a4cd31b Constantinos Venetsanopoulos
command line client to do the uploading and registering of the Image.
1924 8a4cd31b Constantinos Venetsanopoulos
1925 8a4cd31b Constantinos Venetsanopoulos
Installation of `kamaki`
1926 8a4cd31b Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~
1927 8a4cd31b Constantinos Venetsanopoulos
1928 8a4cd31b Constantinos Venetsanopoulos
You can install `kamaki` anywhere you like, since it is a standalone client of
1929 8a4cd31b Constantinos Venetsanopoulos
the APIs and talks to the installation over `http`. For the purpose of this
1930 8a4cd31b Constantinos Venetsanopoulos
guide we will assume that we have downloaded the `Debian Squeeze Base Image
1931 8a4cd31b Constantinos Venetsanopoulos
<https://pithos.okeanos.grnet.gr/public/9epgb>`_ and stored it under node1's
1932 8a4cd31b Constantinos Venetsanopoulos
``/srv/images`` directory. For that reason we will install `kamaki` on node1,
1933 8a4cd31b Constantinos Venetsanopoulos
too. We do this by running:
1934 8a4cd31b Constantinos Venetsanopoulos
1935 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
1936 8a4cd31b Constantinos Venetsanopoulos
1937 8a4cd31b Constantinos Venetsanopoulos
   # apt-get install kamaki
1938 8a4cd31b Constantinos Venetsanopoulos
1939 8a4cd31b Constantinos Venetsanopoulos
Configuration of kamaki
1940 8a4cd31b Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~
1941 8a4cd31b Constantinos Venetsanopoulos
1942 8a4cd31b Constantinos Venetsanopoulos
Now we need to setup kamaki, by adding the appropriate URLs and tokens of our
1943 8a4cd31b Constantinos Venetsanopoulos
installation. We do this by running:
1944 8a4cd31b Constantinos Venetsanopoulos
1945 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
1946 8a4cd31b Constantinos Venetsanopoulos
1947 8a4cd31b Constantinos Venetsanopoulos
   $ kamaki config set astakos.url "https://node1.example.com"
1948 69aa7f21 Ilias Tsitsimpis
   $ kamaki config set compute.url "https://node1.example.com/api/v1.1"
1949 69aa7f21 Ilias Tsitsimpis
   $ kamaki config set image.url "https://node1.example.com/plankton"
1950 69aa7f21 Ilias Tsitsimpis
   $ kamaki config set store.url "https://node2.example.com/v1"
1951 69aa7f21 Ilias Tsitsimpis
   $ kamaki config set global.account "user@example.com"
1952 92e4d1c6 Dimitris Aragiorgis
   $ kamaki config set store.enable on
1953 92e4d1c6 Dimitris Aragiorgis
   $ kamaki config set store.pithos_extensions on
1954 92e4d1c6 Dimitris Aragiorgis
   $ kamaki config set store.url "https://node2.example.com/v1"
1955 92e4d1c6 Dimitris Aragiorgis
   $ kamaki config set store.account USER_UUID
1956 92e4d1c6 Dimitris Aragiorgis
   $ kamaki config set global.token USER_TOKEN
1957 8a4cd31b Constantinos Venetsanopoulos
1958 92e4d1c6 Dimitris Aragiorgis
The USER_TOKEN and USER_UUID appear on the user's (``user@example.com``) `Profile` web
1959 92e4d1c6 Dimitris Aragiorgis
page on the Astakos Web UI.
1960 8a4cd31b Constantinos Venetsanopoulos
1961 8a4cd31b Constantinos Venetsanopoulos
You can see that the new configuration options have been applied correctly, by
1962 8a4cd31b Constantinos Venetsanopoulos
running:
1963 8a4cd31b Constantinos Venetsanopoulos
1964 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
1965 8a4cd31b Constantinos Venetsanopoulos
1966 8a4cd31b Constantinos Venetsanopoulos
   $ kamaki config list
1967 8a4cd31b Constantinos Venetsanopoulos
1968 8a4cd31b Constantinos Venetsanopoulos
Upload an Image file to Pithos+
1969 8a4cd31b Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1970 8a4cd31b Constantinos Venetsanopoulos
1971 8a4cd31b Constantinos Venetsanopoulos
Now, that we have set up `kamaki` we will upload the Image that we have
1972 8a4cd31b Constantinos Venetsanopoulos
downloaded and stored under ``/srv/images/``. Although we can upload the Image
1973 8a4cd31b Constantinos Venetsanopoulos
under the root ``Pithos`` container (as you may have done when uploading the
1974 8a4cd31b Constantinos Venetsanopoulos
Image from the Pithos+ Web UI), we will create a new container called ``images``
1975 8a4cd31b Constantinos Venetsanopoulos
and store the Image under that container. We do this for two reasons:
1976 8a4cd31b Constantinos Venetsanopoulos
1977 8a4cd31b Constantinos Venetsanopoulos
a) To demonstrate how to create containers other than the default ``Pithos``.
1978 8a4cd31b Constantinos Venetsanopoulos
   This can be done only with the `kamaki` client and not through the Web UI.
1979 8a4cd31b Constantinos Venetsanopoulos
1980 8a4cd31b Constantinos Venetsanopoulos
b) As a best organization practise, so that you won't have your Image files
1981 8a4cd31b Constantinos Venetsanopoulos
   tangled along with all your other Pithos+ files and directory structures.
1982 8a4cd31b Constantinos Venetsanopoulos
1983 8a4cd31b Constantinos Venetsanopoulos
We create the new ``images`` container by running:
1984 8a4cd31b Constantinos Venetsanopoulos
1985 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
1986 8a4cd31b Constantinos Venetsanopoulos
1987 8a4cd31b Constantinos Venetsanopoulos
   $ kamaki store create images
1988 8a4cd31b Constantinos Venetsanopoulos
1989 8a4cd31b Constantinos Venetsanopoulos
Then, we upload the Image file to that container:
1990 8a4cd31b Constantinos Venetsanopoulos
1991 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
1992 8a4cd31b Constantinos Venetsanopoulos
1993 8a4cd31b Constantinos Venetsanopoulos
   $ kamaki store upload --container images \
1994 8a4cd31b Constantinos Venetsanopoulos
                         /srv/images/debian_base-6.0-7-x86_64.diskdump \
1995 8a4cd31b Constantinos Venetsanopoulos
                         debian_base-6.0-7-x86_64.diskdump
1996 8a4cd31b Constantinos Venetsanopoulos
1997 8a4cd31b Constantinos Venetsanopoulos
The first is the local path and the second is the remote path on Pithos+. If
1998 8a4cd31b Constantinos Venetsanopoulos
the new container and the file appears on the Pithos+ Web UI, then you have
1999 8a4cd31b Constantinos Venetsanopoulos
successfully created the container and uploaded the Image file.
2000 8a4cd31b Constantinos Venetsanopoulos
2001 8a4cd31b Constantinos Venetsanopoulos
Register an existing Image file to Plankton
2002 8a4cd31b Constantinos Venetsanopoulos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2003 8a4cd31b Constantinos Venetsanopoulos
2004 8a4cd31b Constantinos Venetsanopoulos
Once the Image file has been successfully uploaded on Pithos+, then we register
2005 8a4cd31b Constantinos Venetsanopoulos
it to Plankton (so that it becomes visible to Cyclades), by running:
2006 8a4cd31b Constantinos Venetsanopoulos
2007 8a4cd31b Constantinos Venetsanopoulos
.. code-block:: console
2008 8a4cd31b Constantinos Venetsanopoulos
2009 69aa7f21 Ilias Tsitsimpis
   $ kamaki image register "Debian Base" \
2010 92e4d1c6 Dimitris Aragiorgis
                           pithos://USER_UUID/images/debian_base-6.0-7-x86_64.diskdump \
2011 69aa7f21 Ilias Tsitsimpis
                           --public \
2012 69aa7f21 Ilias Tsitsimpis
                           --disk-format=diskdump \
2013 69aa7f21 Ilias Tsitsimpis
                           --property OSFAMILY=linux --property ROOT_PARTITION=1 \
2014 69aa7f21 Ilias Tsitsimpis
                           --property description="Debian Squeeze Base System" \
2015 69aa7f21 Ilias Tsitsimpis
                           --property size=451 --property kernel=2.6.32 --property GUI="No GUI" \
2016 8a4cd31b Constantinos Venetsanopoulos
                           --property sortorder=1 --property USERS=root --property OS=debian
2017 8a4cd31b Constantinos Venetsanopoulos
2018 8a4cd31b Constantinos Venetsanopoulos
This command registers the Pithos+ file
2019 69aa7f21 Ilias Tsitsimpis
``pithos://user@example.com/images/debian_base-6.0-7-x86_64.diskdump`` as an
2020 8a4cd31b Constantinos Venetsanopoulos
Image in Plankton. This Image will be public (``--public``), so all users will
2021 8a4cd31b Constantinos Venetsanopoulos
be able to spawn VMs from it and is of type ``diskdump``. The first two
2022 8a4cd31b Constantinos Venetsanopoulos
properties (``OSFAMILY`` and ``ROOT_PARTITION``) are mandatory. All the rest
2023 8a4cd31b Constantinos Venetsanopoulos
properties are optional, but recommended, so that the Images appear nicely on
2024 8a4cd31b Constantinos Venetsanopoulos
the Cyclades Web UI. ``Debian Base`` will appear as the name of this Image. The
2025 8a4cd31b Constantinos Venetsanopoulos
``OS`` property's valid values may be found in the ``IMAGE_ICONS`` variable
2026 8a4cd31b Constantinos Venetsanopoulos
inside the ``20-snf-cyclades-app-ui.conf`` configuration file.
2027 8a4cd31b Constantinos Venetsanopoulos
2028 8a4cd31b Constantinos Venetsanopoulos
``OSFAMILY`` and ``ROOT_PARTITION`` are mandatory because they will be passed
2029 8a4cd31b Constantinos Venetsanopoulos
from Plankton to Cyclades and then to Ganeti and `snf-image` (also see
2030 8a4cd31b Constantinos Venetsanopoulos
:ref:`previous section <ganeti-with-pithos-images>`). All other properties are
2031 8a4cd31b Constantinos Venetsanopoulos
used to show information on the Cyclades UI.
2032 8a4cd31b Constantinos Venetsanopoulos
2033 8a4cd31b Constantinos Venetsanopoulos
Spawn a VM from the Cyclades Web UI
2034 8a4cd31b Constantinos Venetsanopoulos
-----------------------------------
2035 8a4cd31b Constantinos Venetsanopoulos
2036 8a4cd31b Constantinos Venetsanopoulos
If the registration completes successfully, then go to the Cyclades Web UI from
2037 8a4cd31b Constantinos Venetsanopoulos
your browser at:
2038 8a4cd31b Constantinos Venetsanopoulos
2039 8a4cd31b Constantinos Venetsanopoulos
 `https://node1.example.com/ui/`
2040 8a4cd31b Constantinos Venetsanopoulos
2041 8a4cd31b Constantinos Venetsanopoulos
Click on the 'New Machine' button and the first step of the wizard will appear.
2042 8a4cd31b Constantinos Venetsanopoulos
Click on 'My Images' (right after 'System' Images) on the left pane of the
2043 8a4cd31b Constantinos Venetsanopoulos
wizard. Your previously registered Image "Debian Base" should appear under
2044 8a4cd31b Constantinos Venetsanopoulos
'Available Images'. If not, something has gone wrong with the registration. Make
2045 8a4cd31b Constantinos Venetsanopoulos
sure you can see your Image file on the Pithos+ Web UI and ``kamaki image
2046 8a4cd31b Constantinos Venetsanopoulos
register`` returns successfully with all options and properties as shown above.
2047 8a4cd31b Constantinos Venetsanopoulos
2048 8a4cd31b Constantinos Venetsanopoulos
If the Image appears on the list, select it and complete the wizard by selecting
2049 8a4cd31b Constantinos Venetsanopoulos
a flavor and a name for your VM. Then finish by clicking 'Create'. Make sure you
2050 8a4cd31b Constantinos Venetsanopoulos
write down your password, because you *WON'T* be able to retrieve it later.
2051 8a4cd31b Constantinos Venetsanopoulos
2052 8a4cd31b Constantinos Venetsanopoulos
If everything was setup correctly, after a few minutes your new machine will go
2053 8a4cd31b Constantinos Venetsanopoulos
to state 'Running' and you will be able to use it. Click 'Console' to connect
2054 8a4cd31b Constantinos Venetsanopoulos
through VNC out of band, or click on the machine's icon to connect directly via
2055 8a4cd31b Constantinos Venetsanopoulos
SSH or RDP (for windows machines).
2056 8a4cd31b Constantinos Venetsanopoulos
2057 8a4cd31b Constantinos Venetsanopoulos
Congratulations. You have successfully installed the whole Synnefo stack and
2058 8a4cd31b Constantinos Venetsanopoulos
connected all components. Go ahead in the next section to test the Network
2059 8a4cd31b Constantinos Venetsanopoulos
functionality from inside Cyclades and discover even more features.
2060 8a4cd31b Constantinos Venetsanopoulos
2061 5b6feb88 Vangelis Koukis
2062 a96ec00f Constantinos Venetsanopoulos
General Testing
2063 a96ec00f Constantinos Venetsanopoulos
===============
2064 5b6feb88 Vangelis Koukis
2065 5b6feb88 Vangelis Koukis
2066 a96ec00f Constantinos Venetsanopoulos
Notes
2067 a96ec00f Constantinos Venetsanopoulos
=====