Statistics
| Branch: | Tag: | Revision:

root / README.deploy @ e381d2ba

History | View | Annotate | Download (15.8 kB)

1 03353341 Vangelis Koukis
README.deploy -- Instructions for a basic deployment of Synnefo v0.4
2 bbd4f788 Georgios Gousios
3 03353341 Vangelis Koukis
This document describes the basic steps to obtain a basic, working Synnefo
4 03353341 Vangelis Koukis
deployment. It begins by examining the different node roles, then moves to the
5 03353341 Vangelis Koukis
installation and setup of distinct software components.
6 c807557e Vangelis Koukis
7 03353341 Vangelis Koukis
It applies to Synnefo v0.4.
8 03353341 Vangelis Koukis
9 03353341 Vangelis Koukis
10 03353341 Vangelis Koukis
Node types
11 03353341 Vangelis Koukis
===========
12 03353341 Vangelis Koukis
13 03353341 Vangelis Koukis
Nodes in a Synnefo deployment belong in one of the following types:
14 03353341 Vangelis Koukis
15 03353341 Vangelis Koukis
 * DB:
16 03353341 Vangelis Koukis
   A node [or more than one nodes, if using an HA configuration],
17 03353341 Vangelis Koukis
   running a DB engine supported by the Django ORM layer. The DB
18 03353341 Vangelis Koukis
   is the single source of truth for the servicing of API requests by
19 03353341 Vangelis Koukis
   Synnefo.
20 03353341 Vangelis Koukis
   Services: PostgreSQL / MySQL
21 03353341 Vangelis Koukis
22 03353341 Vangelis Koukis
 * APISERVER:
23 03353341 Vangelis Koukis
   A node running the implementation of the OpenStack API, in Django.
24 03353341 Vangelis Koukis
   Any number of APISERVERs can be used, in a load-balancing configuration,
25 03353341 Vangelis Koukis
   without any special consideration. Access to a common DB ensures
26 03353341 Vangelis Koukis
   consistency.
27 03353341 Vangelis Koukis
   Services: Web server, vncauthproxy
28 03353341 Vangelis Koukis
29 03353341 Vangelis Koukis
 * QUEUE:
30 03353341 Vangelis Koukis
   A node running the RabbitMQ software, which provides AMQP functionality.
31 03353341 Vangelis Koukis
   More than one QUEUE nodes may be deployed, in an HA configuration. Such
32 03353341 Vangelis Koukis
   deployments require shared storage, provided e.g., by DRBD.
33 03353341 Vangelis Koukis
   Services: RabbitMQ [rabbitmq-server]
34 03353341 Vangelis Koukis
35 03353341 Vangelis Koukis
 * LOGIC:
36 03353341 Vangelis Koukis
   A node running the business logic of Synnefo, in Django. It dequeues
37 03353341 Vangelis Koukis
   messages from QUEUE nodes, and provides the context in which business
38 03353341 Vangelis Koukis
   logic functions run. It uses Django ORM to connect to the common DB and
39 03353341 Vangelis Koukis
   update the state of the system, based on notifications received from the
40 03353341 Vangelis Koukis
   rest of the infrastructure, over AMQP.
41 03353341 Vangelis Koukis
   Services: the Synnefo logic dispatcher [/logic/dispatcher.py]
42 03353341 Vangelis Koukis
43 03353341 Vangelis Koukis
 * GANETI-MASTER and GANETI-NODE:
44 03353341 Vangelis Koukis
   A single GANETI-MASTER and a large number of GANETI-NODEs constitute the
45 03353341 Vangelis Koukis
   Ganeti backend for Synnefo, which undertakes all VM management functions.
46 03353341 Vangelis Koukis
   Any APISERVER can issue commands to the GANETI-MASTER, over RAPI, to effect
47 03353341 Vangelis Koukis
   changes in the state of the VMs. The GANETI-MASTER runs the Ganeti request
48 03353341 Vangelis Koukis
   queue.
49 03353341 Vangelis Koukis
   Services:
50 03353341 Vangelis Koukis
   only on GANETI-MASTER:
51 36cf1973 Vangelis Koukis
     the Synnefo Ganeti monitoring daemon [/ganeti/snf-ganeti-eventd],
52 03353341 Vangelis Koukis
     and the Synnefo Ganeti hook [/ganeti/snf-ganeti-hook.py].
53 03353341 Vangelis Koukis
   on each GANETI_NODE:
54 03353341 Vangelis Koukis
     a deployment-specific KVM ifup script
55 03353341 Vangelis Koukis
     properly configured NFDHCPD
56 03353341 Vangelis Koukis
57 03353341 Vangelis Koukis
58 03353341 Vangelis Koukis
Installation Process
59 03353341 Vangelis Koukis
=====================
60 03353341 Vangelis Koukis
61 03353341 Vangelis Koukis
This section describes the installation process of the various node roles
62 03353341 Vangelis Koukis
in a Synnefo deployment.
63 03353341 Vangelis Koukis
64 03353341 Vangelis Koukis
65 03353341 Vangelis Koukis
0. Allocation of physical nodes:
66 03353341 Vangelis Koukis
   Determine the role of every physical node in your deployment.
67 03353341 Vangelis Koukis
68 03353341 Vangelis Koukis
69 03353341 Vangelis Koukis
1. Ganeti installation:
70 03353341 Vangelis Koukis
   Synnefo requires a working Ganeti installation at the backend. Installation
71 03353341 Vangelis Koukis
   of Ganeti is not covered by this document, please refer to
72 03353341 Vangelis Koukis
   http://docs.ganeti.org/ganeti/current/html for all the gory details. A
73 03353341 Vangelis Koukis
   successful Ganeti installation concludes with a working GANETI-MASTER and a
74 03353341 Vangelis Koukis
   number of GANETI-NODEs.
75 03353341 Vangelis Koukis
76 03353341 Vangelis Koukis
77 03353341 Vangelis Koukis
2. RabbitMQ installation:
78 03353341 Vangelis Koukis
   RabbitMQ is used as a generic message broker for the system. It should
79 03353341 Vangelis Koukis
   be installed on two seperate QUEUE nodes (VMs should be enough for the
80 03353341 Vangelis Koukis
   moment) in a high availability configuration as described here:
81 03353341 Vangelis Koukis
82 03353341 Vangelis Koukis
     http://www.rabbitmq.com/pacemaker.html
83 03353341 Vangelis Koukis
84 03353341 Vangelis Koukis
   After installation, create a user and set its permissions
85 03353341 Vangelis Koukis
     rabbitmqctl add_user okeanos 0k3@n0s
86 03353341 Vangelis Koukis
     rabbitmqctl set_permissions -p / okeanos  "^.*" ".*" ".*"
87 03353341 Vangelis Koukis
88 03353341 Vangelis Koukis
   The values set for the user and password must be mirrored in the
89 03353341 Vangelis Koukis
   RABBIT_* variables in settings.py (see step 6)
90 03353341 Vangelis Koukis
91 03353341 Vangelis Koukis
92 03353341 Vangelis Koukis
3. Web server installation:
93 03353341 Vangelis Koukis
   A Web Server (e.g., Apache) needs to be installed on the APISERVERs,
94 03353341 Vangelis Koukis
   and be configured to run the Synnefo Django project appropriately.
95 03353341 Vangelis Koukis
   Selection and configuration of a Web server is outside the scope of this
96 03353341 Vangelis Koukis
   document.
97 03353341 Vangelis Koukis
98 03353341 Vangelis Koukis
   For testing or development purposes, Django's own development server,
99 03353341 Vangelis Koukis
   ./manage.py runserver can be used.
100 03353341 Vangelis Koukis
101 03353341 Vangelis Koukis
102 03353341 Vangelis Koukis
4. Installation of the Synnefo Django project:
103 03353341 Vangelis Koukis
   As of v0.4, the Synnefo Django project needs to be installed on nodes
104 36cf1973 Vangelis Koukis
   of type APISERVER, LOGIC and on the GANETI-MASTER, with a properly
105 36cf1973 Vangelis Koukis
   configured settings.py. In later revisions, the specific parts of the Django
106 36cf1973 Vangelis Koukis
   project which need to run on each node type will be identified.
107 03353341 Vangelis Koukis
108 03353341 Vangelis Koukis
   Synnefo is written in Python 2.6 and depends on the following Python
109 03353341 Vangelis Koukis
   modules: [package versions confirmed to be compatible are in braces]
110 c807557e Vangelis Koukis
111 c807557e Vangelis Koukis
    * django 1.2 [Django==1.2.4]
112 c807557e Vangelis Koukis
    * simplejson [simplejson==2.1.3]
113 c807557e Vangelis Koukis
    * pycurl [pycurl==7.19.0]
114 c807557e Vangelis Koukis
    * python-dateutil  [python-dateutil==1.4.1]
115 36cf1973 Vangelis Koukis
      WARNING: version python-dateutil==2.0 downloaded by pip known *not* to
116 36cf1973 Vangelis Koukis
               work with Python 2.6
117 e381d2ba Vangelis Koukis
    * python-ipy [IPy==0.72]
118 c807557e Vangelis Koukis
    * south [south==0.7.1]
119 c807557e Vangelis Koukis
      WARNING: not working with Debian squeeze's default south-0.7-1 package.
120 c807557e Vangelis Koukis
    * amqplib [amqplib==0.6.1]
121 03353341 Vangelis Koukis
122 03353341 Vangelis Koukis
   also, depending on the database engine of choice, on one of the following:
123 c807557e Vangelis Koukis
    * MySQL-python [MySQL-python==1.2.3]
124 c807557e Vangelis Koukis
    * psycopg2 [psycopg2==2.4]
125 03353341 Vangelis Koukis
126 03353341 Vangelis Koukis
   if the invitations application is deployed, the following
127 03353341 Vangelis Koukis
   dependencies should be installed:
128 03353341 Vangelis Koukis
129 c807557e Vangelis Koukis
    * pycrypto==2.1.0
130 03353341 Vangelis Koukis
131 e381d2ba Vangelis Koukis
   To run the user interface tests, selenium must be installed
132 c807557e Vangelis Koukis
    * selenium [?]
133 c807557e Vangelis Koukis
134 03353341 Vangelis Koukis
   The easiest method for installation of the Django project is to setup a
135 03353341 Vangelis Koukis
   working environment through virtualenv. Alternatively, you can use your
136 03353341 Vangelis Koukis
   system's package manager to install the dependencies (e.g. Macports has them
137 03353341 Vangelis Koukis
   all).
138 a06deab3 Vangelis Koukis
139 36cf1973 Vangelis Koukis
   * On Snow Leopard and linux (64-bit), you have to set the following
140 36cf1973 Vangelis Koukis
     environment variable for pip to compile the dependencies correctly.
141 a06deab3 Vangelis Koukis
142 03353341 Vangelis Koukis
  	   $ export ARCHFLAGS="-arch x86_64"
143 a06deab3 Vangelis Koukis
144 03353341 Vangelis Koukis
   * On Ubuntu, a few more packages must be installed before installing the
145 03353341 Vangelis Koukis
     prerequisite Python libraries
146 a06deab3 Vangelis Koukis
147 03353341 Vangelis Koukis
	   $ sudo aptitude install libcurl3-gnutls libcurl3-gnutls-dev uuid-dev
148 a06deab3 Vangelis Koukis
149 03353341 Vangelis Koukis
   Checkout the code and install the Python prerequisites. This assumes
150 03353341 Vangelis Koukis
   that python is already installed on the host.
151 a06deab3 Vangelis Koukis
152 03353341 Vangelis Koukis
    $ sudo easy_install virtualenv
153 03353341 Vangelis Koukis
    $ git clone https://user@code.grnet.gr/git/synnefo synnefo
154 03353341 Vangelis Koukis
    $ virtualenv --python=python2.6 synnefo --no-site-packages
155 03353341 Vangelis Koukis
    ...
156 03353341 Vangelis Koukis
    $ cd synnefo
157 03353341 Vangelis Koukis
    $ ./bin/pip install <list_of_dependencies>
158 fc2afa67 Vangelis Koukis
159 a06deab3 Vangelis Koukis
160 03353341 Vangelis Koukis
5. Database installation:
161 03353341 Vangelis Koukis
   A database supported by the Django ORM layer must be installed on nodes
162 03353341 Vangelis Koukis
   of type DB. The choices are: SQLIte, MySQL, PostgreSQL.
163 a06deab3 Vangelis Koukis
164 03353341 Vangelis Koukis
   * SQLite:
165 36cf1973 Vangelis Koukis
     The python sqlite driver is available by default with Python so no
166 36cf1973 Vangelis Koukis
     additional configuration is required. Also, most self-respecting systems
167 36cf1973 Vangelis Koukis
     have the sqlite library installed by default.
168 03353341 Vangelis Koukis
169 03353341 Vangelis Koukis
   *  MySQL:
170 03353341 Vangelis Koukis
      MySQL must be installed first:
171 03353341 Vangelis Koukis
172 03353341 Vangelis Koukis
      * Ubuntu - Debian
173 03353341 Vangelis Koukis
	      $ sudo apt-get install libmysqlclient-dev
174 03353341 Vangelis Koukis
175 03353341 Vangelis Koukis
      * MacPorts
176 03353341 Vangelis Koukis
	      $ sudo port install mysql5
177 03353341 Vangelis Koukis
178 03353341 Vangelis Koukis
      Install the MySQL python library on servers running the Django project:
179 a06deab3 Vangelis Koukis
180 03353341 Vangelis Koukis
	    $ bin/pip install MySQL-python
181 a06deab3 Vangelis Koukis
182 36cf1973 Vangelis Koukis
      Note: On MacOSX with Mysql install from MacPorts the above command will
183 36cf1973 Vangelis Koukis
      fail complaining that it cannot find the mysql_config command. Do the
184 36cf1973 Vangelis Koukis
      following and restart the installation
185 03353341 Vangelis Koukis
	    $ echo "mysql_config = /opt/local/bin/mysql_config5" >> ./build/MySQL-python/site.cfg
186 7e8b41e7 Vangelis Koukis
187 03353341 Vangelis Koukis
      Configure a MySQL db/account for synnefo
188 03353341 Vangelis Koukis
	    $ mysql -u root -p
189 a06deab3 Vangelis Koukis
190 03353341 Vangelis Koukis
    	mysql> create database synnefo;
191 03353341 Vangelis Koukis
	    mysql> show databases;
192 03353341 Vangelis Koukis
	    mysql> GRANT ALL on synnefo.* TO username IDENTIFIED BY 'password';
193 fc2afa67 Vangelis Koukis
194 03353341 Vangelis Koukis
   * PostgreSQL
195 03353341 Vangelis Koukis
     You need to install the PostgreSQL binaries:
196 03353341 Vangelis Koukis
     * Ubuntu - Debian
197 03353341 Vangelis Koukis
	     $ sudo apt-get install postgresql-8.4 libpq-dev
198 fc2afa67 Vangelis Koukis
199 03353341 Vangelis Koukis
     * MacPorts
200 03353341 Vangelis Koukis
	     $ sudo port install postgresql84
201 6ec8927b Vangelis Koukis
202 03353341 Vangelis Koukis
     Install the postgres Python library
203 03353341 Vangelis Koukis
	    $ bin/pip install psycopg2
204 6f339260 Georgios Gousios
205 03353341 Vangelis Koukis
     Configure a postgres db/account for synnefo:
206 6f339260 Georgios Gousios
207 03353341 Vangelis Koukis
     Become the postgres user, connect to PostgreSQL:
208 03353341 Vangelis Koukis
       $ sudo su - postgres
209 03353341 Vangelis Koukis
       $ psql
210 03353341 Vangelis Koukis
	
211 03353341 Vangelis Koukis
	 Run the following commands:
212 03353341 Vangelis Koukis
	   DROP DATABASE synnefo;
213 03353341 Vangelis Koukis
	   DROP USER username;
214 03353341 Vangelis Koukis
	   CREATE USER username WITH PASSWORD 'password';
215 03353341 Vangelis Koukis
	   CREATE DATABASE synnefo;
216 03353341 Vangelis Koukis
	   GRANT ALL PRIVILEGES ON DATABASE synnefo TO username;
217 03353341 Vangelis Koukis
	   ALTER DATABASE synnefo OWNER TO username;
218 03353341 Vangelis Koukis
	   ALTER USER username CREATEDB;
219 6f339260 Georgios Gousios
220 36cf1973 Vangelis Koukis
     The last line enables the newly created user to create own databases. This
221 36cf1973 Vangelis Koukis
     is needed for Django to create and drop the test_synnefo database for unit
222 03353341 Vangelis Koukis
     testing.
223 6f339260 Georgios Gousios
224 6f339260 Georgios Gousios
225 03353341 Vangelis Koukis
6. Setting up the Django project:
226 03353341 Vangelis Koukis
   The settings.py file for Django may be derived by concatenating the
227 03353341 Vangelis Koukis
   settings.py.dist file contained in the Synnefo distribution with a file
228 03353341 Vangelis Koukis
   containing custom modifications, which shall override all settings deviating
229 03353341 Vangelis Koukis
   from the supplied settings.py.dist. This is recommended to minimize the load
230 03353341 Vangelis Koukis
   of reconstructing settings.py from scratch, since each release currently
231 03353341 Vangelis Koukis
   brings heavy changes to settings.py.dist.
232 7e8b41e7 Vangelis Koukis
233 36cf1973 Vangelis Koukis
   Add the following to your custom settings.py, depending on your choice
234 36cf1973 Vangelis Koukis
   of DB:
235 03353341 Vangelis Koukis
   * SQLite
236 7e8b41e7 Vangelis Koukis
237 03353341 Vangelis Koukis
	 PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
238 7e8b41e7 Vangelis Koukis
239 03353341 Vangelis Koukis
	 DATABASES = {
240 03353341 Vangelis Koukis
	     'default': {
241 03353341 Vangelis Koukis
		     'ENGINE': 'django.db.backends.sqlite3',
242 36cf1973 Vangelis Koukis
		     'NAME': PROJECT_PATH + 'synnefo.db' # WARN: This must be an absolute path
243 03353341 Vangelis Koukis
	     }
244 03353341 Vangelis Koukis
	 }
245 7e8b41e7 Vangelis Koukis
246 03353341 Vangelis Koukis
   * MySQL
247 7e8b41e7 Vangelis Koukis
248 03353341 Vangelis Koukis
 	 DATABASES = {
249 03353341 Vangelis Koukis
	     'default': {
250 03353341 Vangelis Koukis
             'ENGINE': 'django.db.backends.mysql',
251 03353341 Vangelis Koukis
             'NAME': 'synnefo',
252 03353341 Vangelis Koukis
             'USER': 'USERNAME',
253 03353341 Vangelis Koukis
             'PASSWORD': 'PASSWORD',
254 03353341 Vangelis Koukis
             'HOST': 'HOST',
255 03353341 Vangelis Koukis
             'PORT': 'PORT',
256 03353341 Vangelis Koukis
             'OPTIONS': {
257 03353341 Vangelis Koukis
                 'init_command': 'SET storage_engine=INNODB',
258 03353341 Vangelis Koukis
             }
259 03353341 Vangelis Koukis
	    }
260 03353341 Vangelis Koukis
	}
261 7e8b41e7 Vangelis Koukis
262 03353341 Vangelis Koukis
   * PostgreSQL
263 6f339260 Georgios Gousios
264 03353341 Vangelis Koukis
     DATABASES = {
265 03353341 Vangelis Koukis
	     'default': {
266 03353341 Vangelis Koukis
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
267 03353341 Vangelis Koukis
             'NAME': 'DATABASE',
268 03353341 Vangelis Koukis
             'USER': 'USERNAME',
269 03353341 Vangelis Koukis
             'PASSWORD': 'PASSWORD',
270 03353341 Vangelis Koukis
             'HOST': 'HOST',
271 03353341 Vangelis Koukis
             'PORT': 'PORT',
272 03353341 Vangelis Koukis
	     }
273 03353341 Vangelis Koukis
     }
274 7e8b41e7 Vangelis Koukis
275 03353341 Vangelis Koukis
    Try it out. The following command will attempt to connect to the DB and
276 03353341 Vangelis Koukis
    print out DDL statements. It should not fail.
277 7e8b41e7 Vangelis Koukis
278 03353341 Vangelis Koukis
	$ ./bin/python manage.py sql db
279 6ec8927b Vangelis Koukis
280 6ec8927b Vangelis Koukis
281 03353341 Vangelis Koukis
7. Initialization of Synnefo DB:
282 03353341 Vangelis Koukis
   You need to initialize the Synnefo DB and load fixtures
283 03353341 Vangelis Koukis
   db/fixtures/{flavors,images}.json, which make the API usable by end users by
284 03353341 Vangelis Koukis
   defining a sample set of hardware configurations (flavors) and OS images.
285 03353341 Vangelis Koukis
286 03353341 Vangelis Koukis
     $ ./bin/python manage.py syncdb
287 03353341 Vangelis Koukis
     $ ./bin/python manage.py migrate db
288 03353341 Vangelis Koukis
     $ ./bin/python manage.py loaddata db/fixtures/flavors.json
289 03353341 Vangelis Koukis
     $ ./bin/python manage.py loaddata db/fixtures/images.json
290 03353341 Vangelis Koukis
291 03353341 Vangelis Koukis
292 03353341 Vangelis Koukis
8. Finalization of settings.py:
293 03353341 Vangelis Koukis
   Set the BACKEND_PREFIX_ID variable to some unique prefix, e.g. your commit
294 03353341 Vangelis Koukis
   username in settings.py. Several functional conventions within the system
295 03353341 Vangelis Koukis
   require this variable to include a dash at its end (e.g. snf-)
296 03353341 Vangelis Koukis
297 03353341 Vangelis Koukis
   Fix the AMQP-specific settings based on the selected BACKEND_PREFIX_ID.
298 03353341 Vangelis Koukis
   The fix_amqp_settings() function is called once at the end of
299 03353341 Vangelis Koukis
   settings.py.dist, you must call it again if you change BACKEND_PREFIX_ID
300 03353341 Vangelis Koukis
   at some later point.
301 03353341 Vangelis Koukis
302 03353341 Vangelis Koukis
303 36cf1973 Vangelis Koukis
9. Installation of the Ganeti monitoring daemon, /ganeti/snf-ganeti-eventd:
304 36cf1973 Vangelis Koukis
   The Ganeti monitoring daemon must run on GANETI-MASTER.
305 36cf1973 Vangelis Koukis
   The Ganeti monitoring daemon has no dependency on Django.
306 36cf1973 Vangelis Koukis
   
307 36cf1973 Vangelis Koukis
   Override all relevant settings in settings.d/99-snf-ganeti-eventd.conf,
308 36cf1973 Vangelis Koukis
   GANETI_* variables.
309 36cf1973 Vangelis Koukis
   Then, make sure PYTHONPATH contains the parent of the Django project,
310 36cf1973 Vangelis Koukis
   and start the server on the Ganeti master as root.
311 03353341 Vangelis Koukis
312 36cf1973 Vangelis Koukis
     root:~# export PYTHONPATH=$PYTHONPATH:/opt
313 36cf1973 Vangelis Koukis
     root:~# /opt/synnefo/ganeti/snf-ganeti-eventd.py
314 03353341 Vangelis Koukis
315 03353341 Vangelis Koukis
   TBD: how to handle master migration.
316 03353341 Vangelis Koukis
317 6ec8927b Vangelis Koukis
318 03353341 Vangelis Koukis
10. Installation of the Synnefo dispatcher, /logic/dispatcher.py:
319 03353341 Vangelis Koukis
    The logic dispatcher is part of the Synnefo Django project and must run
320 03353341 Vangelis Koukis
    on LOGIC nodes.
321 ff55193e Vangelis Koukis
322 03353341 Vangelis Koukis
    The dispatcher retrieves messages from the queue and calls the
323 03353341 Vangelis Koukis
    appropriate handler function as defined in the queue configuration in
324 03353341 Vangelis Koukis
    setttings.py. The default configuration should work directly without
325 03353341 Vangelis Koukis
    any modifications.
326 6ec8927b Vangelis Koukis
327 03353341 Vangelis Koukis
    For the time being The dispatcher must be run by hand:
328 03353341 Vangelis Koukis
      $ ./bin/python ./logic/dispatcher.py
329 6ec8927b Vangelis Koukis
330 03353341 Vangelis Koukis
    The dispatcher should run in at least 2 instances to ensure high
331 03353341 Vangelis Koukis
    (actually, increased) availability.
332 6ec8927b Vangelis Koukis
333 7e8b41e7 Vangelis Koukis
334 03353341 Vangelis Koukis
11. Installation of the Synnefo Ganeti hook:
335 0bb376ce Vangelis Koukis
    The bash wrapper ganeti/snf-ganeti-hook is the generic launcher for
336 0bb376ce Vangelis Koukis
    Synnefo hooks in Ganeti. It resides in the ganeti/ directory under the
337 36cf1973 Vangelis Koukis
    root of the Synnefo Django project.
338 7e8b41e7 Vangelis Koukis
339 03353341 Vangelis Koukis
    The hook needs to be enabled for phases
340 03353341 Vangelis Koukis
    post-{add,modify,reboot,start,stop} by *symlinking*
341 03353341 Vangelis Koukis
    in  /etc/ganeti/hooks/instance-{add,modify,reboot,start,stop}-post.d
342 03353341 Vangelis Koukis
    on GANETI-MASTER, e.g.:
343 7e8b41e7 Vangelis Koukis
344 03353341 Vangelis Koukis
    root@ganeti-master:/etc/ganeti/hooks/instance-start-post.d# ls -l
345 0bb376ce Vangelis Koukis
    lrwxrwxrwx 1 root root 45 May   3 13:45 00-snf-ganeti-hook -> /home/devel/synnefo/ganeti/snf-ganeti-hook
346 b6382dc5 Vangelis Koukis
347 03353341 Vangelis Koukis
    IMPORTANT: The link name may only contain "upper and lower case, digits,
348 03353341 Vangelis Koukis
    underscores and hyphens. In other words, the regexp ^[a-zA-Z0-9_-]+$."
349 03353341 Vangelis Koukis
    See http://docs.ganeti.org/ganeti/master/html/hooks.html?highlight=hooks#naming.
350 7e8b41e7 Vangelis Koukis
351 0bb376ce Vangelis Koukis
    You need to set SYNNEFO_PROJECT_DIR in ganeti/snf-ganeti-hook. The bash
352 0bb376ce Vangelis Koukis
    script modifies PYTHONPATH accordingly, before passing control to the
353 0bb376ce Vangelis Koukis
    relevant Python code.
354 81d1a961 Constantinos Venetsanopoulos
355 81d1a961 Constantinos Venetsanopoulos
356 03353341 Vangelis Koukis
12. Installation of the VNC authentication proxy, vncauthproxy:
357 03353341 Vangelis Koukis
    To support OOB console access to the VMs over VNC, the vncauthproxy
358 03353341 Vangelis Koukis
    daemon must be running on every node of type APISERVER.
359 81d1a961 Constantinos Venetsanopoulos
360 03353341 Vangelis Koukis
    Download and install vncauthproxy from its own repository,
361 03353341 Vangelis Koukis
    at https://code.grnet.gr/git/vncauthproxy (known good commit: 8799ab6d6e).
362 03353341 Vangelis Koukis
363 03353341 Vangelis Koukis
    Edit default settings on top of vncauthproxy.py.
364 03353341 Vangelis Koukis
    Set CTRL_SOCKET in util/vapclient.py to point to its control socket.
365 81d1a961 Constantinos Venetsanopoulos
366 03353341 Vangelis Koukis
    FIXME: The CTRL_SOCKET setting will be moved to settings.py as
367 03353341 Vangelis Koukis
    VNCAUTHPROXY_CTRL_SOCKET.
368 a06deab3 Vangelis Koukis
369 03353341 Vangelis Koukis
    Create /var/log/vncauthproxy and set its permissions appropriately.
370 fc2afa67 Vangelis Koukis
371 fc2afa67 Vangelis Koukis
372 03353341 Vangelis Koukis
13. Installation of the customized Ganeti Instance Image for image deployment:
373 03353341 Vangelis Koukis
    For Synnefo to be able to launch VMs from specified Images, you need
374 03353341 Vangelis Koukis
    the gnt-instance-image OS Provider installed on the Ganeti backend.
375 03353341 Vangelis Koukis
376 03353341 Vangelis Koukis
    Download and install gnt-instance-image in all Ganeti nodes from its own
377 03353341 Vangelis Koukis
    repository, at https://code.grnet.gr/git/gnt-instance-image.
378 03353341 Vangelis Koukis
379 03353341 Vangelis Koukis
    After installing gnt-instance-image do the following:
380 03353341 Vangelis Koukis
    1. root@ganeti-master:/path-to-repo# cp ./defaults /etc/default/ganeti-instance-image
381 03353341 Vangelis Koukis
    2. Uncomment the following in /etc/default/ganeti-instance-image:
382 03353341 Vangelis Koukis
       SWAP=no
383 03353341 Vangelis Koukis
       ARCH="x86_64"
384 36cf1973 Vangelis Koukis
    3. Add to /etc/default/ganeti-instance-image, so that make-dump makes
385 36cf1973 Vangelis Koukis
       no /boot partition:
386 03353341 Vangelis Koukis
       KERNEL_PATH="True"
387 03353341 Vangelis Koukis
    4. Change the path in make-dump line 22 according to your installation
388 03353341 Vangelis Koukis
       (/usr/share/ganeti/os/image/common.sh --> /srv/ganeti/os/image/common.sh)
389 03353341 Vangelis Koukis
    5. In common.sh, comment out the KERNEL_PATH variable initialization.
390 03353341 Vangelis Koukis
       (#KERNEL_PATH="$INSTANCE_HV_kernel_path")
391 03353341 Vangelis Koukis
    6. In /etc/ganeti/instance-image/hooks, make sure the hooks you want to
392 03353341 Vangelis Koukis
       run during instance creation process have execute permission. At least
393 03353341 Vangelis Koukis
       `grub' and `root_passwd' should be triggered to make the instance
394 03353341 Vangelis Koukis
       usable:
395 03353341 Vangelis Koukis
         chmod +x /etc/ganeti/instance-image/hooks/{grub,root_passwd}
396 03353341 Vangelis Koukis
397 36cf1973 Vangelis Koukis
    Your custom mmages should be stored in a dump format under
398 36cf1973 Vangelis Koukis
    /var/cache/ganeti-instance-image
399 03353341 Vangelis Koukis
    and their filenames should have the following format:
400 03353341 Vangelis Koukis
      {backend_id}-x86_64-root.dump
401 03353341 Vangelis Koukis
    e.g., debian-6.0.1a-x86_64-root.dump (backend_id = "debian-6.0.1a")
402 76a429fb Georgios Gousios
403 76a429fb Georgios Gousios
404 03353341 Vangelis Koukis
14. Setup Synnefo-specific networking on the Ganeti backend:
405 03353341 Vangelis Koukis
    This part is deployment-specific and must be customized based on the
406 03353341 Vangelis Koukis
    specific needs of the system administrators.
407 76a429fb Georgios Gousios
408 03353341 Vangelis Koukis
    A reference installation will use a Synnefo-specific KVM ifup script,
409 03353341 Vangelis Koukis
    NFDHCPD and pre-provisioned Linux bridges to support public and private
410 03353341 Vangelis Koukis
    network functionality. For this:
411 76a429fb Georgios Gousios
412 03353341 Vangelis Koukis
    Grab NFDHCPD from its own repository (https://code.grnet.gr/git/nfdhcpd),
413 03353341 Vangelis Koukis
    install it, modify /etc/nfdhcpd/nfdhcpd.conf to reflect your network
414 03353341 Vangelis Koukis
    configuration.
415 76a429fb Georgios Gousios
416 03353341 Vangelis Koukis
    Install a custom KVM ifup script for use by Ganeti, as
417 03353341 Vangelis Koukis
    /etc/ganeti/kvm-vif-bridge, on GANETI-NODEs. A sample implementation is
418 03353341 Vangelis Koukis
    provided under /contrib/ganeti-hooks. Set NFDHCPD_STATE_DIR to point
419 03353341 Vangelis Koukis
    to NFDHCPD's state directory, usually /var/lib/nfdhcpd.
420 76a429fb Georgios Gousios
421 76a429fb Georgios Gousios
422 03353341 Vangelis Koukis
15. Create log file directories for Synnefo components, set appropriate
423 36cf1973 Vangelis Koukis
    permissions. By default logic/dispatcher.py and ganeti/snf-ganeti-eventd.py
424 03353341 Vangelis Koukis
    use /var/log/synnefo.
425 76a429fb Georgios Gousios
426 7e8b41e7 Vangelis Koukis
427 03353341 Vangelis Koukis
16. (Hopefully) Done