Changeset 17263 for main/waeup.kofa/trunk/docs
- Timestamp:
- 10 Jan 2023, 14:12:55 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/INSTALL.txt
r15892 r17263 2 2 #################### 3 3 4 These are generic installation instructions for the WAeUP _Kofa4 These are generic installation instructions for the WAeUP.Kofa 5 5 student information portal and customized versions thereof. 6 6 … … 15 15 .. contents:: Table of Contents 16 16 :local: 17 18 .. _prerequisites:19 20 21 Quick Install on Ubuntu 18.0422 *****************************23 24 If you want to install Kofa on a running Ubuntu system, the following quick25 steps might be sufficient::26 27 ## install neccessary system packages as superuser28 $ sudo apt-get update && apt-get install -y # update system29 $ 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 libopenjp2-7-dev30 31 ## get sources as regular user32 $ wget https://pypi.python.org/packages/ed/0f/0b30fcf8c113b11967c1481668b38b4b9e32f256eb366f73b70ff960872f/waeup.kofa-1.5.tar.gz && tar -xzf waeup.kofa-1.5.tar.gz33 $ cd waeup.kofa-1.534 35 ## create python sandbox and build kofa36 $ virtualenv py2737 $ source py27/bin/activate38 $ pip install --upgrade pip39 $ python bootstrap.py40 $ ./bin/buildout41 42 To run Kofa, now do::43 44 ## startup Kofa in foreground (recommended for first start)45 $ ./bin/kofactl fg46 ## press CTRL-D to stop the kofa server47 48 ## startup Kofa in background49 $ ./bin/kofactl start50 $ ./bin/kofactl status # check status, running or not51 $ ./bin/kofactl stop # stop running instance (also 'restart' possible)52 53 When Kofa is running, you can access the portal on port 8080. Open54 55 http://localhost:8080/56 57 and enter the credentials (username 'grok', password 'grok' by58 default) and name and add a `University`.59 60 Congratulations, you got Kofa running.61 17 62 18 … … 74 30 75 31 76 Preparing the System 77 ==================== 32 Quick Install on Ubuntu 20.04 or 22.04 33 ************************************** 78 34 79 For a Kofa install we need of course `Python`_ installed as well as 80 s ome standard developer tools like C compilers, C libraries, etc.35 If you want to install Kofa on an Ubuntu system, the following quick 36 steps might be sufficient:: 81 37 82 What you need (Debian/Ubuntu package names in brackets): 38 ## install neccessary system packages as superuser 83 39 84 * Python 2.7 (``python2.7``) 40 $ sudo apt-get update && apt-get install -y tzdata 41 $ sudo apt-get install -y apt-utils build-essential 42 $ sudo apt-get install -y python2.7-dev libxml2-dev libxslt1-dev \ 43 zlib1g-dev python3-virtualenv 44 # see https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl 45 $ sudo apt-get install -y libssl-dev libffi-dev 46 # libs needed/useful for Pillow image manipulations 47 $ sudo apt-get install -y libjpeg-dev libfreetype6-dev libtiff-dev libopenjp2-7-dev 85 48 86 * Python 2.7 development files (``python2.7-dev``) 49 ## add user `kofa` 87 50 88 * A C-Compiler with basic C developer libraries (``build-essential``) 51 $ sudo useradd -ms /bin/bash kofa 52 # set password of user `kofa` and add to group 'sudo' 53 $ sudo echo kofa:kofa | chpasswd && adduser kofa sudo 54 # proceed as user `kofa` 89 55 90 * A subversion client (``subversion``) 56 ## proceed as user `kofa` 91 57 92 * XML and XSLT development libraries (``libxml2-dev``, ``libxslt1-dev``) 58 $ sudo su kofa 59 $ cd /home/kofa 93 60 94 * Other helper libraries, especially for image processing support 95 (``zlib1g-dev``, ``libssl-dev``, ``libffi-dev``, ``libjpeg-dev``, 96 ``libfreetype6-dev``, ``libtiff-dev`` ``libopenjpeg-dev``) 61 ## create python sandbox and install packages inside 97 62 98 * enscript (``enscript``) [optional] 63 $ virtualenv -p /usr/bin/python2.7 py27 64 $ source py27/bin/activate 65 # pin down `pip` and `setuptools` - just to ensure we have a fixed set of versions 66 (py27)$ py27/bin/pip install --upgrade pip==20.3.4 67 (py27)$ py27/bin/pip install --upgrade --force-reinstall setuptools==44.1.1 68 # pin down `zc.buildout` - versions >= 3 make entry-points of installed eggs 69 # invisible for `pgk_resources` 70 (py27)$ py27/bin/pip install "zc.buildout<3" 71 (py27)$ deactivate 99 72 100 This is only needed if you want test coverage reports.73 ## get sources 101 74 102 All these packages can be installed on Debian systems like this:: 75 # we can work with official PyPI sources... 76 $ py27/bin/pip download --no-deps waeup.kofa==1.8 && tar -xzf waeup.kofa-1.8.tar.gz 77 $ mv waeup.kofa-1.8 waeup.kofa 78 $ cd waeup.kofa 103 79 104 $ sudo apt-get install python2.7 python2.7-dev subversion \ 105 build-essential enscript libxml2-dev libxslt1-dev \ 106 zlib1g-dev libssl-dev libffi-dev libjpeg-dev \ 107 libfreetype6-dev libtiff-dev libopenjpeg-dev 80 ## build Kofa 108 81 109 Afterwards you should be able to enter:: 82 $ ../py27/bin/buildout 110 83 111 $ python2.784 ## startup Kofa in foreground 112 85 113 at the commandline and get a Python_ prompt. Quit the interpreter 114 pressing <CTRL-D>. 86 $ bin/kofactl fg 87 # press CTRL-D to stop the kofa server 115 88 116 The above packages have been tested to be sufficient for running Kofa 117 on Ubuntu. We check this with Docker images created at 89 ## startup Kofa in background 118 90 119 https://github.com/WAeUP/kofa-docker 91 $ bin/kofactl start 92 $ bin/kofactl status # check status, running or not 93 $ bin/kofactl stop # stop running instance (also 'restart' possible) 120 94 121 This project provides tags that refer to certain Kofa versions. 95 When Kofa is running, you can access the portal on port 8080: 122 96 123 Please note: to make freetype2 work correctly with Kofa [#]_, you have to 124 fix a link:: 97 http://localhost:8080/ 125 98 126 (root) $ ln -s /usr/include/freetype2 /usr/include/freetype2/freetype 99 Enter the credentials (username 'grok', password 'grok' by default) 100 and name and add a `University`. 101 102 Congratulations, you got Kofa running. 127 103 128 104 129 130 131 Installing `virtualenv`132 =======================133 134 We strongly suggest use of `virtualenv`_ to create Python_ sandboxes135 where you can run your code without touching any other installations.136 137 `virtualenv`_ is also the only possibility to build a Kofa install138 without the need of superuser permissions. In short: `virtualenv`_139 will make your life easier. Use it.140 141 Detailed install instructions for `virtualenv`_ can be found on142 http://www.virtualenv.org/en/latest/virtualenv.html#installation.143 144 The short way for a user install (no superuser perms required) is like145 this::146 147 $ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.4.tar.gz#md5=9accc2d3f0ec1da479ce2c3d1fdff06e148 $ tar xvfz virtualenv-1.11.4.tar.gz149 $ cd virtualenv-1.11.4150 $ python virtualenv.py py27151 152 Superusers can install `virtualenv`_ system-wide much easier. On153 `Debian`_/`Ubuntu`_ systems where you have superuser permissions, you154 can install `virtualenv`_ via::155 156 $ sudo apt-get install python-virtualenv157 158 *Or*, they install if `pip` first::159 160 $ sudo apt-get install python-pip161 162 and then use `pip` to install `virtualenv`_::163 164 $ sudo pip install virtualenv165 166 167 Creating a Sandbox168 ==================169 170 After installing `virtualenv`_ you can install local sandboxes like171 this (if `virtualenv` is installed system-wide)::172 173 $ virtualenv --no-site-packages py27174 175 *or* like this::176 177 $ python /path/to/my/virtualenv.py --no-site-packages py27178 179 where ``py27`` is a directory in the filesystem where your sandbox180 will be created. `virtualenv` will also create this directory for181 you. While you can pick any sandbox name you want, it is recommended182 to use a sandbox name that is short and at the same time reflects the183 Python version used (here: Python 2.7).184 185 By passing the ``no-site-packages`` switch we tell `virtualenv` to186 provide a clean environment without any extra-packages installed187 systemwide. More recent versions of `virtualenv`_ have this option set188 by default.189 190 Another often used option of `virtualenv`_ is ``-p``. With ``-p`` you191 can tell `virtualenv`_ which Python executable to use as base for the192 new sandbox.193 194 You now can activate the sandbox by doing::195 196 $ source py27/bin/activate197 (py27)$198 199 You will notice that the input prompt changes, indicating the name of200 the sandbox activated.201 202 To deactivate the sandbox at any time, enter::203 204 (py27)$ deactivate205 206 and the prompt will be the same as before the activation.207 208 For the following steps make sure the sandbox is active.209 210 211 Getting the Sources212 ===================213 214 Now, as the sandbox is activated (see above, if not), we can fetch the215 sources for Kofa.216 217 Source from PyPI218 ----------------219 220 Official releases are always uploaded to PyPI. Please have a look at221 222 http://pypi.python.org/pypi/waeup.kofa223 224 where you can download all you need.225 226 From the commandline you can also get sources like this::227 228 (py27)$ wget https://pypi.python.org/packages/source/w/waeup.kofa/waeup.kofa-1.5.tar.gz229 230 where ``1.5`` is, of course, only one possible version.231 232 233 Source from Subversion234 ----------------------235 236 If you have access to the (restricted) developer repository (if you237 don't know, then you have not), then you can use the Subversion_238 client `svn` and checkout the main devel branch of the `waeup.kofa`239 package like this::240 241 (py27)$ svn co https://svn.waeup.org/repos/main/waeup.kofa/trunk242 243 The command should fetch the Kofa base package sources for you and244 will put everything in a new directory ``trunk/``.245 246 Now enter the new directory::247 248 (py27)$ cd trunk/249 250 and you can start building the real package.251 252 .. note:: If you not want to work with the `waeup.kofa` package but a253 customized package (like ``waeup.aaue`` or similar), then254 you can use the above checkout command but with255 ``waeup.kofa`` replaced by the name of the customized256 package::257 258 (py27)$ svn co https://svn.waeup.org/repos/main/<PKG-NAME>/trunk259 260 For the exact link, please refer to the README.txt file in261 your package.262 263 264 Bootstrapping the Build265 =======================266 267 After `Creating a Sandbox`_ and `Getting the Sources`_ we have to268 initialize the newly created development environment::269 270 (py27)$ python bootstrap.py271 272 This should create a local ``bin/`` directory with at least a script273 ``buildout`` in it.274 275 If bootstrapping fails, chances are, that you need the `distribute`276 package installed. In a virtual environment you can install it without277 interfering with other packages installed on your server::278 279 (py27)$ pip install --upgrade distribute280 281 Afterwards you have to retry the bootstrapping, until you get a282 working ``buildout`` script in the local ``bin/`` directory.283 284 Once the ``buildout`` script exists, you do not have to activate the285 virtual envronment any more (although you can).286 287 288 Part 1: Single Client Setup289 ***************************290 291 You can run Kofa with a single client (useful for evaluation,292 development, etc.) or with multiple clients running in parallel. The293 latter setup is useful in productive environments with many thousands294 users and called a ``ZEO`` install. We will cover both setup295 types. The first is covered here, the latter one is covered in `Part296 2: ZEO Install`_.297 298 299 Building the Package300 ====================301 302 In the sources directory (``trunk/``) you have to prepare the303 project to fetch needed components (eggs), compile C-code parts,304 etc. This is done by a single command ``buildout``::305 306 $ ./bin/buildout307 308 If this is your first install of some Grok-related project, this step309 will need some time as lots of sources have to be fetched, many310 components must be compiled, etc.311 312 This step must be redone whenever you change something in313 ``buildout.cfg``, ``buildout-zeo.cfg``, or ``setup.py``.314 315 Note that if you have more than one sandbox for a Zope-based web316 application, it will probably make sense to share the eggs between the317 different sandboxes. You can tell ``zc.buildout`` to use a central318 eggs directory by creating ``~/.buildout/default.cfg`` with the319 following contents::320 321 [buildout]322 eggs-directory = /home/bruno/buildout-eggs323 324 where the given directory should be exist beforehand. All eggs of all325 `buildout` projects will then be stored in this directory (and not326 fetched anew if already existing there).327 328 329 Start the Instance330 ==================331 332 You should be able now to start the created instance by doing::333 334 $ ./bin/kofactl fg335 336 Alternatively you can do::337 338 $ bin/paster serve parts/etc/deploy-themed.ini339 340 The port numbers where Kofa is running on your server are defined in341 `buildout.cfg` under ``[kofa_params]``.342 343 If you now point a browser to the right port on your server, for example::344 345 localhost:8080346 347 you should get a login pop-up, where you can login as superuser with348 ``grok`` and ``grok`` as username/password (Kofa base package only!).349 350 You can stop the instance by pressing <CTRL-C>.351 352 If you are connected and logged in,353 you should be able to add the grok-based applications354 (such as ``University``) from the menu.355 356 Add an instance of ``University`` and click on the link next to the357 then visible entry in the list of installed applications.358 359 Running the Tests360 =================361 362 All WAeUP_ packages come with comprehensive test suites ensuring the363 software quality also after changes and updates.364 365 The package tests are easily run by executing the test runner366 from the ``bin`` directory::367 368 $ ./bin/test369 370 Use the ``-c`` option to get coloured output. Use the ``--pdb`` option371 to start the Python_ debugger when a test fails.372 373 374 Part 2: ZEO Install375 *******************376 377 Each ZEO install consists of at least one ZEO server and normally two378 or more ZEO clients. While the ZEO server is meant to manage the ZODB379 database for clients, the clients connect to the outside world, listen380 for request and do the real dataprocessing.381 382 We prepared a `buildout` configuration that sets up one server383 configuration and two client configs. This configuration is in384 ``buildout-zeo.cfg``.385 386 Generating the ZEO Setup387 ========================388 389 To install Kofa ZEO-based you can run `buildout` with the given390 (or your own) configuration file like this::391 392 $ ./bin/buildout -c buildout-zeo.cfg393 394 This should generate all scripts necessary to run servers, clients,395 etc.396 397 Starting ZEO Servers and Clients398 ================================399 400 First start the server::401 402 $ ./bin/zeo_server start403 404 Clients can be started by doing::405 406 $ ./bin/zeo_client1 start407 $ ./bin/zeo_client2 start408 409 This will start both clients in daemon mode.410 411 Instead of ``start`` you can, as usually, start an instance in412 foreground (``fg``), etc. You know the drill.413 414 415 Manually Starting ZEO Clients416 =============================417 418 This is normally not neccessary.419 420 ``zeo_clientN`` scripts are basically wrappers around calls to421 ``bin/paster``. You can bypass this wrapper and start a client422 'manually' like this::423 424 $ ./bin/paster serve --pid-file var/zeo1.pid --daemon \425 pars/etc/zeo1.ini426 427 It is important to give a pid-file as `paster` otherwise can not start428 different clients (they would all refer to the same pid file429 `paster.pid` and refuse to start after the first client was started).430 431 432 Setup (parameters, ports, etc.)433 ===============================434 435 By default the server will listen on port 8100 for requests from436 localhost (not: from the outside world).437 438 You can change ZEO server settings in the ``[zeo_server]`` section439 of ``buildout-zeo.conf``. Run `buildout` afterwards.440 441 The clients will listen on port 8081 and 8082. You can change settings442 in ``etc/zeo1.ini.in`` and ``etc/zeo2.ini.in`` respectively. Run443 buildout after any change.444 445 If you want to change the paster wrapper for any zeo client, you can446 edit ``etc/zeo1.conf`` and/or ``etc/zeo2.conf``. Run buildout447 afterwards.448 449 450 Stopping ZEO Servers and Clients451 ================================452 453 Given everything was started in daemon mode, first stop the clients::454 455 $ ./bin/zeo_client1 stop456 $ ./bin/zeo_client2 stop457 458 Then stop the ZEO server::459 460 $ ./bin/zeo_server stop461 462 463 Creating New ZEO Clients464 ========================465 466 You want more ZEO clients to be created by `buildout`? Easy. Three467 steps are neccessary.468 469 1. Create config files in `etc/`470 --------------------------------471 472 Each client needs two configuration files:473 474 - ``etc/zeoN.conf``475 configuring the paster wrapper476 477 - ``etc/zeoN.ini``478 configuring the runtime config, ports, etc.479 480 Just copy over these files from the already existing zeo1/zeo2 files481 and replace ``zeo1`` or ``zeo2`` with your new name.482 483 2. Update buildout-zeo.cfg484 --------------------------485 486 Here, inside ``buildourt-zeo.cfg`` also three steps are needed.487 488 * 2.1. Create new .ini and .conf entries489 490 The .conf and .ini files in etc/ are only templates that have to be491 generated in their really used final location. In buildout-zeo.cfg492 you can care for this by creating a new ``[zeoN_ini]`` and493 ``[zeoN_conf]`` option (replacing ``N`` with a number, of course).494 495 Just copy over existing entries and replace the mentions of ``zeo1``496 or ``zeo2`` by your ``zeoN``.497 498 * 2.2. Create a new ``zeo_clientN`` entry499 500 Then you have to create an entry that will generate the501 ``zeo_clientN`` script. Again, just copy over an existing502 ``[zeo_client1]`` entry and replace ``1`` withg your client number.503 504 * 2.3. Register the new sections in ``[buildout]`` section505 506 When done with the above: add the new section in ``[buildout]``::507 508 [buildout]509 ...510 <old entries...>511 ...512 zope_conf_zeo_5513 zeo5_ini514 zeo_client5515 516 depending on how you named your new sections.517 518 3. Rerun ``buildout``519 ---------------------520 521 When adding or removing client/server instances, make sure to stop all522 running servers/clients before rerunning buildout.523 524 To activate the new setup, rerun buildout::525 526 $ bin/buildout -c buildout-zeo.cfg527 528 This should generate any new clients and remove older ones or just529 update configuration files.530 531 532 Considerations533 ==============534 535 There are some things in the current buildout-zeo.cfg we might do not536 want. It extends the regular ``buildout.cfg`` so that we do not have537 to repeat most sections but the ``parts`` in ``[buildout]`` have to be538 listed.539 540 We need, however, not everything with a ZEO-deploy that is listed in a541 default buildout. We might do not need docs, no profiling, etc. Also a542 regular non-ZEO kofactl might not make to much sense. Therefore all543 this might be subject to changes.544 105 545 106 .. _Debian: http://www.debian.org/ … … 552 113 .. _Zope: http://www.zope.org/ 553 114 .. _zc.buildout: http://cheeseshop.python.org/pypi/zc.buildout 554 .. [#] Strictly speaking, this link fix is required by ``Pillow``, a 555 library used by Kofa to provide higher-level image processing. 115
Note: See TracChangeset for help on using the changeset viewer.