Skip to content

Installation

Johannes Linke edited this page Nov 7, 2018 · 21 revisions

Installation

Vagrant

Usually it's easiest to just use the Vagrant VM. For installation instructions using Vagrant, check out the README. This creates a fully working EvaP instance including a database and test data.

You can use EvaP at http://localhost:8000/ on your host (an apache instance is available at http://localhost:8001/), write code in your git repo, and access the VM with vagrant ssh. Your git checkout is mounted in /vagrant there.

Use vagrant halt to shutdown the VM, and vagrant destroy to delete it.

Manual Installation Instructions (Linux)

We recommend that you install the application into the directory /opt/evap according to the filesystem hierarchy standard. In the remaining steps, we will assume that this is your installation directory.

  • After cloning the repository, follow the steps in the script used to create the Vagrant VM.
  • The apache server is not needed for development. When using it, make sure that all files and directories are readable by the Apache web server. Additionally please make sure that the directory /opt/evap/evap/upload is writable by the web server.
  • If you do not want to use the test data, you can use python manage.py createsuperuser to create a user to be able to log in.

Manual Installation Instructions (Windows)

Note that you still need to setup the Vagrant VM, since redis is not available for Windows. Alternatively, you can change the settings to use a different (and most likely slower) caching backend.

  • pip install --user rcssmin==1.0.6 --install-option="--without-c-extensions"
  • pip install --user rjsmin==1.0.12 --install-option="--without-c-extensions"
  • pip install --user -r .\requirements-dev.txt
  • download sassc (direct link), rename the .exe to sass.exe, put it somewhere on the PATH (e.g. into C:\Windows\System32)
  • download postgres, install it. enter evap as password
  • run "C:\PostgreSQL\pg10\bin\createuser.exe" -U postgres --createdb evap
    • enter evap as password
  • run this: "C:\PostgreSQL\pg10\bin\psql.exe" -U postgres -d postgres -c "ALTER USER evap WITH PASSWORD 'evap';"
    • enter evap as password
  • run vagrant ssh, sudo vim /etc/redis/redis.conf and add this line: bind 0.0.0.0
  • run python manage.py reload_testdata

Productive Environment: Settings

The configuration of the application is done by creating a localsettings.py in the evap folder and overwriting the defaults from settings.py there. The defaults should be OK for most development purposes. For a production environment you should change the following settings:

  • Choose an appropriate database and modify the default entry in the DATABASES settings. Please make sure that you use a database that supports transactions.
  • Change the DEFAULT_FROM_EMAIL to an administrative mail address that is used as the sender of the mails generated by the system.
  • Change MEDIA_ROOT to a directory that is writable by the web application. This directory will hold user-uploaded files.
  • You should change the SECRET_KEY.
  • Finally, set DEBUG to False.

Productive Environment: Apache 2 Configuration

See apache.template.conf for an example apache config.

Productive Environment: Updating to a new version

See update_production.sh.

Productive Environment: Kerberos Authentication

To use Kerberos as an authentication backend, do the following:

  • run pip install django_auth_kerberos

  • copy the following to your localsettings.py and edit KRB5_REALM and KRB5_SERVICE according to your setup:

KRB5_REALM = 'EXAMPLE.COM'
KRB5_SERVICE = 'krbtgt@AS.EXAMPLE.COM'
INSTALLED_APPS += ('django_auth_kerberos',)
MIDDLEWARE_CLASSES += ('django_auth_kerberos.backends.KrbBackend',)

Productive Environment: Cron Configuration

EvaP has components which need to react to timed events. This behavior is implemented by running two cronjobs, which in turn trigger a management command. One should be run hourly and the other one daily.

For example you could use a /etc/cron.daily/evap like

#!/bin/sh

pushd  /opt/evap
sudo -H -u evap /usr/bin/python manage.py send_reminders
popd

And a /etc/cron.hourly/evap like

#!/bin/sh

pushd  /opt/evap
sudo -H -u evap /usr/bin/python manage.py update_course_states
popd