Verbatim:Deployment: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(partial update for Pootle 1.3 (work in progress))
(Instructions for stray readers, update to 2010 realities)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Verbatim]] » Deployment
[[Verbatim]] » Deployment
NOTE:  This page contains notes about Mozilla's installation of Pootle.  If you wish to install Pootle, the best would be to consult the [http://translate.sourceforge.net/wiki/pootle/index documentation of the Pootle project].


== Pre-Deployment Checklist ==
== Pre-Deployment Checklist ==
* Prerequisites
* Prerequisites
** Python >= 2.4
** Python >= 2.4
** ([http://translate.sourceforge.net/wiki/pootle/installation_1.3beta list of dependencies])
** [http://pip.openplans.org/ pip]
*** Some of these probably exist as RPMs, but they can also just be installed into the virtualenv
** python-sqlite2
*** python-lxml
** python-ldap
*** python-sqlite2
** MySQL-python
*** python-ldap
** At least gettext version 0.15.  This seems to upgrade cleanly in Redhat with no dependency issues ([https://bugzilla.mozilla.org/show_bug.cgi?id=438706 bug 438706])
** At least gettext version 0.15.  This seems to upgrade cleanly in Redhat with no dependency issues ([https://bugzilla.mozilla.org/show_bug.cgi?id=438706 bug 438706])
** At least SVN 1.5 (we make use of --with-revprop)
** At least SVN 1.5 (we make use of <code>--with-revprop</code>)
** libxml2-devel
** libxslt-devel
** python-devel
 
([http://translate.sourceforge.net/wiki/pootle/installation list of Pootle's dependencies])


== Setup ==
== Setup ==
I've added some scripts etc. to [https://gist.github.com/cb33a48c6945db24f13a github].
As the apache user, pick a dir where you want to deploy Pootle (pootle_dir), then:
As the apache user, pick a dir where you want to deploy Pootle (pootle_dir), then:
* cd pootle_dir
 
* virtualenv pootle_env
* Create and activate a virtualenv
* ...
** <code>cd pootle_dir</code>
** <code>virtualenv pootle_env</code>
** <code>. pootle_env/bin/activate</code>
* Install all required packages using <code>pip</code>
** <code>wget .../requirements.txt</code> (from github)
** <code>pip -E pootle_env install -r requirements.txt</code>
* Download and extract Pootle itself (from the [http://sourceforge.net/projects/translate/files/Pootle/ SourceForge releases]) so that it lives under pootle_dir/Pootle
 
Set up Apache and mod_python to properly run Pootle
* <code>cd pootle_env/bin</code>
* <code>wget .../modpython_wrapper.py</code> (from github); chmod +x it
* set up Apache config similarly to the <code>apache-host.conf</code> on github; important parts:
** <code>PythonHandler modpython_wrapper</code> refers to the .py file we put into <code>pootle_dir/pootle_env</code> above.
** make sure to adjust pootle_dir appropriately in all places
** the config should in the end use HTTPS and forward HTTP->HTTPS, because we use LDAP auth


== Configuration ==
== Configuration ==
* [http://micropipes.com/blog/2008/09/19/committing-to-svn-securely-from-a-web-application/ more details on these steps] but a summary:
* set up SVN user ([http://micropipes.com/blog/2008/09/19/committing-to-svn-securely-from-a-web-application/ more details on these steps] but here's a summary):
# Create a Verbatim SSH account on the SVN server using an SSH key with no passphrase
# Create a Verbatim SSH account on the SVN server using an SSH key with no passphrase
# Copy the key to a .ssh directory in the home directory of the verbatim user on the verbatim server
# Copy the key to a .ssh directory in the home directory of the verbatim user on the verbatim server
# Add commit hooks to the SVN server for translate:author
# Add commit hooks to the SVN server for translate:author
# checkout https://translate.svn.sourceforge.net/svnroot/translate/src/branches/mozootle
* check out inital projects into <code>Pootle/po/(project-slug)</code>, for example:
# Copy pootle.prefs to a configuration directory and configure it
# <code>cd pootle_dir/Pootle/po</code>
# The command to run the server is ''./PootleServer --prefsfile=/path/to/pootle.prefs --port=80''
# <code>svn co svn+ssh://svn.mozilla.org/addons/trunk/site/app/locale amo</code>
** note: the pootle tree must be owned by whatever user is running the pootle server
* set up Pootle itself
# create a MySQL db and user
# set up a memcached instance for Pootle
# edit <code>Pootle/localconfig.py</code>, there:
# change <code>DATABASE_*</code>
# switch <code>AUTHENTICATION_BACKENDS</code> to use LDAP, and adjust the credentials/settings there
# switch <code>CACHE_BACKEND</code> with the memcached option
* initialize Pootle
# in <code>pootle_dir/Pootle</code>, run the database initialization steps, including creation of a first admin user:
# <code>./manage.py syncdb</code>
# <code>./manage.py initdb</code>
# <code>./manage.py refresh_stats</code>


== Post-deployment Checklist ==
== Post-deployment Checklist ==
* make sure at the very least <code>/po</code> and <code>/dbs</code> are owned and writeable by the apache user, probably <code>pootle/settings.py</code> too.
* once it all works, switch <code>DEBUG</code> in <code>localconfig.py</code> to'' False''
''todo: verification things are working, cron jobs, nagios checks, etc.''
''todo: verification things are working, cron jobs, nagios checks, etc.''
You might also want to look into tips for [http://translate.sourceforge.net/wiki/pootle/optimisation Pootle optimisation]].

Latest revision as of 08:36, 29 June 2010

Verbatim » Deployment

NOTE: This page contains notes about Mozilla's installation of Pootle. If you wish to install Pootle, the best would be to consult the documentation of the Pootle project.

Pre-Deployment Checklist

  • Prerequisites
    • Python >= 2.4
    • pip
    • python-sqlite2
    • python-ldap
    • MySQL-python
    • At least gettext version 0.15. This seems to upgrade cleanly in Redhat with no dependency issues (bug 438706)
    • At least SVN 1.5 (we make use of --with-revprop)
    • libxml2-devel
    • libxslt-devel
    • python-devel

(list of Pootle's dependencies)

Setup

I've added some scripts etc. to github.

As the apache user, pick a dir where you want to deploy Pootle (pootle_dir), then:

  • Create and activate a virtualenv
    • cd pootle_dir
    • virtualenv pootle_env
    • . pootle_env/bin/activate
  • Install all required packages using pip
    • wget .../requirements.txt (from github)
    • pip -E pootle_env install -r requirements.txt
  • Download and extract Pootle itself (from the SourceForge releases) so that it lives under pootle_dir/Pootle

Set up Apache and mod_python to properly run Pootle

  • cd pootle_env/bin
  • wget .../modpython_wrapper.py (from github); chmod +x it
  • set up Apache config similarly to the apache-host.conf on github; important parts:
    • PythonHandler modpython_wrapper refers to the .py file we put into pootle_dir/pootle_env above.
    • make sure to adjust pootle_dir appropriately in all places
    • the config should in the end use HTTPS and forward HTTP->HTTPS, because we use LDAP auth

Configuration

  1. Create a Verbatim SSH account on the SVN server using an SSH key with no passphrase
  2. Copy the key to a .ssh directory in the home directory of the verbatim user on the verbatim server
  3. Add commit hooks to the SVN server for translate:author
  • check out inital projects into Pootle/po/(project-slug), for example:
  1. cd pootle_dir/Pootle/po
  2. svn co svn+ssh://svn.mozilla.org/addons/trunk/site/app/locale amo
  • set up Pootle itself
  1. create a MySQL db and user
  2. set up a memcached instance for Pootle
  3. edit Pootle/localconfig.py, there:
  4. change DATABASE_*
  5. switch AUTHENTICATION_BACKENDS to use LDAP, and adjust the credentials/settings there
  6. switch CACHE_BACKEND with the memcached option
  • initialize Pootle
  1. in pootle_dir/Pootle, run the database initialization steps, including creation of a first admin user:
  2. ./manage.py syncdb
  3. ./manage.py initdb
  4. ./manage.py refresh_stats

Post-deployment Checklist

  • make sure at the very least /po and /dbs are owned and writeable by the apache user, probably pootle/settings.py too.
  • once it all works, switch DEBUG in localconfig.py to False

todo: verification things are working, cron jobs, nagios checks, etc.

You might also want to look into tips for Pootle optimisation].