~libravatar/libravatar/master

« back to all changes in this revision

Viewing changes to INSTALL

  • Committer: Francois Marier
  • Date: 2012-07-07 08:33:39 UTC
  • Revision ID: git-v1:0cc18712325e0de617af0c91546ac8f00a38b21b
Give a .md extension to the markdown files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# External dependencies
2
 
 
3
 
* Python 2.6
4
 
* Django 1.2
5
 
* Apache 2 with:
6
 
 * mod\_alias
7
 
 * mod\_expires
8
 
 * mod\_headers
9
 
 * mod\_rewrite
10
 
* [Python DNS 2.3.4](http://pydns.sourceforge.net/)
11
 
* jQuery 1.4
12
 
* [Python Imaging Library](http://www.pythonware.com/library/)
13
 
* [YUI Compressor](http://developer.yahoo.com/yui/compressor/), for minifying CSS/JS files
14
 
* [Gearman](http://www.gearman.org)
15
 
* [Python bindings for libgearman](http://www.launchpad.net/gearman-interface)
16
 
* [Python OpenID](https://github.com/openid/python-openid)
17
 
* [OpenID Integration for django.contrib.auth](https://launchpad.net/django-openid-auth)
18
 
* [HttpLib2](https://code.google.com/p/httplib2/)
19
 
* Python LDAP library (if using optional LDAP authenticaion)
20
 
 
21
 
On Debian unstable or squeeze:
22
 
 
23
 
    apt-get install python-django python-dns libjs-jquery python2.6 python-imaging libapache2-mod-wsgi python-psycopg2 yui-compressor gearman-job-server gearman-tools python-gearman.libgearman jpegoptim optipng python-openid python-django-auth-openid python-httplib2 ca-certificates
24
 
  
25
 
    apt-get install python-ldap
26
 
 
27
 
 
28
 
# Create your database
29
 
 
30
 
Create a database user:
31
 
 
32
 
    sudo -u postgres createuser djangouser
33
 
 
34
 
Create a database:
35
 
 
36
 
    sudo -u postgres createdb -O djangouser libravatar
37
 
 
38
 
Create the required tables:
39
 
 
40
 
    cd /usr/share/libravatar/libravatar
41
 
    python manage.py syncdb
42
 
 
43
 
Create an index for the sessions table (not needed for Django 1.3 or later):
44
 
 
45
 
    sudo -u postrgres psql libravatar
46
 
    CREATE INDEX "django_session_expire_date" ON "django_session" ("expire_date");
47
 
 
48
 
 
49
 
# Apache Configuration
50
 
 
51
 
Start by adding this to your /etc/hosts:
52
 
 
53
 
    127.0.0.1 www.libravatar.org cdn.libravatar.org seccdn.libravatar.org
54
 
 
55
 
Enable mod_alias, mod\_expires, mod\_headers, mod\_rewrite and mod\_wsgi:
56
 
 
57
 
    a2enmod alias
58
 
    a2enmod expires
59
 
    a2enmod headers
60
 
    a2enmod rewrite
61
 
    a2enmod wsgi
62
 
 
63
 
Create an uploaded/ directory that is writable by the www-data user:
64
 
 
65
 
    mkdir /var/lib/libravatar/uploaded
66
 
    sudo chgrp www-data /var/lib/libravatar/uploaded
67
 
    sudo chmod g+w /var/lib/libravatar/uploaded
68
 
 
69
 
as well as ready/ and user/ directories which are not writable by www-data:
70
 
 
71
 
    mkdir /var/lib/libravatar/ready
72
 
    mkdir /var/lib/libravatar/user
73
 
 
74
 
Similarly, avatar/ and export directories that are only writable by root:
75
 
 
76
 
    mkdir /var/lib/libravatar/avatar
77
 
    mkdir /var/lib/libravatar/export
78
 
 
79
 
Then copy config/*.conf to /etc/apache2/sites-enabled/, adjust the
80
 
path to the cdn-common include file and restart Apache using:
81
 
 
82
 
    apache2ctl configtest
83
 
    apache2ctl restart
84
 
 
85
 
 
86
 
# Gearman jobs
87
 
 
88
 
A few Gearman jobs must be running to fully take care of photo management:
89
 
 
90
 
* cropresize: must run under a user that has read access to /uploaded and
91
 
              write access to /ready
92
 
* ready2user: must run under a user with read access to /ready and write
93
 
              access to /uploaded and /user
94
 
* changephoto: must run as root
95
 
* deletephoto: must run as root
96
 
* resizeavatar: must run as root
97
 
* exportaccount: must run as root
98
 
 
99
 
There are python scripts under libravatar/ for all of these functions and
100
 
workers can be setup like this:
101
 
 
102
 
    gearman -w -f FUNCTION_NAME libravatar/FUNCTION_NAME.py
103
 
 
104
 
 
105
 
# Cron job
106
 
 
107
 
You should have a daily cron job which does the following:
108
 
 
109
 
* delete old sessions and exports
110
 
* delete old uploaded (i.e. non-cropped) files
111
 
 
112
 
Have a look in debian/libravatar-www.cron.daily for an example.
113
 
 
114
 
 
115
 
# Authenticating with an external LDAP server:
116
 
 
117
 
Download and install the [Django LDAP authentication backend](http://packages.python.org/django-auth-ldap/):
118
 
 
119
 
    apt-get install python-django-auth-ldap
120
 
 
121
 
Then uncomment the LDAP backend line in AUTHENTICATION\_BACKENDS in your
122
 
settings.py and set your AUTH\_LDAP\_SERVER\_URI and AUTH\_LDAP\_USER\_DN\_TEMPLATE
123
 
settings to something appropriate. More complex setups are also well documented
124
 
in the [package documentation](http://packages.python.org/django-auth-ldap/).