source: main/waeup.kofa/trunk/docs/INSTALL.txt @ 11386

Last change on this file since 11386 was 11386, checked in by Henrik Bettermann, 11 years ago

Update INSTALL.txt and integrate into Sphinx documentation. Remove redundancies.

File size: 12.0 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 (``svn``)
45
46* enscript (``enscript``) [optional]
47
48  This is only needed if you want test coverage reports.
49
50All these packages can be installed on Debian systems like this::
51
52  $ sudo apt-get install python2.7 python2.7-dev svn \
53                         build-essential enscript
54
55Afterwards you should be able to enter::
56
57  $ python2.7
58
59at the commandline and get a Python_ prompt. Quit the interpreter
60pressing <CTRL-D>.
61
62
63Installing `virtualenv`
64=======================
65
66We strongly suggest use of `virtualenv`_ to create Python_ sandboxes
67where you can run your code without touching any other installations.
68
69`virtualenv`_ is also the only possibility to build a `Kofa` install
70without the need of superuser permissions. In short: `virtualenv`_
71will make your life easier. Use it.
72
73Detailed install instructions for `virtualenv`_ can be found on
74http://www.virtualenv.org/en/latest/virtualenv.html#installation.
75
76The short way for a user install (no superuser perms required) is like
77this::
78
79  $ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.4.tar.gz#md5=9accc2d3f0ec1da479ce2c3d1fdff06e
80  $ tar xvfz virtualenv-1.11.4.tar.gz
81  $ cd virtualenv-1.11.4
82  $ python virtualenv.py py27
83
84Superusers can install `virtualenv`_ system-wide much easier. On
85`Debian`_/`Ubuntu`_ systems where you have superuser permissions, you
86can install `virtualenv`_ via::
87
88  $ sudo apt-get install python-virtualenv
89
90*Or*, if `pip` is installed already (superusers can install it via ``sudo apt-get install python-pip`` on `Debian`_/`Ubuntu`_)::
91
92  $ sudo pip install virtualenv
93
94In the following, when referring to the `virtualenv` command, we talk
95of the system-wide available command or the ``virtualenv.py`` script
96installed for a local user. In the latter case you should read::
97
98  $ virtualenv ...
99
100as::
101
102  $ python /path/to/my/virtualenv.py ...
103
104
105Creating a sandbox
106==================
107
108After installing `virtualenv`_ you can install local sandboxes like
109this::
110
111  $ virtualenv --no-site-packages py27
112
113where ``py27`` is a directory in the filesystem where your sandbox
114will be created. `virtualenv` will also create this directory for
115you. It is recommended to use a sandbox name that is short and at the
116same time reflects the Python version used (here: Python 2.7).
117
118By passing the ``no-site-packages`` switch we tell `virtualenv` to
119provide us a clean environment without any extra-packages installed
120systemwide. More recent versions of `virtualenv`_ have this option set
121by default.
122
123Another often used option of `virtualenv`_ is ``-p``. With ``-p`` you
124can tell `virtualenv`_ which Python executable to use as base for the
125new sandbox.
126
127You now can activate the sandbox by doing::
128
129  $ source py27/bin/activate
130  (py27)$
131
132You will notice that the input prompt changes.
133
134To deactivate the sandbox at any time, enter::
135
136  (py27)$ deactivate
137
138and the prompt will be the same as before the activation.
139
140For the following steps make sure the sandbox is active.
141
142
143Creating a working place
144========================
145
146In the sandbox we now create our real working
147environment. To do this, we change to the sandbox and checkout the
148sources of Kofa from the subversion server::
149
150  (py27)$ cd mysandbox/
151  (py27)$ svn co https://svn.waeup.org/repos/main/waeup.kofa/trunk kofa-trunk
152
153where ``kofa-trunk`` is only a name we've chosen here to make clear
154where the sources come from. In this case we are installing the Kofa base
155package.
156
157The command should fetch the Kofa base package sources for you and
158put it in the directory ``kofa-trunk/``.
159
160Now enter the new directory::
161
162  (py27)$ cd kofa-trunk
163
164
165You can run ``Kofa`` with a single client (useful for evaluation,
166development, etc.) or with multiple clients running in parallel. The
167latter setup is useful in productive environments with many thousands
168users. We will cover both setup types one after another.
169
170
171Part 1: Single Client Setup
172***************************
173
174Preparing the build
175===================
176
177In the sources directory (``kofa-trunk/``) you have to prepare the
178project to fetch needed components (eggs), compile C-code parts,
179etc. This steip will not touch any external projects::
180
181  (py27)$ python bootstrap.py
182
183This will generate some directories and the ``buildout`` script in
184``bin/`` for us. This step must be executed only once for each
185instance.
186
187You can now deactivate the sandbox::
188
189  (py27)$ deactivate
190
191Now we can do the real build by triggering::
192
193  $ bin/buildout
194
195If this is your first install of some Grok-related project, this step
196will need some time as lots of sources have to be fetched, many
197components must be compiled, etc.
198
199This step must be redone whenever you change something in
200``buildout.cfg`` or ``setup.py``.
201
202Note that if you have more than one sandbox for a Zope-based web
203application, it will probably make sense to share the eggs between the
204different sandboxes.  You can tell ``zc.buildout`` to use a central
205eggs directory by creating ``~/.buildout/default.cfg`` with the
206following contents::
207
208  [buildout]
209  eggs-directory = /home/bruno/buildout-eggs
210
211
212Start the instance
213==================
214
215You should be able now to start the created instance by doing::
216
217  $ bin/zopectl fg
218
219Alternatively you can do::
220
221  $ bin/paster serve parts/etc/deploy.ini
222
223The port numbers where Kofa is running on your server are defined in
224buildout.cfg under [kofa_params].
225
226If you now point a browser to the right port on your server, for example ::
227
228  localhost:8080
229
230you should get a login pop-up, where you can login as superuser with
231``grok`` and ``grok`` as username/password (Kofa base package only!).
232
233You can stop the instance by pressing <CTRL-C>.
234
235If you are connected and logged in,
236you should be able to add the grok-based applications
237(such as ``University``) from the menu.
238
239Add an instance of ``University`` and click on the link next to the
240then visible entry in the list of installed applications.
241
242Running the tests
243=================
244
245The tests are easily run by executing the test runner that's
246installed in the ``bin`` directory::
247
248  $ bin/test
249
250
251Part 2: Deploying Kofa as ZEO install
252*************************************
253
254Each ZEO install consists of at least one ZEO server and normally two
255or more ZEO clients. While the ZEO server is meant to manage the ZODB
256database for clients, the clients connect to the outside world, listen
257for request and do the real dataprocessing.
258
259We prepared a `buildout` configuration that sets up one server
260configuration and two client configs. This configuration is in
261``buildout-zeo.cfg``.
262
263Generating the ZEO setup
264========================
265
266To install Kofa ZEO-based you can run `buildout` with the given
267(or your own) configuration file like this::
268
269  $ ./bin/buildout -c buildout-zeo.cfg
270
271This should generate all scripts necessary to run servers, clients,
272etc.
273
274Starting ZEO servers and clients
275================================
276
277First start the server::
278
279  $ ./bin/zeo_server start
280
281Clients can be started by doing::
282
283  $ ./bin/zeo_client1 start
284  $ ./bin/zeo_client2 start
285
286This will start both clients in daemon mode.
287
288Instead of ``start`` you can, as usually, start an instance in
289foreground (``fg``), etc. You know the drill.
290
291
292Manually starting ZEO clients
293=============================
294
295This is normally not neccessary.
296
297``zeo_clientN`` scripts are basically wrappers around calls to
298``bin/paster``. You can bypass this wrapper and start a client
299'manually' like this::
300
301  $ ./bin/paster serve --pid-file var/zeo1.pid --daemon \
302        pars/etc/zeo1.ini
303
304It is important to give a pid-file as paster otherwise can not start
305different clients (they would all refer to the same pid file
306`paster.pid` and refuse to start after the first client was started).
307
308
309Setup (paramters, ports, etc.)
310==============================
311
312By default the server will listen on port 8100 for requests from
313localhost (not: from the outside world).
314
315You can change ZEO server settings in the ``[zeo_server]`` section
316of ``buildout-zeo.conf``. Run `buildout` afterwards.
317
318The clients will listen on port 8081 and 8082. You can change settings
319in ``etc/zeo1.ini.in`` and ``etc/zeo2.ini.in`` respectively. Run
320buildout after any change.
321
322If you want to change the paster wrapper for any zeo client, you can
323edit ``etc/zeo1.conf`` and/or ``etc/zeo2.conf``. Run buildout
324afterwards.
325
326
327Creating new clients
328====================
329
330You want more clients to be created by buildout? Easy. Three steps are
331neccessary.
332
3331. Create config files in etc/
334------------------------------
335
336Each client needs two configuration files:
337
338  - ``etc/zeoN.conf``
339       configuring the paster wrapper
340
341  - ``etc/zeoN.ini``
342       configuring the runtime config, ports, etc.
343
344Just copy over these files from the already existing zeo1/zeo2 files
345and replace ``zeo1`` or ``zeo2`` with your new name.
346
3472. Update buildout-zeo.cfg
348--------------------------
349
350Here, inside ``buildourt-zeo.cfg`` also three steps are needed.
351
352* 2.1. Create new .ini and .conf entries
353
354  The .conf and .ini files in etc/ are only templates that have to be
355  generated in their really used final location. In buildout-zeo.cfg
356  you can care for this by creating a new ``[zeoN_ini]`` and
357  ``[zeoN_conf]`` option (replacing ``N`` with a number, of course).
358
359  Just copy over existing entries and replace the mentions of ``zeo1``
360  or ``zeo2`` by your ``zeoN``.
361
362* 2.2. Create a new ``zeo_clientN`` entry
363
364  Then you have to create an entry that will generate the
365  ``zeo_clientN`` script. Again, just copy over an existing
366  ``[zeo_client1]`` entry and replace ``1`` withg your client number.
367
368* 2.3. Register the new sections in ``[buildout]`` section
369
370  When done with the above: add the new section in ``[buildout]``::
371
372    [buildout]
373      ...
374      <old entries...>
375      ...
376      zope_conf_zeo_5
377      zeo5_ini
378      zeo_client5
379
380  depending on how you named your new sections.
381
3823. Rerun ``buildout``
383---------------------
384
385When adding or removing client/server instances, make sure to stop all
386running servers/clients before rerunning buildout.
387
388To activate the new setup, rerun buildout::
389
390  $ bin/buildout -c buildout-zeo.cfg
391
392This should generate any new clients and remove older ones or just
393update configuration files.
394
395
396Considerations
397==============
398
399There are some things in the current buildout-zeo.cfg we might do not
400want. It extends the regular ``buildout.cfg`` so that we do not have
401to repeat most sections but the ``parts`` in ``[buildout]`` have to be
402listed.
403
404We need, however, not everything with a ZEO-deploy that is listed in a
405default buildout. We might do not need docs, no profiling, etc. Also a
406regular non-ZEO kofactl might not make to much sense. Therefore all
407this might be subject to changes.
408
409.. _Debian: http://www.debian.org/
410.. _Grok: http://grok.zope.org/
411.. _Python: http://www.python.org/
412.. _Ubuntu: http://www.ubuntu.com/
413.. _virtualenv: http://www.virtualenv.org/en/latest/
414.. _WAeUP: https://www.waeup.org/
415.. _Zope: http://www.zope.org/
416.. _zc.buildout: http://cheeseshop.python.org/pypi/zc.buildout
Note: See TracBrowser for help on using the repository browser.