wiki:SysAdmin/Pootle

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.8.x/server/installation.html

Assuming a base Debian stable (10.x) - Python 2.7 as default:

apt-get update
apt-get upgrade -y
apt-get install -y exim4
dpkg-reconfigure exim4-config

apt-get install -y build-essential libxml2-dev libxslt-dev python-dev python-pip zlib1g-dev
apt-get install -y nginx python-certbot-nginx
certbot --nginx -n --agree-tos --email webmaster@sahanafoundation.org -d pootle.sahanafoundation.org
# Copy to server: /etc/nginx/sites-available/default
cd /tmp
wget https://projects.unbit.it/downloads/uwsgi-2.0.18.tar.gz
zxvf uwsgi-2.0.18.tar.gz
cd uwsgi-2.0.18
python uwsgiconfig.py --build pyonly
cp uwsgi /usr/local/bin
chmod 755 /usr/local/bin/uwsgi
# Copy to server: /etc/init.d/uwsgi-pootle
chmod 755 /etc/init.d/uwsgi-pootle
/etc/init.d/uwsgi-pootle defaults
apt-get -y install "postgresql-11" "pgtop"
cat << EOF >> "/etc/sysctl.conf"
## Increase Shared Memory available for PostgreSQL
# 1024Mb (may need more)
kernel.shmmax = 552992768
kernel.shmall = 2097152
EOF
sysctl -w kernel.shmmax=552992768 # For 1024 MB RAM
sysctl -w kernel.shmall=2097152
sed -i 's|#track_counts = on|track_counts = on|' /etc/postgresql/11/main/postgresql.conf
sed -i 's|#autovacuum = on|autovacuum = on|' /etc/postgresql/11/main/postgresql.conf
sed -i 's|max_connections = 100|max_connections = 20|' /etc/postgresql/11/main/postgresql.conf
# 1024Mb RAM: (e.g. t2.micro)
sed -i 's|#effective_cache_size = 4GB|effective_cache_size = 512MB|' /etc/postgresql/11/main/postgresql.conf
sed -i 's|#work_mem = 4MB|work_mem = 8MB|' /etc/postgresql/11/main/postgresql.conf
service postgresql restart

su postgres
createuser -P pootle
createdb --encoding='utf8' --locale=en_US.utf8 --template=template0 --owner=pootle pootledb
exit
apt-get install -y redis-server
adduser pootle
# Copy to server: /home/pootle/uwsgi.ini
# Copy to server: /home/pootle/wsgihandler.py
pip install virtualenv
su pootle
cd
virtualenv env
source env/bin/activate
pip install --upgrade pip setuptools
pip install psycopg2
pip install Pootle
pip install django-appconf==1.0.3
pip install redis==2.10.6
pootle init
# Copy to server: /home/pootle/env/pootle.conf
chown pootle /home/pootle/env/pootle.conf
mkdir -p /home/pootle/translations/eden
chown --recursive /home/pootle/translations
# Extract templates.pot using --pot in s3translate.py
# Copy to server: /home/pootle/translations/eden/templates.pot
pootle rqworker &
pootle migrate
pootle initdb
pootle createsuperuser
pootle verify_user admin
# Copy to server: /etc/init.d/rqworker
chmod 755 /etc/init.d/rqworker
/etc/init.d/rqworker defaults
reboot

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 Git & 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 /home/pootle/translations
bzip2 -z9 /root/po-\$NOW.tar
su -c - postgres "pg_dump -c pootledb > /tmp/pootledb-\$NOW.sql"
bzip2 -z9 /tmp/pootledb-\$NOW.sql
mv /tmp/pootledb-\$NOW.sql.bz2 /root
OLD=\$(date --date='7 day ago' +"%Y-%m-%d")
rm -f /root/pootledb-\$OLD.sql.bz2
rm -f /root/po-\$OLD.tar.bz2
EOF
chmod +x /usr/local/bin/backup

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

ToDo

Last modified 5 years ago Last modified on 04/04/20 21:31:20

Attachments (6)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.