source: main/waeup.kofa/branches/uli-stud-utils-cleanup/docs/INSTALL.txt @ 13621

Last change on this file since 13621 was 11703, checked in by Henrik Bettermann, 10 years ago

Add missing colon.

File size: 13.7 KB
Line 
1Installation of Kofa
2####################
3
4These are generic installation instructions for the WAeUP_ ``Kofa``
5student information portal and customized versions thereof.
6
7For specific aspects of this package please refer to the local README
8file.
9
10Please note, that **only Linux-based installs** are described and actively
11supported. We recommend use of Debian_ / Ubuntu_.
12
13.. note:: This means we do not actively support Windows(tm)!
14
15.. contents::
16
17
18Prerequisites
19*************
20
21The Kofa packages are based on `Grok`_, which is a Python_
22framework for agile webapplication development. Grok_ itself is based
23on `Zope`_.
24
25Both, Grok_ and Zope_, are written in the `Python`_ programming
26language (with parts written in C). You therefore have to have
27`Python`_ installed (including `Python`_ headers).
28
29
30Preparing the System
31====================
32
33For a `Kofa` install we need of course `Python`_ installed as well as
34some standard developer tools like C compilers, C libraries, etc.
35
36What 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
52All 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
57Afterwards you should be able to enter::
58
59  $ python2.7
60
61at the commandline and get a Python_ prompt. Quit the interpreter
62pressing <CTRL-D>.
63
64
65Installing `virtualenv`
66=======================
67
68We strongly suggest use of `virtualenv`_ to create Python_ sandboxes
69where you can run your code without touching any other installations.
70
71`virtualenv`_ is also the only possibility to build a `Kofa` install
72without the need of superuser permissions. In short: `virtualenv`_
73will make your life easier. Use it.
74
75Detailed install instructions for `virtualenv`_ can be found on
76http://www.virtualenv.org/en/latest/virtualenv.html#installation.
77
78The short way for a user install (no superuser perms required) is like
79this::
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
86Superusers can install `virtualenv`_ system-wide much easier. On
87`Debian`_/`Ubuntu`_ systems where you have superuser permissions, you
88can 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
98Creating a Sandbox
99==================
100
101After installing `virtualenv`_ you can install local sandboxes like
102this (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
110where ``py27`` is a directory in the filesystem where your sandbox
111will be created. `virtualenv` will also create this directory for
112you. While you can pick any sandbox name you want, it is recommended
113to use a sandbox name that is short and at the same time reflects the
114Python version used (here: Python 2.7).
115
116By passing the ``no-site-packages`` switch we tell `virtualenv` to
117provide a clean environment without any extra-packages installed
118systemwide. More recent versions of `virtualenv`_ have this option set
119by default.
120
121Another often used option of `virtualenv`_ is ``-p``. With ``-p`` you
122can tell `virtualenv`_ which Python executable to use as base for the
123new sandbox.
124
125You now can activate the sandbox by doing::
126
127  $ source py27/bin/activate
128  (py27)$
129
130You will notice that the input prompt changes, indicating the name of
131the sandbox activated.
132
133To deactivate the sandbox at any time, enter::
134
135  (py27)$ deactivate
136
137and the prompt will be the same as before the activation.
138
139For the following steps make sure the sandbox is active.
140
141
142Getting the Sources
143===================
144
145Now, as the sandbox is activated (see above, if not), we can fetch the
146sources for Kofa.
147
148As Kofa is currently available from the Subversion_ repository only,
149we use the Subversion_ client `svn` and checkout the main devel branch
150of the `waeup.kofa` package like this::
151
152  (py27)$ svn co https://svn.waeup.org/repos/main/waeup.kofa/trunk
153
154The command should fetch the Kofa base package sources for you and
155will put everything in a new directory ``trunk/``.
156
157Now enter the new directory::
158
159  (py27)$ cd trunk/
160
161and you can start building the real package.
162
163.. note:: If you not want to work with the `waeup.kofa` package but a
164          customized package (like ``waeup.aaue`` or similar), then
165          you can use the above checkout command but with
166          ``waeup.kofa`` 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
175Bootstrapping the Build
176=======================
177
178After `Creating a Sandbox`_ and `Getting the Sources`_ we have to
179initialize the newly created development environment::
180
181  (py27)$ python bootstrap.py
182
183This should create a local ``bin/`` directory with at least a script
184``buildout`` in it.
185
186If bootstrapping fails, chances are, that you need the `distribute`
187package installed. In a virtual environment you can install it without
188interfering with other packages installed on your server::
189
190  (py27)$ pip install --upgrade distribute
191
192Afterwards you have to retry the bootstrapping, until you get a
193working ``buildout`` script in the local ``bin/`` directory.
194
195Once the ``buildout`` script exists, you do not have to activate the
196virtual envronment any more (although you can).
197
198
199Part 1: Single Client Setup
200***************************
201
202You can run ``Kofa`` with a single client (useful for evaluation,
203development, etc.) or with multiple clients running in parallel. The
204latter setup is useful in productive environments with many thousands
205users and called a ``ZEO`` install. We will cover both setup
206types. The first is covered here, the latter one is covered in `Part
2072: ZEO Install`_.
208
209
210Building the Package
211====================
212
213In the sources directory (``trunk/``) you have to prepare the
214project to fetch needed components (eggs), compile C-code parts,
215etc. This is done by a single command ``buildout``::
216
217  $ ./bin/buildout
218
219If this is your first install of some Grok-related project, this step
220will need some time as lots of sources have to be fetched, many
221components must be compiled, etc.
222
223This step must be redone whenever you change something in
224``buildout.cfg``, ``buildout-zeo.cfg``, or ``setup.py``.
225
226Note that if you have more than one sandbox for a Zope-based web
227application, it will probably make sense to share the eggs between the
228different sandboxes.  You can tell ``zc.buildout`` to use a central
229eggs directory by creating ``~/.buildout/default.cfg`` with the
230following contents::
231
232  [buildout]
233  eggs-directory = /home/bruno/buildout-eggs
234
235where the given directory should be exist beforehand. All eggs of all
236`buildout` projects will then be stored in this directory (and not
237fetched anew if already existing there).
238
239
240Start the Instance
241==================
242
243You should be able now to start the created instance by doing::
244
245  $ ./bin/kofactl fg
246
247Alternatively you can do::
248
249  $ bin/paster serve parts/etc/deploy-themed.ini
250
251The port numbers where Kofa is running on your server are defined in
252`buildout.cfg` under ``[kofa_params]``.
253
254If you now point a browser to the right port on your server, for example::
255
256  localhost:8080
257
258you should get a login pop-up, where you can login as superuser with
259``grok`` and ``grok`` as username/password (Kofa base package only!).
260
261You can stop the instance by pressing <CTRL-C>.
262
263If you are connected and logged in,
264you should be able to add the grok-based applications
265(such as ``University``) from the menu.
266
267Add an instance of ``University`` and click on the link next to the
268then visible entry in the list of installed applications.
269
270Running the Tests
271=================
272
273All WAeUP_ packages come with comprehensive test suites ensuring the
274software quality also after changes and updates.
275
276The package tests are easily run by executing the test runner
277from the ``bin`` directory::
278
279  $ ./bin/test
280
281Use the ``-c`` option to get coloured output. Use the ``--pdb`` option
282to start the Python_ debugger when a test fails.
283
284
285Part 2: ZEO Install
286*******************
287
288Each ZEO install consists of at least one ZEO server and normally two
289or more ZEO clients. While the ZEO server is meant to manage the ZODB
290database for clients, the clients connect to the outside world, listen
291for request and do the real dataprocessing.
292
293We prepared a `buildout` configuration that sets up one server
294configuration and two client configs. This configuration is in
295``buildout-zeo.cfg``.
296
297Generating the ZEO Setup
298========================
299
300To install Kofa 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
305This should generate all scripts necessary to run servers, clients,
306etc.
307
308Starting ZEO Servers and Clients
309================================
310
311First start the server::
312
313  $ ./bin/zeo_server start
314
315Clients can be started by doing::
316
317  $ ./bin/zeo_client1 start
318  $ ./bin/zeo_client2 start
319
320This will start both clients in daemon mode.
321
322Instead of ``start`` you can, as usually, start an instance in
323foreground (``fg``), etc. You know the drill.
324
325
326Manually Starting ZEO Clients
327=============================
328
329This 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
338It is important to give a pid-file as `paster` otherwise can not start
339different 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
343Setup (paramters, ports, etc.)
344==============================
345
346By default the server will listen on port 8100 for requests from
347localhost (not: from the outside world).
348
349You can change ZEO server settings in the ``[zeo_server]`` section
350of ``buildout-zeo.conf``. Run `buildout` afterwards.
351
352The clients will listen on port 8081 and 8082. You can change settings
353in ``etc/zeo1.ini.in`` and ``etc/zeo2.ini.in`` respectively. Run
354buildout after any change.
355
356If you want to change the paster wrapper for any zeo client, you can
357edit ``etc/zeo1.conf`` and/or ``etc/zeo2.conf``. Run buildout
358afterwards.
359
360
361Stopping ZEO Servers and Clients
362================================
363
364Given everything was started in daemon mode, first stop the clients::
365
366  $ ./bin/zeo_client1 stop
367  $ ./bin/zeo_client2 stop
368
369Then stop the ZEO server::
370
371  $ ./bin/zeo_server stop
372
373
374Creating New ZEO Clients
375========================
376
377You want more ZEO clients to be created by `buildout`? Easy. Three
378steps are neccessary.
379
3801. Create config files in `etc/`
381--------------------------------
382
383Each 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
391Just copy over these files from the already existing zeo1/zeo2 files
392and replace ``zeo1`` or ``zeo2`` with your new name.
393
3942. Update buildout-zeo.cfg
395--------------------------
396
397Here, 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
4293. Rerun ``buildout``
430---------------------
431
432When adding or removing client/server instances, make sure to stop all
433running servers/clients before rerunning buildout.
434
435To activate the new setup, rerun buildout::
436
437  $ bin/buildout -c buildout-zeo.cfg
438
439This should generate any new clients and remove older ones or just
440update configuration files.
441
442
443Considerations
444==============
445
446There are some things in the current buildout-zeo.cfg we might do not
447want. It extends the regular ``buildout.cfg`` so that we do not have
448to repeat most sections but the ``parts`` in ``[buildout]`` have to be
449listed.
450
451We need, however, not everything with a ZEO-deploy that is listed in a
452default buildout. We might do not need docs, no profiling, etc. Also a
453regular non-ZEO kofactl might not make to much sense. Therefore all
454this 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
Note: See TracBrowser for help on using the repository browser.