1 | Installation of Ikoba |
---|
2 | #################### |
---|
3 | |
---|
4 | These are generic installation instructions for the WAeUP_ ``Ikoba`` |
---|
5 | student information portal and customized versions thereof. |
---|
6 | |
---|
7 | For specific aspects of this package please refer to the local README |
---|
8 | file. |
---|
9 | |
---|
10 | Please note, that **only Linux-based installs** are described and actively |
---|
11 | supported. We recommend use of Debian_ / Ubuntu_. |
---|
12 | |
---|
13 | .. note:: This means we do not actively support Windows(tm)! |
---|
14 | |
---|
15 | .. contents:: |
---|
16 | |
---|
17 | |
---|
18 | Prerequisites |
---|
19 | ************* |
---|
20 | |
---|
21 | The Ikoba packages are based on `Grok`_, which is a Python_ |
---|
22 | framework for agile webapplication development. Grok_ itself is based |
---|
23 | on `Zope`_. |
---|
24 | |
---|
25 | Both, Grok_ and Zope_, are written in the `Python`_ programming |
---|
26 | language (with parts written in C). You therefore have to have |
---|
27 | `Python`_ installed (including `Python`_ headers). |
---|
28 | |
---|
29 | |
---|
30 | Preparing the System |
---|
31 | ==================== |
---|
32 | |
---|
33 | For a `Ikoba` install we need of course `Python`_ installed as well as |
---|
34 | some standard developer tools like C compilers, C libraries, etc. |
---|
35 | |
---|
36 | What you need (Debian/Ubuntu package names in brackets): |
---|
37 | |
---|
38 | * Python 2.7 (``python2.7``) |
---|
39 | |
---|
40 | * Python 2.7 development files (``python2.7-dev``) |
---|
41 | |
---|
42 | * A C-Compiler with basic C developer libraries (``build-essential``) |
---|
43 | |
---|
44 | * A subversion client (``subversion``) |
---|
45 | |
---|
46 | * XML and XSLT development libraries (``libxml2-dev``, ``libxslt1-dev``) |
---|
47 | |
---|
48 | * enscript (``enscript``) [optional] |
---|
49 | |
---|
50 | This is only needed if you want test coverage reports. |
---|
51 | |
---|
52 | All these packages can be installed on Debian systems like this:: |
---|
53 | |
---|
54 | $ sudo apt-get install python2.7 python2.7-dev subversion \ |
---|
55 | build-essential enscript libxml2-dev libxslt1-dev |
---|
56 | |
---|
57 | Afterwards you should be able to enter:: |
---|
58 | |
---|
59 | $ python2.7 |
---|
60 | |
---|
61 | at the commandline and get a Python_ prompt. Quit the interpreter |
---|
62 | pressing <CTRL-D>. |
---|
63 | |
---|
64 | |
---|
65 | Installing `virtualenv` |
---|
66 | ======================= |
---|
67 | |
---|
68 | We strongly suggest use of `virtualenv`_ to create Python_ sandboxes |
---|
69 | where you can run your code without touching any other installations. |
---|
70 | |
---|
71 | `virtualenv`_ is also the only possibility to build a `Ikoba` install |
---|
72 | without the need of superuser permissions. In short: `virtualenv`_ |
---|
73 | will make your life easier. Use it. |
---|
74 | |
---|
75 | Detailed install instructions for `virtualenv`_ can be found on |
---|
76 | http://www.virtualenv.org/en/latest/virtualenv.html#installation. |
---|
77 | |
---|
78 | The short way for a user install (no superuser perms required) is like |
---|
79 | this:: |
---|
80 | |
---|
81 | $ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.4.tar.gz#md5=9accc2d3f0ec1da479ce2c3d1fdff06e |
---|
82 | $ tar xvfz virtualenv-1.11.4.tar.gz |
---|
83 | $ cd virtualenv-1.11.4 |
---|
84 | $ python virtualenv.py py27 |
---|
85 | |
---|
86 | Superusers can install `virtualenv`_ system-wide much easier. On |
---|
87 | `Debian`_/`Ubuntu`_ systems where you have superuser permissions, you |
---|
88 | can install `virtualenv`_ via:: |
---|
89 | |
---|
90 | $ sudo apt-get install python-virtualenv |
---|
91 | |
---|
92 | *Or*, if `pip` is installed already (superusers can install it via |
---|
93 | ``sudo apt-get install python-pip`` on `Debian`_/`Ubuntu`_):: |
---|
94 | |
---|
95 | $ sudo pip install virtualenv |
---|
96 | |
---|
97 | |
---|
98 | Creating a Sandbox |
---|
99 | ================== |
---|
100 | |
---|
101 | After installing `virtualenv`_ you can install local sandboxes like |
---|
102 | this (if `virtualenv` is installed system-wide):: |
---|
103 | |
---|
104 | $ virtualenv --no-site-packages py27 |
---|
105 | |
---|
106 | *or* like this:: |
---|
107 | |
---|
108 | $ python /path/to/my/virtualenv.py --no-site-packages py27 |
---|
109 | |
---|
110 | where ``py27`` is a directory in the filesystem where your sandbox |
---|
111 | will be created. `virtualenv` will also create this directory for |
---|
112 | you. While you can pick any sandbox name you want, it is recommended |
---|
113 | to use a sandbox name that is short and at the same time reflects the |
---|
114 | Python version used (here: Python 2.7). |
---|
115 | |
---|
116 | By passing the ``no-site-packages`` switch we tell `virtualenv` to |
---|
117 | provide a clean environment without any extra-packages installed |
---|
118 | systemwide. More recent versions of `virtualenv`_ have this option set |
---|
119 | by default. |
---|
120 | |
---|
121 | Another often used option of `virtualenv`_ is ``-p``. With ``-p`` you |
---|
122 | can tell `virtualenv`_ which Python executable to use as base for the |
---|
123 | new sandbox. |
---|
124 | |
---|
125 | You now can activate the sandbox by doing:: |
---|
126 | |
---|
127 | $ source py27/bin/activate |
---|
128 | (py27)$ |
---|
129 | |
---|
130 | You will notice that the input prompt changes, indicating the name of |
---|
131 | the sandbox activated. |
---|
132 | |
---|
133 | To deactivate the sandbox at any time, enter:: |
---|
134 | |
---|
135 | (py27)$ deactivate |
---|
136 | |
---|
137 | and the prompt will be the same as before the activation. |
---|
138 | |
---|
139 | For the following steps make sure the sandbox is active. |
---|
140 | |
---|
141 | |
---|
142 | Getting the Sources |
---|
143 | =================== |
---|
144 | |
---|
145 | Now, as the sandbox is activated (see above, if not), we can fetch the |
---|
146 | sources for Ikoba. |
---|
147 | |
---|
148 | As Ikoba is currently available from the Subversion_ repository only, |
---|
149 | we use the Subversion_ client `svn` and checkout the main devel branch |
---|
150 | of the `waeup.ikoba` package like this:: |
---|
151 | |
---|
152 | (py27)$ svn co https://svn.waeup.org/repos/main/waeup.ikoba/trunk |
---|
153 | |
---|
154 | The command should fetch the Ikoba base package sources for you and |
---|
155 | will put everything in a new directory ``trunk/``. |
---|
156 | |
---|
157 | Now enter the new directory:: |
---|
158 | |
---|
159 | (py27)$ cd trunk/ |
---|
160 | |
---|
161 | and you can start building the real package. |
---|
162 | |
---|
163 | .. note:: If you not want to work with the `waeup.ikoba` package but a |
---|
164 | customized package (like ``waeup.aaue`` or similar), then |
---|
165 | you can use the above checkout command but with |
---|
166 | ``waeup.ikoba`` replaced by the name of the customized |
---|
167 | package:: |
---|
168 | |
---|
169 | (py27)$ svn co https://svn.waeup.org/repos/main/<PKG-NAME>/trunk |
---|
170 | |
---|
171 | For the exact link, please refer to the README.txt file in |
---|
172 | your package. |
---|
173 | |
---|
174 | |
---|
175 | Bootstrapping the Build |
---|
176 | ======================= |
---|
177 | |
---|
178 | After `Creating a Sandbox`_ and `Getting the Sources`_ we have to |
---|
179 | initialize the newly created development environment:: |
---|
180 | |
---|
181 | (py27)$ python bootstrap.py |
---|
182 | |
---|
183 | This should create a local ``bin/`` directory with at least a script |
---|
184 | ``buildout`` in it. |
---|
185 | |
---|
186 | If bootstrapping fails, chances are, that you need the `distribute` |
---|
187 | package installed. In a virtual environment you can install it without |
---|
188 | interfering with other packages installed on your server:: |
---|
189 | |
---|
190 | (py27)$ pip install --upgrade distribute |
---|
191 | |
---|
192 | Afterwards you have to retry the bootstrapping, until you get a |
---|
193 | working ``buildout`` script in the local ``bin/`` directory. |
---|
194 | |
---|
195 | Once the ``buildout`` script exists, you do not have to activate the |
---|
196 | virtual envronment any more (although you can). |
---|
197 | |
---|
198 | |
---|
199 | Part 1: Single Client Setup |
---|
200 | *************************** |
---|
201 | |
---|
202 | You can run ``Ikoba`` with a single client (useful for evaluation, |
---|
203 | development, etc.) or with multiple clients running in parallel. The |
---|
204 | latter setup is useful in productive environments with many thousands |
---|
205 | users and called a ``ZEO`` install. We will cover both setup |
---|
206 | types. The first is covered here, the latter one is covered in `Part |
---|
207 | 2: ZEO Install`_. |
---|
208 | |
---|
209 | |
---|
210 | Building the Package |
---|
211 | ==================== |
---|
212 | |
---|
213 | In the sources directory (``trunk/``) you have to prepare the |
---|
214 | project to fetch needed components (eggs), compile C-code parts, |
---|
215 | etc. This is done by a single command ``buildout``:: |
---|
216 | |
---|
217 | $ ./bin/buildout |
---|
218 | |
---|
219 | If this is your first install of some Grok-related project, this step |
---|
220 | will need some time as lots of sources have to be fetched, many |
---|
221 | components must be compiled, etc. |
---|
222 | |
---|
223 | This step must be redone whenever you change something in |
---|
224 | ``buildout.cfg``, ``buildout-zeo.cfg``, or ``setup.py``. |
---|
225 | |
---|
226 | Note that if you have more than one sandbox for a Zope-based web |
---|
227 | application, it will probably make sense to share the eggs between the |
---|
228 | different sandboxes. You can tell ``zc.buildout`` to use a central |
---|
229 | eggs directory by creating ``~/.buildout/default.cfg`` with the |
---|
230 | following contents:: |
---|
231 | |
---|
232 | [buildout] |
---|
233 | eggs-directory = /home/bruno/buildout-eggs |
---|
234 | |
---|
235 | where the given directory should be exist beforehand. All eggs of all |
---|
236 | `buildout` projects will then be stored in this directory (and not |
---|
237 | fetched anew if already existing there). |
---|
238 | |
---|
239 | |
---|
240 | Start the Instance |
---|
241 | ================== |
---|
242 | |
---|
243 | You should be able now to start the created instance by doing:: |
---|
244 | |
---|
245 | $ ./bin/ikobactl fg |
---|
246 | |
---|
247 | Alternatively you can do:: |
---|
248 | |
---|
249 | $ bin/paster serve parts/etc/deploy-themed.ini |
---|
250 | |
---|
251 | The port numbers where Ikoba is running on your server are defined in |
---|
252 | `buildout.cfg` under ``[ikoba_params]``. |
---|
253 | |
---|
254 | If you now point a browser to the right port on your server, for example:: |
---|
255 | |
---|
256 | localhost:8080 |
---|
257 | |
---|
258 | you should get a login pop-up, where you can login as superuser with |
---|
259 | ``grok`` and ``grok`` as username/password (Ikoba base package only!). |
---|
260 | |
---|
261 | You can stop the instance by pressing <CTRL-C>. |
---|
262 | |
---|
263 | If you are connected and logged in, |
---|
264 | you should be able to add the grok-based applications |
---|
265 | (such as ``University``) from the menu. |
---|
266 | |
---|
267 | Add an instance of ``University`` and click on the link next to the |
---|
268 | then visible entry in the list of installed applications. |
---|
269 | |
---|
270 | Running the Tests |
---|
271 | ================= |
---|
272 | |
---|
273 | All WAeUP_ packages come with comprehensive test suites ensuring the |
---|
274 | software quality also after changes and updates. |
---|
275 | |
---|
276 | The package tests are easily run by executing the test runner |
---|
277 | from the ``bin`` directory:: |
---|
278 | |
---|
279 | $ ./bin/test |
---|
280 | |
---|
281 | Use the ``-c`` option to get coloured output. Use the ``--pdb`` option |
---|
282 | to start the Python_ debugger when a test fails. |
---|
283 | |
---|
284 | |
---|
285 | Part 2: ZEO Install |
---|
286 | ******************* |
---|
287 | |
---|
288 | Each ZEO install consists of at least one ZEO server and normally two |
---|
289 | or more ZEO clients. While the ZEO server is meant to manage the ZODB |
---|
290 | database for clients, the clients connect to the outside world, listen |
---|
291 | for request and do the real dataprocessing. |
---|
292 | |
---|
293 | We prepared a `buildout` configuration that sets up one server |
---|
294 | configuration and two client configs. This configuration is in |
---|
295 | ``buildout-zeo.cfg``. |
---|
296 | |
---|
297 | Generating the ZEO Setup |
---|
298 | ======================== |
---|
299 | |
---|
300 | To install Ikoba ZEO-based you can run `buildout` with the given |
---|
301 | (or your own) configuration file like this:: |
---|
302 | |
---|
303 | $ ./bin/buildout -c buildout-zeo.cfg |
---|
304 | |
---|
305 | This should generate all scripts necessary to run servers, clients, |
---|
306 | etc. |
---|
307 | |
---|
308 | Starting ZEO Servers and Clients |
---|
309 | ================================ |
---|
310 | |
---|
311 | First start the server:: |
---|
312 | |
---|
313 | $ ./bin/zeo_server start |
---|
314 | |
---|
315 | Clients can be started by doing:: |
---|
316 | |
---|
317 | $ ./bin/zeo_client1 start |
---|
318 | $ ./bin/zeo_client2 start |
---|
319 | |
---|
320 | This will start both clients in daemon mode. |
---|
321 | |
---|
322 | Instead of ``start`` you can, as usually, start an instance in |
---|
323 | foreground (``fg``), etc. You know the drill. |
---|
324 | |
---|
325 | |
---|
326 | Manually Starting ZEO Clients |
---|
327 | ============================= |
---|
328 | |
---|
329 | This is normally not neccessary. |
---|
330 | |
---|
331 | ``zeo_clientN`` scripts are basically wrappers around calls to |
---|
332 | ``bin/paster``. You can bypass this wrapper and start a client |
---|
333 | 'manually' like this:: |
---|
334 | |
---|
335 | $ ./bin/paster serve --pid-file var/zeo1.pid --daemon \ |
---|
336 | pars/etc/zeo1.ini |
---|
337 | |
---|
338 | It is important to give a pid-file as `paster` otherwise can not start |
---|
339 | different clients (they would all refer to the same pid file |
---|
340 | `paster.pid` and refuse to start after the first client was started). |
---|
341 | |
---|
342 | |
---|
343 | Setup (paramters, ports, etc.) |
---|
344 | ============================== |
---|
345 | |
---|
346 | By default the server will listen on port 8100 for requests from |
---|
347 | localhost (not: from the outside world). |
---|
348 | |
---|
349 | You can change ZEO server settings in the ``[zeo_server]`` section |
---|
350 | of ``buildout-zeo.conf``. Run `buildout` afterwards. |
---|
351 | |
---|
352 | The clients will listen on port 8081 and 8082. You can change settings |
---|
353 | in ``etc/zeo1.ini.in`` and ``etc/zeo2.ini.in`` respectively. Run |
---|
354 | buildout after any change. |
---|
355 | |
---|
356 | If you want to change the paster wrapper for any zeo client, you can |
---|
357 | edit ``etc/zeo1.conf`` and/or ``etc/zeo2.conf``. Run buildout |
---|
358 | afterwards. |
---|
359 | |
---|
360 | |
---|
361 | Stopping ZEO Servers and Clients |
---|
362 | ================================ |
---|
363 | |
---|
364 | Given everything was started in daemon mode, first stop the clients:: |
---|
365 | |
---|
366 | $ ./bin/zeo_client1 stop |
---|
367 | $ ./bin/zeo_client2 stop |
---|
368 | |
---|
369 | Then stop the ZEO server:: |
---|
370 | |
---|
371 | $ ./bin/zeo_server stop |
---|
372 | |
---|
373 | |
---|
374 | Creating New ZEO Clients |
---|
375 | ======================== |
---|
376 | |
---|
377 | You want more ZEO clients to be created by `buildout`? Easy. Three |
---|
378 | steps are neccessary. |
---|
379 | |
---|
380 | 1. Create config files in `etc/` |
---|
381 | -------------------------------- |
---|
382 | |
---|
383 | Each client needs two configuration files: |
---|
384 | |
---|
385 | - ``etc/zeoN.conf`` |
---|
386 | configuring the paster wrapper |
---|
387 | |
---|
388 | - ``etc/zeoN.ini`` |
---|
389 | configuring the runtime config, ports, etc. |
---|
390 | |
---|
391 | Just copy over these files from the already existing zeo1/zeo2 files |
---|
392 | and replace ``zeo1`` or ``zeo2`` with your new name. |
---|
393 | |
---|
394 | 2. Update buildout-zeo.cfg |
---|
395 | -------------------------- |
---|
396 | |
---|
397 | Here, inside ``buildourt-zeo.cfg`` also three steps are needed. |
---|
398 | |
---|
399 | * 2.1. Create new .ini and .conf entries |
---|
400 | |
---|
401 | The .conf and .ini files in etc/ are only templates that have to be |
---|
402 | generated in their really used final location. In buildout-zeo.cfg |
---|
403 | you can care for this by creating a new ``[zeoN_ini]`` and |
---|
404 | ``[zeoN_conf]`` option (replacing ``N`` with a number, of course). |
---|
405 | |
---|
406 | Just copy over existing entries and replace the mentions of ``zeo1`` |
---|
407 | or ``zeo2`` by your ``zeoN``. |
---|
408 | |
---|
409 | * 2.2. Create a new ``zeo_clientN`` entry |
---|
410 | |
---|
411 | Then you have to create an entry that will generate the |
---|
412 | ``zeo_clientN`` script. Again, just copy over an existing |
---|
413 | ``[zeo_client1]`` entry and replace ``1`` withg your client number. |
---|
414 | |
---|
415 | * 2.3. Register the new sections in ``[buildout]`` section |
---|
416 | |
---|
417 | When done with the above: add the new section in ``[buildout]``:: |
---|
418 | |
---|
419 | [buildout] |
---|
420 | ... |
---|
421 | <old entries...> |
---|
422 | ... |
---|
423 | zope_conf_zeo_5 |
---|
424 | zeo5_ini |
---|
425 | zeo_client5 |
---|
426 | |
---|
427 | depending on how you named your new sections. |
---|
428 | |
---|
429 | 3. Rerun ``buildout`` |
---|
430 | --------------------- |
---|
431 | |
---|
432 | When adding or removing client/server instances, make sure to stop all |
---|
433 | running servers/clients before rerunning buildout. |
---|
434 | |
---|
435 | To activate the new setup, rerun buildout:: |
---|
436 | |
---|
437 | $ bin/buildout -c buildout-zeo.cfg |
---|
438 | |
---|
439 | This should generate any new clients and remove older ones or just |
---|
440 | update configuration files. |
---|
441 | |
---|
442 | |
---|
443 | Considerations |
---|
444 | ============== |
---|
445 | |
---|
446 | There are some things in the current buildout-zeo.cfg we might do not |
---|
447 | want. It extends the regular ``buildout.cfg`` so that we do not have |
---|
448 | to repeat most sections but the ``parts`` in ``[buildout]`` have to be |
---|
449 | listed. |
---|
450 | |
---|
451 | We need, however, not everything with a ZEO-deploy that is listed in a |
---|
452 | default buildout. We might do not need docs, no profiling, etc. Also a |
---|
453 | regular non-ZEO ikobactl might not make to much sense. Therefore all |
---|
454 | this might be subject to changes. |
---|
455 | |
---|
456 | .. _Debian: http://www.debian.org/ |
---|
457 | .. _Grok: http://grok.zope.org/ |
---|
458 | .. _Python: http://www.python.org/ |
---|
459 | .. _Subversion: http://subversion.apache.org/ |
---|
460 | .. _Ubuntu: http://www.ubuntu.com/ |
---|
461 | .. _virtualenv: http://www.virtualenv.org/en/latest/ |
---|
462 | .. _WAeUP: https://www.waeup.org/ |
---|
463 | .. _Zope: http://www.zope.org/ |
---|
464 | .. _zc.buildout: http://cheeseshop.python.org/pypi/zc.buildout |
---|