[11381] | 1 | Installation of Kofa |
---|
| 2 | #################### |
---|
[10120] | 3 | |
---|
[11381] | 4 | These are generic installation instructions for the WAeUP_ ``Kofa`` |
---|
| 5 | student information portal and customized versions thereof. |
---|
[10120] | 6 | |
---|
[11381] | 7 | For specific aspects of this package please refer to the local README |
---|
| 8 | file. |
---|
[10120] | 9 | |
---|
[11381] | 10 | Please note, that **only Linux-based installs** are described and actively |
---|
| 11 | supported. We recommend use of Debian_ / Ubuntu_. |
---|
[11323] | 12 | |
---|
[11381] | 13 | .. note:: This means we do not actively support Windows(tm)! |
---|
[11323] | 14 | |
---|
[11384] | 15 | .. contents:: |
---|
[11323] | 16 | |
---|
[11384] | 17 | |
---|
[11381] | 18 | Prerequisites |
---|
| 19 | ************* |
---|
[11323] | 20 | |
---|
[11381] | 21 | The Kofa packages are based on `Grok`_, which is a Python_ |
---|
| 22 | framework for agile webapplication development. Grok_ itself is based |
---|
| 23 | on `Zope`_. |
---|
[11323] | 24 | |
---|
[11381] | 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). |
---|
[11323] | 28 | |
---|
| 29 | |
---|
[11381] | 30 | Preparing the System |
---|
[11323] | 31 | ==================== |
---|
| 32 | |
---|
[11381] | 33 | For a `Kofa` install we need of course `Python`_ installed as well as |
---|
| 34 | some standard developer tools like C compilers, C libraries, etc. |
---|
[11323] | 35 | |
---|
| 36 | What you need (Debian/Ubuntu package names in brackets): |
---|
| 37 | |
---|
[11381] | 38 | * Python 2.7 (``python2.7``) |
---|
[11323] | 39 | |
---|
[11381] | 40 | * Python 2.7 development files (``python2.7-dev``) |
---|
[11323] | 41 | |
---|
[11381] | 42 | * A C-Compiler with basic C developer libraries (``build-essential``) |
---|
[11323] | 43 | |
---|
[11527] | 44 | * A subversion client (``subversion``) |
---|
[11323] | 45 | |
---|
[11527] | 46 | * XML and XSLT development libraries (``libxml2-dev``, ``libxslt1-dev``) |
---|
| 47 | |
---|
[11381] | 48 | * enscript (``enscript``) [optional] |
---|
[11323] | 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 | |
---|
[11527] | 54 | $ sudo apt-get install python2.7 python2.7-dev subversion \ |
---|
| 55 | build-essential enscript libxml2-dev libxslt1-dev |
---|
[11323] | 56 | |
---|
| 57 | Afterwards you should be able to enter:: |
---|
| 58 | |
---|
| 59 | $ python2.7 |
---|
| 60 | |
---|
[11381] | 61 | at the commandline and get a Python_ prompt. Quit the interpreter |
---|
[11323] | 62 | pressing <CTRL-D>. |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | Installing `virtualenv` |
---|
| 66 | ======================= |
---|
| 67 | |
---|
[11382] | 68 | We strongly suggest use of `virtualenv`_ to create Python_ sandboxes |
---|
| 69 | where you can run your code without touching any other installations. |
---|
[11323] | 70 | |
---|
[11382] | 71 | `virtualenv`_ is also the only possibility to build a `Kofa` install |
---|
| 72 | without the need of superuser permissions. In short: `virtualenv`_ |
---|
| 73 | will make your life easier. Use it. |
---|
[11323] | 74 | |
---|
[11382] | 75 | Detailed install instructions for `virtualenv`_ can be found on |
---|
| 76 | http://www.virtualenv.org/en/latest/virtualenv.html#installation. |
---|
[11323] | 77 | |
---|
[11382] | 78 | The short way for a user install (no superuser perms required) is like |
---|
| 79 | this:: |
---|
[11323] | 80 | |
---|
[11382] | 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 |
---|
[11323] | 85 | |
---|
[11382] | 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:: |
---|
[11323] | 89 | |
---|
[11382] | 90 | $ sudo apt-get install python-virtualenv |
---|
[11323] | 91 | |
---|
[11401] | 92 | *Or*, if `pip` is installed already (superusers can install it via |
---|
| 93 | ``sudo apt-get install python-pip`` on `Debian`_/`Ubuntu`_):: |
---|
[11323] | 94 | |
---|
[11382] | 95 | $ sudo pip install virtualenv |
---|
[11323] | 96 | |
---|
| 97 | |
---|
[11402] | 98 | Creating a Sandbox |
---|
[11323] | 99 | ================== |
---|
| 100 | |
---|
[11383] | 101 | After installing `virtualenv`_ you can install local sandboxes like |
---|
[11401] | 102 | this (if `virtualenv` is installed system-wide):: |
---|
[11323] | 103 | |
---|
[11383] | 104 | $ virtualenv --no-site-packages py27 |
---|
[11323] | 105 | |
---|
[11401] | 106 | *or* like this:: |
---|
| 107 | |
---|
| 108 | $ python /path/to/my/virtualenv.py --no-site-packages py27 |
---|
| 109 | |
---|
[11383] | 110 | where ``py27`` is a directory in the filesystem where your sandbox |
---|
| 111 | will be created. `virtualenv` will also create this directory for |
---|
[11401] | 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). |
---|
[11323] | 115 | |
---|
| 116 | By passing the ``no-site-packages`` switch we tell `virtualenv` to |
---|
[11401] | 117 | provide a clean environment without any extra-packages installed |
---|
[11383] | 118 | systemwide. More recent versions of `virtualenv`_ have this option set |
---|
| 119 | by default. |
---|
[11323] | 120 | |
---|
[11383] | 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 | |
---|
[11323] | 125 | You now can activate the sandbox by doing:: |
---|
| 126 | |
---|
[11383] | 127 | $ source py27/bin/activate |
---|
| 128 | (py27)$ |
---|
[11323] | 129 | |
---|
[11401] | 130 | You will notice that the input prompt changes, indicating the name of |
---|
| 131 | the sandbox activated. |
---|
[11323] | 132 | |
---|
| 133 | To deactivate the sandbox at any time, enter:: |
---|
| 134 | |
---|
[11383] | 135 | (py27)$ deactivate |
---|
[11323] | 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 | |
---|
[11402] | 142 | Getting the Sources |
---|
| 143 | =================== |
---|
[11323] | 144 | |
---|
[11401] | 145 | Now, as the sandbox is activated (see above, if not), we can fetch the |
---|
| 146 | sources for Kofa. |
---|
[11323] | 147 | |
---|
[11401] | 148 | As Kofa 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.kofa` package like this:: |
---|
[11323] | 151 | |
---|
[11401] | 152 | (py27)$ svn co https://svn.waeup.org/repos/main/waeup.kofa/trunk |
---|
[11323] | 153 | |
---|
| 154 | The command should fetch the Kofa base package sources for you and |
---|
[11401] | 155 | will put everything in a new directory ``trunk/``. |
---|
[11323] | 156 | |
---|
| 157 | Now enter the new directory:: |
---|
| 158 | |
---|
[11401] | 159 | (py27)$ cd trunk/ |
---|
[11323] | 160 | |
---|
[11401] | 161 | and you can start building the real package. |
---|
[11323] | 162 | |
---|
[11401] | 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:: |
---|
[11381] | 168 | |
---|
[11401] | 169 | (py27)$ svn co https://svn.waeup.org/repos/main/<PKG-NAME>/trunk |
---|
[11381] | 170 | |
---|
[11401] | 171 | For the exact link, please refer to the README.txt file in |
---|
| 172 | your package. |
---|
| 173 | |
---|
| 174 | |
---|
[11402] | 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 | |
---|
[11381] | 199 | Part 1: Single Client Setup |
---|
| 200 | *************************** |
---|
| 201 | |
---|
[11401] | 202 | You can run ``Kofa`` 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 |
---|
[11402] | 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`_. |
---|
[11401] | 208 | |
---|
[11402] | 209 | |
---|
[11404] | 210 | Building the Package |
---|
| 211 | ==================== |
---|
[11323] | 212 | |
---|
[11404] | 213 | In the sources directory (``trunk/``) you have to prepare the |
---|
[11323] | 214 | project to fetch needed components (eggs), compile C-code parts, |
---|
[11404] | 215 | etc. This is done by a single command ``buildout``:: |
---|
[11323] | 216 | |
---|
[11404] | 217 | $ ./bin/buildout |
---|
[11323] | 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 |
---|
[11404] | 224 | ``buildout.cfg``, ``buildout-zeo.cfg``, or ``setup.py``. |
---|
[11323] | 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 | |
---|
[11385] | 232 | [buildout] |
---|
| 233 | eggs-directory = /home/bruno/buildout-eggs |
---|
[11323] | 234 | |
---|
[11404] | 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). |
---|
[11323] | 238 | |
---|
[11404] | 239 | |
---|
| 240 | Start the Instance |
---|
[11323] | 241 | ================== |
---|
| 242 | |
---|
| 243 | You should be able now to start the created instance by doing:: |
---|
| 244 | |
---|
[11404] | 245 | $ ./bin/kofactl fg |
---|
[11323] | 246 | |
---|
[11385] | 247 | Alternatively you can do:: |
---|
[11323] | 248 | |
---|
[11404] | 249 | $ bin/paster serve parts/etc/deploy-themed.ini |
---|
[11323] | 250 | |
---|
| 251 | The port numbers where Kofa is running on your server are defined in |
---|
[11404] | 252 | `buildout.cfg` under ``[kofa_params]``. |
---|
[11323] | 253 | |
---|
[11404] | 254 | If you now point a browser to the right port on your server, for example:: |
---|
[11323] | 255 | |
---|
[11385] | 256 | localhost:8080 |
---|
[11323] | 257 | |
---|
| 258 | you 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 | |
---|
| 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 | |
---|
[11404] | 270 | Running the Tests |
---|
[11323] | 271 | ================= |
---|
| 272 | |
---|
[11404] | 273 | All WAeUP_ packages come with comprehensive test suites ensuring the |
---|
| 274 | software quality also after changes and updates. |
---|
[11323] | 275 | |
---|
[11404] | 276 | The package tests are easily run by executing the test runner |
---|
| 277 | from the ``bin`` directory:: |
---|
[11323] | 278 | |
---|
[11404] | 279 | $ ./bin/test |
---|
[11323] | 280 | |
---|
[11404] | 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 | |
---|
[11402] | 285 | Part 2: ZEO Install |
---|
| 286 | ******************* |
---|
[11323] | 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 | |
---|
[11405] | 297 | Generating the ZEO Setup |
---|
[11323] | 298 | ======================== |
---|
| 299 | |
---|
| 300 | To 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 | |
---|
| 305 | This should generate all scripts necessary to run servers, clients, |
---|
| 306 | etc. |
---|
| 307 | |
---|
[11405] | 308 | Starting ZEO Servers and Clients |
---|
[11323] | 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 | |
---|
[11405] | 326 | Manually Starting ZEO Clients |
---|
[11323] | 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 | |
---|
[11405] | 338 | It is important to give a pid-file as `paster` otherwise can not start |
---|
[11323] | 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 | |
---|
[11405] | 361 | Stopping ZEO Servers and Clients |
---|
| 362 | ================================ |
---|
[11323] | 363 | |
---|
[11405] | 364 | Given everything was started in daemon mode, first stop the clients:: |
---|
[11323] | 365 | |
---|
[11405] | 366 | $ ./bin/zeo_client1 stop |
---|
| 367 | $ ./bin/zeo_client2 stop |
---|
[11323] | 368 | |
---|
[11405] | 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 | |
---|
[11323] | 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 kofactl might not make to much sense. Therefore all |
---|
| 454 | this might be subject to changes. |
---|
[11381] | 455 | |
---|
| 456 | .. _Debian: http://www.debian.org/ |
---|
| 457 | .. _Grok: http://grok.zope.org/ |
---|
| 458 | .. _Python: http://www.python.org/ |
---|
[11401] | 459 | .. _Subversion: http://subversion.apache.org/ |
---|
[11381] | 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 |
---|