Statistics
| Branch: | Tag: | Revision:

root / README.deploy @ 93677203

History | View | Annotate | Download (15.7 kB)

1
README.deploy -- Instructions for a basic deployment of Synnefo v0.4
2

    
3
This document describes the basic steps to obtain a basic, working Synnefo
4
deployment. It begins by examining the different node roles, then moves to the
5
installation and setup of distinct software components.
6

    
7
It applies to Synnefo v0.4.
8

    
9

    
10
Node types
11
===========
12

    
13
Nodes in a Synnefo deployment belong in one of the following types:
14

    
15
 * DB:
16
   A node [or more than one nodes, if using an HA configuration],
17
   running a DB engine supported by the Django ORM layer. The DB
18
   is the single source of truth for the servicing of API requests by
19
   Synnefo.
20
   Services: PostgreSQL / MySQL
21

    
22
 * APISERVER:
23
   A node running the implementation of the OpenStack API, in Django.
24
   Any number of APISERVERs can be used, in a load-balancing configuration,
25
   without any special consideration. Access to a common DB ensures
26
   consistency.
27
   Services: Web server, vncauthproxy
28

    
29
 * QUEUE:
30
   A node running the RabbitMQ software, which provides AMQP functionality.
31
   More than one QUEUE nodes may be deployed, in an HA configuration. Such
32
   deployments require shared storage, provided e.g., by DRBD.
33
   Services: RabbitMQ [rabbitmq-server]
34

    
35
 * LOGIC:
36
   A node running the business logic of Synnefo, in Django. It dequeues
37
   messages from QUEUE nodes, and provides the context in which business
38
   logic functions run. It uses Django ORM to connect to the common DB and
39
   update the state of the system, based on notifications received from the
40
   rest of the infrastructure, over AMQP.
41
   Services: the Synnefo logic dispatcher [/logic/dispatcher.py]
42

    
43
 * GANETI-MASTER and GANETI-NODE:
44
   A single GANETI-MASTER and a large number of GANETI-NODEs constitute the
45
   Ganeti backend for Synnefo, which undertakes all VM management functions.
46
   Any APISERVER can issue commands to the GANETI-MASTER, over RAPI, to effect
47
   changes in the state of the VMs. The GANETI-MASTER runs the Ganeti request
48
   queue.
49
   Services:
50
   only on GANETI-MASTER:
51
     the Synnefo Ganeti monitoring daemon [/ganeti/ganeti-eventd],
52
     and the Synnefo Ganeti hook [/ganeti/snf-ganeti-hook.py].
53
   on each GANETI_NODE:
54
     a deployment-specific KVM ifup script
55
     properly configured NFDHCPD
56

    
57

    
58
Installation Process
59
=====================
60

    
61
This section describes the installation process of the various node roles
62
in a Synnefo deployment.
63

    
64

    
65
0. Allocation of physical nodes:
66
   Determine the role of every physical node in your deployment.
67

    
68

    
69
1. Ganeti installation:
70
   Synnefo requires a working Ganeti installation at the backend. Installation
71
   of Ganeti is not covered by this document, please refer to
72
   http://docs.ganeti.org/ganeti/current/html for all the gory details. A
73
   successful Ganeti installation concludes with a working GANETI-MASTER and a
74
   number of GANETI-NODEs.
75

    
76

    
77
2. RabbitMQ installation:
78
   RabbitMQ is used as a generic message broker for the system. It should
79
   be installed on two seperate QUEUE nodes (VMs should be enough for the
80
   moment) in a high availability configuration as described here:
81

    
82
     http://www.rabbitmq.com/pacemaker.html
83

    
84
   After installation, create a user and set its permissions
85
     rabbitmqctl add_user okeanos 0k3@n0s
86
     rabbitmqctl set_permissions -p / okeanos  "^.*" ".*" ".*"
87

    
88
   The values set for the user and password must be mirrored in the
89
   RABBIT_* variables in settings.py (see step 6)
90

    
91

    
92
3. Web server installation:
93
   A Web Server (e.g., Apache) needs to be installed on the APISERVERs,
94
   and be configured to run the Synnefo Django project appropriately.
95
   Selection and configuration of a Web server is outside the scope of this
96
   document.
97

    
98
   For testing or development purposes, Django's own development server,
99
   ./manage.py runserver can be used.
100

    
101

    
102
4. Installation of the Synnefo Django project:
103
   As of v0.4, the Synnefo Django project needs to be installed on nodes
104
   of type APISERVER, LOGIC and on the GANETI-MASTER, with a properly configured
105
   settings.py. In later revisions, the specific parts of the Django project
106
   which need to run on each node type will be identified.
107

    
108
   Synnefo is written in Python 2.6 and depends on the following Python
109
   modules: [package versions confirmed to be compatible are in braces]
110

    
111
    * django 1.2 [Django==1.2.4]
112
    * simplejson [simplejson==2.1.3]
113
    * pycurl [pycurl==7.19.0]
114
    * python-dateutil  [python-dateutil==1.4.1]
115
      WARNING: version python-dateutil==2.0 downloaded by pip known *not* to work
116
               with Python 2.6
117
    * south [south==0.7.1]
118
      WARNING: not working with Debian squeeze's default south-0.7-1 package.
119
    * amqplib [amqplib==0.6.1]
120

    
121
   also, depending on the database engine of choice, on one of the following:
122
    * MySQL-python [MySQL-python==1.2.3]
123
    * psycopg2 [psycopg2==2.4]
124

    
125
   if the invitations application is deployed, the following
126
   dependencies should be installed:
127

    
128
    * pycrypto==2.1.0
129

    
130
   if you want to test the ganeti (FIXME)
131

    
132
   to run the user interface tests, selenium must be installed
133
    * selenium [?]
134

    
135
   The easiest method for installation of the Django project is to setup a
136
   working environment through virtualenv. Alternatively, you can use your
137
   system's package manager to install the dependencies (e.g. Macports has them
138
   all).
139

    
140
   * On Snow Leopard and linux (64-bit), you have to set the following environment
141
     variable for pip to compile the dependencies correctly.
142

    
143
  	   $ export ARCHFLAGS="-arch x86_64"
144

    
145
   * On Ubuntu, a few more packages must be installed before installing the
146
     prerequisite Python libraries
147

    
148
	   $ sudo aptitude install libcurl3-gnutls libcurl3-gnutls-dev uuid-dev
149

    
150
   Checkout the code and install the Python prerequisites. This assumes
151
   that python is already installed on the host.
152

    
153
    $ sudo easy_install virtualenv
154
    $ git clone https://user@code.grnet.gr/git/synnefo synnefo
155
    $ virtualenv --python=python2.6 synnefo --no-site-packages
156
    ...
157
    $ cd synnefo
158
    $ ./bin/pip install <list_of_dependencies>
159

    
160

    
161
5. Database installation:
162
   A database supported by the Django ORM layer must be installed on nodes
163
   of type DB. The choices are: SQLIte, MySQL, PostgreSQL.
164

    
165
   * SQLite:
166
     The python sqlite driver is available by default with Python so no additional
167
     configuration is required. Also, most self-respecting systems have the sqlite
168
     library installed by default.
169

    
170
   *  MySQL:
171
      MySQL must be installed first:
172

    
173
      * Ubuntu - Debian
174
	      $ sudo apt-get install libmysqlclient-dev
175

    
176
      * MacPorts
177
	      $ sudo port install mysql5
178

    
179
      Install the MySQL python library on servers running the Django project:
180

    
181
	    $ bin/pip install MySQL-python
182

    
183
      Note: On MacOSX with Mysql install from MacPorts the above command will fail
184
      complaining that it cannot find the mysql_config command. Do the following and
185
      restart the installation
186
	    $ echo "mysql_config = /opt/local/bin/mysql_config5" >> ./build/MySQL-python/site.cfg
187

    
188
      Configure a MySQL db/account for synnefo
189
	    $ mysql -u root -p
190

    
191
    	mysql> create database synnefo;
192
	    mysql> show databases;
193
	    mysql> GRANT ALL on synnefo.* TO username IDENTIFIED BY 'password';
194

    
195
   * PostgreSQL
196
     You need to install the PostgreSQL binaries:
197
     * Ubuntu - Debian
198
	     $ sudo apt-get install postgresql-8.4 libpq-dev
199

    
200
     * MacPorts
201
	     $ sudo port install postgresql84
202

    
203
     Install the postgres Python library
204
	    $ bin/pip install psycopg2
205

    
206
     Configure a postgres db/account for synnefo:
207

    
208
     Become the postgres user, connect to PostgreSQL:
209
       $ sudo su - postgres
210
       $ psql
211
	
212
	 Run the following commands:
213
	   DROP DATABASE synnefo;
214
	   DROP USER username;
215
	   CREATE USER username WITH PASSWORD 'password';
216
	   CREATE DATABASE synnefo;
217
	   GRANT ALL PRIVILEGES ON DATABASE synnefo TO username;
218
	   ALTER DATABASE synnefo OWNER TO username;
219
	   ALTER USER username CREATEDB;
220

    
221
     The last line enables the newly created user to create own databases. This is
222
     needed for Django to create and drop the test_synnefo database for unit
223
     testing.
224

    
225

    
226
6. Setting up the Django project:
227
   The settings.py file for Django may be derived by concatenating the
228
   settings.py.dist file contained in the Synnefo distribution with a file
229
   containing custom modifications, which shall override all settings deviating
230
   from the supplied settings.py.dist. This is recommended to minimize the load
231
   of reconstructing settings.py from scratch, since each release currently
232
   brings heavy changes to settings.py.dist.
233

    
234
   Add the following to your custom settings.py, depending on your choice of DB:
235
   * SQLite
236

    
237
	 PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
238

    
239
	 DATABASES = {
240
	     'default': {
241
		     'ENGINE': 'django.db.backends.sqlite3',
242
		     'NAME': PROJECT_PATH + 'synnefo.db' #WARN: This must be an absolute path
243
	     }
244
	 }
245

    
246
   * MySQL
247

    
248
 	 DATABASES = {
249
	     'default': {
250
             'ENGINE': 'django.db.backends.mysql',
251
             'NAME': 'synnefo',
252
             'USER': 'USERNAME',
253
             'PASSWORD': 'PASSWORD',
254
             'HOST': 'HOST',
255
             'PORT': 'PORT',
256
             'OPTIONS': {
257
                 'init_command': 'SET storage_engine=INNODB',
258
             }
259
	    }
260
	}
261

    
262
   * PostgreSQL
263

    
264
     DATABASES = {
265
	     'default': {
266
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
267
             'NAME': 'DATABASE',
268
             'USER': 'USERNAME',
269
             'PASSWORD': 'PASSWORD',
270
             'HOST': 'HOST',
271
             'PORT': 'PORT',
272
	     }
273
     }
274

    
275
    Try it out. The following command will attempt to connect to the DB and
276
    print out DDL statements. It should not fail.
277

    
278
	$ ./bin/python manage.py sql db
279

    
280

    
281
7. Initialization of Synnefo DB:
282
   You need to initialize the Synnefo DB and load fixtures
283
   db/fixtures/{flavors,images}.json, which make the API usable by end users by
284
   defining a sample set of hardware configurations (flavors) and OS images.
285

    
286
     $ ./bin/python manage.py syncdb
287
     $ ./bin/python manage.py migrate db
288
     $ ./bin/python manage.py loaddata db/fixtures/flavors.json
289
     $ ./bin/python manage.py loaddata db/fixtures/images.json
290

    
291

    
292
8. Finalization of settings.py:
293
   Set the BACKEND_PREFIX_ID variable to some unique prefix, e.g. your commit
294
   username in settings.py. Several functional conventions within the system
295
   require this variable to include a dash at its end (e.g. snf-)
296

    
297
   Fix the AMQP-specific settings based on the selected BACKEND_PREFIX_ID.
298
   The fix_amqp_settings() function is called once at the end of
299
   settings.py.dist, you must call it again if you change BACKEND_PREFIX_ID
300
   at some later point.
301

    
302

    
303
9. Installation of the Ganeti monitoring daemon, /ganeti/ganeti-eventd:
304
   The Ganeti monitoring daemon is part of the Django project and must run on
305
   GANETI-MASTER.
306

    
307
   Override all relevant settings in settings.py.dist, GANETI_* variables.
308
   Then start the server on the Ganeti master as root
309

    
310
     # cd synnefo && python ./ganeti/ganeti-eventd
311

    
312
   FIXME: The server must be started from the project root directory.
313
   TBD: how to handle master migration.
314

    
315

    
316
10. Installation of the Synnefo dispatcher, /logic/dispatcher.py:
317
    The logic dispatcher is part of the Synnefo Django project and must run
318
    on LOGIC nodes.
319

    
320
    The dispatcher retrieves messages from the queue and calls the
321
    appropriate handler function as defined in the queue configuration in
322
    setttings.py. The default configuration should work directly without
323
    any modifications.
324

    
325
    For the time being The dispatcher must be run by hand:
326
      $ ./bin/python ./logic/dispatcher.py
327

    
328
    The dispatcher should run in at least 2 instances to ensure high
329
    (actually, increased) availability.
330

    
331

    
332
11. Installation of the Synnefo Ganeti hook:
333
    The Python script ganeti/snf-ganeti-hook.py is the generic launcher for
334
    Synnefo hooks in Ganeti.  It resides in the ganeti/ directory under the root
335
    of Synnefo Django project root.
336

    
337
    The hook needs to be enabled for phases
338
    post-{add,modify,reboot,start,stop} by *symlinking*
339
    in  /etc/ganeti/hooks/instance-{add,modify,reboot,start,stop}-post.d
340
    on GANETI-MASTER, e.g.:
341

    
342
    root@ganeti-master:/etc/ganeti/hooks/instance-start-post.d# ls -l
343
    lrwxrwxrwx 1 root root 45 May   3 13:45 00-snf-ganeti-hook -> /home/devel/synnefo/ganeti/snf-ganeti-hook.py*
344

    
345
    IMPORTANT: The link name may only contain "upper and lower case, digits,
346
    underscores and hyphens. In other words, the regexp ^[a-zA-Z0-9_-]+$."
347
    See http://docs.ganeti.org/ganeti/master/html/hooks.html?highlight=hooks#naming.
348

    
349
    The script uses the location of the link target to determine the Synnefo
350
    Project root, before passing control to the relevant Python code.
351

    
352
    FIXME: Perhaps require a SYNNEFO_PROJECT_ROOT environment variable?
353

    
354

    
355
12. Installation of the VNC authentication proxy, vncauthproxy:
356
    To support OOB console access to the VMs over VNC, the vncauthproxy
357
    daemon must be running on every node of type APISERVER.
358

    
359
    Download and install vncauthproxy from its own repository,
360
    at https://code.grnet.gr/git/vncauthproxy (known good commit: 8799ab6d6e).
361

    
362
    Edit default settings on top of vncauthproxy.py.
363
    Set CTRL_SOCKET in util/vapclient.py to point to its control socket.
364

    
365
    FIXME: The CTRL_SOCKET setting will be moved to settings.py as
366
    VNCAUTHPROXY_CTRL_SOCKET.
367

    
368
    Create /var/log/vncauthproxy and set its permissions appropriately.
369

    
370

    
371
13. Installation of the customized Ganeti Instance Image for image deployment:
372
    For Synnefo to be able to launch VMs from specified Images, you need
373
    the gnt-instance-image OS Provider installed on the Ganeti backend.
374

    
375
    Download and install gnt-instance-image in all Ganeti nodes from its own
376
    repository, at https://code.grnet.gr/git/gnt-instance-image.
377

    
378
    After installing gnt-instance-image do the following:
379
    1. root@ganeti-master:/path-to-repo# cp ./defaults /etc/default/ganeti-instance-image
380
    2. Uncomment the following in /etc/default/ganeti-instance-image:
381
       SWAP=no
382
       ARCH="x86_64"
383
    3. Add to /etc/default/ganeti-instance-image (so that make-dump makes no /boot partition):
384
       KERNEL_PATH="True"
385
    4. Change the path in make-dump line 22 according to your installation
386
       (/usr/share/ganeti/os/image/common.sh --> /srv/ganeti/os/image/common.sh)
387
    5. In common.sh, comment out the KERNEL_PATH variable initialization.
388
       (#KERNEL_PATH="$INSTANCE_HV_kernel_path")
389
    6. In /etc/ganeti/instance-image/hooks, make sure the hooks you want to
390
       run during instance creation process have execute permission. At least
391
       `grub' and `root_passwd' should be triggered to make the instance
392
       usable:
393
         chmod +x /etc/ganeti/instance-image/hooks/{grub,root_passwd}
394

    
395
    Your Custom Images should be stored in a dump format under /var/cache/ganeti-instance-image
396
    and their filenames should have the following format:
397
      {backend_id}-x86_64-root.dump
398
    e.g., debian-6.0.1a-x86_64-root.dump (backend_id = "debian-6.0.1a")
399

    
400

    
401
14. Setup Synnefo-specific networking on the Ganeti backend:
402
    This part is deployment-specific and must be customized based on the
403
    specific needs of the system administrators.
404

    
405
    A reference installation will use a Synnefo-specific KVM ifup script,
406
    NFDHCPD and pre-provisioned Linux bridges to support public and private
407
    network functionality. For this:
408

    
409
    Grab NFDHCPD from its own repository (https://code.grnet.gr/git/nfdhcpd),
410
    install it, modify /etc/nfdhcpd/nfdhcpd.conf to reflect your network
411
    configuration.
412

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

    
418

    
419
15. Create log file directories for Synnefo components, set appropriate
420
    permissions. By default, logic/dispatcher.py and ganeti/ganeti-eventd.py
421
    use /var/log/synnefo.
422

    
423

    
424
16. (Hopefully) Done
425