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