wiki:SysAdmin/Pootle

Version 21 (modified by Fran Boon, 11 years ago) ( diff )

--

Pootle

Pootle is used to allow translators to collaborate on both doing the initial translation & refining it once 'completed'.

Installation

http://docs.translatehouse.org/projects/pootle/en/stable-2.5.0/server/installation.html

Assuming a base Debian stable (6.x):

apt-get install -y bzip2 less unzip
apt-get install -y libapache2-mod-wsgi
apt-get install -y mysql-server python-mysqldb phpmyadmin mytop
apt-get install -y python-setuptools
apt-get install -y iso-codes

apt-get install -y exim4-config exim4-daemon-light
dpkg-reconfigure exim4-config

apt-get install -y gcc python-dev
wget http://downloads.sourceforge.net/project/translate/python-Levenshtein/0.10.1/python-Levenshtein-0.10.1.tar.bz2
tar jxvf python-Levenshtein-0.10.1.tar.bz2
cd python-Levenshtein-0.10.1
python setup.py install
cd ..

apt-get install -y memcached
wget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.51.tar.gz
tar zxvf python-memcached-1.51.tar.gz
cd python-memcached-1.51
python setup.py install
cd ..

wget http://downloads.sourceforge.net/project/translate/Translate%20Toolkit/1.10.0/translate-toolkit-1.10.0.tar.bz2
tar jxvf translate-toolkit-1.10.0.tar.bz2
cd translate-toolkit-1.10.0
python setup.py install
cd ..

wget --no-check-certificate -O Django-1.4.5.tar.gz https://www.djangoproject.com/download/1.4.5/tarball/
tar zxvf Django-1.4.5.tar.gz
cd Django-1.4.5
python setup.py install
cd ..

# @ToDo: https://lucene.apache.org/pylucene/

wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
tar zxvf pip-1.3.1.tar.gz
cd pip-1.3.1
python setup.py install
cd ..

apt-get install -y libxslt1-dev
pip install virtualenv
#virtualenv /var/www/pootle/env/
#source /var/www/pootle/env/bin/activate
pip install pootle

# Reduce MaxClients
sed -i 's|150|20|' /etc/apache2/apache2.conf

cd /var/www
ln -s /usr/local/lib/python2.6/dist-packages/pootle

adduser --system --disabled-password --home /var/www/pootle pootle
addgroup pootle

chown www-data /var/www/pootle/po

mysql -u root -p
 > CREATE DATABASE pootle CHARACTER SET = 'utf8';
 > GRANT ALL PRIVILEGES ON pootle.* TO pootle@localhost IDENTIFIED BY 'pootlepassword';
 > FLUSH PRIVILEGES;

#sed -i "s|'localhost'|'pootle.sahanafoundation.org'|" /var/www/pootle/settings/90-local.conf.sample
sed -i 's|django.db.backends.sqlite3|django.db.backends.mysql|' /var/www/pootle/settings/20-backends.conf
sed -i "s|working_path('dbs/pootle.db')|'pootle'|" /var/www/pootle/settings/20-backends.conf
sed -i "s|'USER': ''|'USER': 'pootle'|" /var/www/pootle/settings/20-backends.conf
sed -i "s|'PASSWORD': ''|'PASSWORD': 'pootlepassword'|" /var/www/pootle/settings/20-backends.conf
sed -i "s|'BACKEND': 'django.core.cache.backends.db.DatabaseCache'|'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache'|" /var/www/pootle/settings/20-backends.conf
sed -i "s|'LOCATION': 'pootlecache'|'LOCATION': '127.0.0.1:11211'|" /var/www/pootle/settings/20-backends.conf
sed -i "s|# ('Your Name', 'your_email@domain.com')|  ('Fran Boon', 'fran@sahanafoundation.org')|" /var/www/pootle/settings/30-site.conf
sed -i "s|info@YOUR_DOMAIN.com|pootle@sahanafoundation.org|" /var/www/pootle/settings/30-site.conf

pootle --config=/var/www/pootle/settings/20-backends.conf syncdb --noinput
pootle --config=/var/www/pootle/settings/20-backends.conf initdb

cat << EOF > "/var/www/pootle/wsgi.py"
import os, site
site.addsitedir('/var/www/pootle/apps')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pootle.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
EOF

cat << EOF > "/etc/apache2/sites-available/pootle"
WSGIScriptAlias / /var/www/pootle/wsgi.py
WSGIDaemonProcess pootle processes=2 threads=3 stack-size=1048576 maximum-requests=5000 inactivity-timeout=900 display-name=%{GROUP}
WSGIProcessGroup pootle
Alias /assets /var/www/pootle/assets
<Directory /var/www/pootle/assets>
Order deny,allow
Allow from all
</Directory>
Alias /export /var/www/pootle/po
<Directory /var/www/pootle/po>
Order deny,allow
Allow from all
</Directory>
EOF

a2ensite pootle
/etc/init.d/apache2 restart

Usage

See UserGuidelines/Localisation#A.UsingPootle

Maintenance

When adding languages, use this resource to configure them properly:

The script that Fran used to use to update files between Bzr & Pootle is:

If the script fails, check for the presence of a ` in a T("") - this causes the languages.py to reset the languages/* to default &/or stop web2py2po from working!

Backups

cat << EOF > "/usr/local/bin/backup"
#!/bin/sh
NOW=\$(date +"%Y-%m-%d")
tar cvf /root/po-\$NOW.tar
gzip -9 /root/po-\$NOW.tar
mysqldump pootle> /root/backup-\$NOW.sql
OLD=\$(date --date='7 day ago' +"%Y-%m-%d")
rm -f /root/backup-\$OLD.sql
rm -f /root/po-\$OLD.tar.gz
EOF
chmod +x /usr/local/bin/backup

# Schedule backups for 02:01 daily echo "1 2 * * * * root /usr/local/bin/backup" >> "/etc/crontab"

ToDo

Attachments (6)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.